2024-04-04 23:16:31 +02:00
{
lib ,
buildPythonPackage ,
2024-05-24 01:33:13 +00:00
fetchFromGitHub ,
2025-03-15 11:04:06 -07:00
nix-update-script ,
2024-09-06 12:14:06 +02:00
# build-system
2025-02-15 02:01:00 +00:00
pdm-backend ,
2024-09-06 12:14:06 +02:00
# dependencies
2024-04-04 23:16:31 +02:00
aiohttp ,
dataclasses-json ,
2025-01-22 03:42:18 +00:00
httpx-sse ,
2024-09-06 12:14:06 +02:00
langchain ,
2025-01-22 03:42:18 +00:00
langchain-core ,
2024-04-04 23:16:31 +02:00
langsmith ,
2025-02-15 02:01:00 +00:00
numpy ,
2024-09-15 00:12:02 +02:00
pydantic-settings ,
2024-09-06 12:14:06 +02:00
pyyaml ,
requests ,
sqlalchemy ,
tenacity ,
# tests
2024-07-18 19:11:31 +02:00
httpx ,
2025-01-22 19:42:31 +09:00
langchain-tests ,
2024-05-24 01:33:13 +00:00
lark ,
pandas ,
pytest-asyncio ,
pytest-mock ,
pytestCheckHook ,
requests-mock ,
responses ,
syrupy ,
toml ,
2024-01-14 16:37:10 +09:00
} :
buildPythonPackage rec {
pname = " l a n g c h a i n - c o m m u n i t y " ;
2025-03-06 15:24:16 -08:00
version = " 0 . 3 . 1 9 " ;
2024-01-14 16:37:10 +09:00
pyproject = true ;
2024-05-24 01:33:13 +00:00
src = fetchFromGitHub {
owner = " l a n g c h a i n - a i " ;
repo = " l a n g c h a i n " ;
2025-01-22 03:42:18 +00:00
tag = " l a n g c h a i n - c o m m u n i t y = = ${ version } " ;
2025-03-06 15:24:16 -08:00
hash = " s h a 2 5 6 - U 7 L 6 0 G y x R Q L 9 z e 2 2 W y 7 g 6 Z d I / I F y A t U e 1 b R C c o n v 6 p g = " ;
2024-01-14 16:37:10 +09:00
} ;
2024-05-24 01:33:13 +00:00
sourceRoot = " ${ src . name } / l i b s / c o m m u n i t y " ;
2025-02-15 02:01:00 +00:00
build-system = [ pdm-backend ] ;
2024-01-14 16:37:10 +09:00
2025-03-06 15:24:16 -08:00
patches = [
# Remove dependency on blockbuster (not available in nixpkgs due to dependency on forbiddenfruit)
./rm-blockbuster.patch
] ;
2024-10-28 16:48:14 +01:00
pythonRelaxDeps = [
2025-03-06 15:24:16 -08:00
" l a n g c h a i n " # Can fail during updates where building sees the old langchain
2024-12-24 19:13:08 +01:00
" n u m p y "
2024-10-28 16:48:14 +01:00
" p y d a n t i c - s e t t i n g s "
" t e n a c i t y "
] ;
2024-09-15 00:12:02 +02:00
2025-03-06 15:24:16 -08:00
pythonRemoveDeps = [
" b l o c k b u s t e r "
] ;
2024-04-04 23:17:28 +02:00
dependencies = [
2024-01-14 16:37:10 +09:00
aiohttp
dataclasses-json
2025-01-22 03:42:18 +00:00
httpx-sse
2024-05-24 01:33:13 +00:00
langchain
2025-01-22 03:42:18 +00:00
langchain-core
2024-01-14 16:37:10 +09:00
langsmith
2025-02-15 02:01:00 +00:00
numpy
2024-09-15 00:12:02 +02:00
pydantic-settings
2024-01-14 16:37:10 +09:00
pyyaml
requests
sqlalchemy
tenacity
] ;
pythonImportsCheck = [ " l a n g c h a i n _ c o m m u n i t y " ] ;
2024-05-24 01:33:13 +00:00
nativeCheckInputs = [
2024-07-18 19:11:31 +02:00
httpx
2025-01-22 19:42:31 +09:00
langchain-tests
2024-05-24 01:33:13 +00:00
lark
pandas
pytest-asyncio
pytest-mock
pytestCheckHook
requests-mock
responses
syrupy
toml
] ;
pytestFlagsArray = [ " t e s t s / u n i t _ t e s t s " ] ;
2024-01-14 16:37:10 +09:00
2024-06-10 14:57:13 +02:00
__darwinAllowLocalNetworking = true ;
2024-06-15 09:15:34 +02:00
disabledTests = [
# Test require network access
" t e s t _ o v h c l o u d _ e m b e d _ d o c u m e n t s "
2024-09-01 04:16:48 +00:00
" t e s t _ y a n d e x "
2024-07-12 10:53:02 +02:00
# duckdb-engine needs python-wasmer which is not yet available in Python 3.12
# See https://github.com/NixOS/nixpkgs/pull/326337 and https://github.com/wasmerio/wasmer-python/issues/778
" t e s t _ t a b l e _ i n f o "
" t e s t _ s q l _ d a t a b a s e _ r u n "
2024-12-24 19:13:08 +01:00
# pydantic.errors.PydanticUserError: `SQLDatabaseToolkit` is not fully defined; you should define `BaseCache`, then call `SQLDatabaseToolkit.model_rebuild()`.
" t e s t _ c r e a t e _ s q l _ a g e n t "
# pydantic.errors.PydanticUserError: `NatBotChain` is not fully defined; you should define `BaseCache`, then call `NatBotChain.model_rebuild()`.
" t e s t _ p r o p e r _ i n p u t s "
# pydantic.errors.PydanticUserError: `NatBotChain` is not fully defined; you should define `BaseCache`, then call `NatBotChain.model_rebuild()`.
" t e s t _ v a r i a b l e _ k e y _ n a m i n g "
2025-03-06 15:24:16 -08:00
# Fails due to the lack of blockbuster
" t e s t _ g r o u p _ d e p e n d e n c i e s "
2024-06-15 09:15:34 +02:00
] ;
2025-03-15 11:04:06 -07:00
passthru . updateScript = nix-update-script {
extraArgs = [
" - - v e r s i o n - r e g e x "
" ^ l a n g c h a i n - c o m m u n i t y = = ( [ 0 - 9 . ] + ) $ "
] ;
} ;
# updates the wrong fetcher rev attribute
passthru . skipBulkUpdate = true ;
2024-06-10 14:57:13 +02:00
meta = {
2024-07-18 19:11:31 +02:00
changelog = " h t t p s : / / g i t h u b . c o m / l a n g c h a i n - a i / l a n g c h a i n / r e l e a s e s / t a g / l a n g c h a i n - c o m m u n i t y = = ${ version } " ;
2024-01-14 16:37:10 +09:00
description = " C o m m u n i t y c o n t r i b u t e d L a n g C h a i n i n t e g r a t i o n s " ;
homepage = " h t t p s : / / g i t h u b . c o m / l a n g c h a i n - a i / l a n g c h a i n / t r e e / m a s t e r / l i b s / c o m m u n i t y " ;
2024-06-10 14:57:13 +02:00
license = lib . licenses . mit ;
2025-02-06 10:55:24 -08:00
maintainers = with lib . maintainers ; [
natsukium
sarahec
] ;
2024-01-14 16:37:10 +09:00
} ;
}