diff --git a/pkgs/by-name/ot/oterm/package.nix b/pkgs/by-name/ot/oterm/package.nix index b6dd44bef0fd..a6edcabadeca 100644 --- a/pkgs/by-name/ot/oterm/package.nix +++ b/pkgs/by-name/ot/oterm/package.nix @@ -9,14 +9,14 @@ python3Packages.buildPythonApplication rec { pname = "oterm"; - version = "0.11.1"; + version = "0.12.1"; pyproject = true; src = fetchFromGitHub { owner = "ggozad"; repo = "oterm"; tag = version; - hash = "sha256-b/+siNzmM6RUJ3jv/2dNJJFueejChKde0D5r8J0lTqM="; + hash = "sha256-6y73Lh3cV/fnvpZWzfyD4CletC4UV2zl+I7l88BYPIk="; }; pythonRelaxDeps = [ @@ -37,8 +37,8 @@ python3Packages.buildPythonApplication rec { aiohttp aiosql aiosqlite + fastmcp httpx - jinja2 mcp ollama packaging diff --git a/pkgs/development/python-modules/fastapi-mcp/default.nix b/pkgs/development/python-modules/fastapi-mcp/default.nix new file mode 100644 index 000000000000..60ec0fa3f8ec --- /dev/null +++ b/pkgs/development/python-modules/fastapi-mcp/default.nix @@ -0,0 +1,74 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + + # build-system + hatchling, + tomli, + + # dependencies + fastapi, + httpx, + mcp, + pydantic, + pydantic-settings, + requests, + rich, + typer, + uvicorn, + + # tests + coverage, + pytest-asyncio, + pytest-cov-stub, + pytestCheckHook, +}: + +buildPythonPackage rec { + pname = "fastapi-mcp"; + version = "0.3.4"; + pyproject = true; + + src = fetchFromGitHub { + owner = "tadata-org"; + repo = "fastapi_mcp"; + tag = "v${version}"; + hash = "sha256-t6p/jXQjbhUmIlwoqszRj3GGSrLS0Gcoh1BtizNaw8o="; + }; + + build-system = [ + hatchling + tomli + ]; + + dependencies = [ + fastapi + httpx + mcp + pydantic + pydantic-settings + requests + rich + tomli + typer + uvicorn + ]; + + pythonImportsCheck = [ "fastapi_mcp" ]; + + nativeCheckInputs = [ + coverage + pytest-asyncio + pytest-cov-stub + pytestCheckHook + ]; + + meta = { + description = "Expose your FastAPI endpoints as Model Context Protocol (MCP) tools, with Auth"; + homepage = "https://github.com/tadata-org/fastapi_mcp"; + changelog = "https://github.com/tadata-org/fastapi_mcp/blob/v${version}/CHANGELOG.md"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ GaetanLepage ]; + }; +} diff --git a/pkgs/development/python-modules/fastmcp/default.nix b/pkgs/development/python-modules/fastmcp/default.nix new file mode 100644 index 000000000000..d378c0fc9142 --- /dev/null +++ b/pkgs/development/python-modules/fastmcp/default.nix @@ -0,0 +1,73 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + + # build-system + hatchling, + + # dependencies + exceptiongroup, + httpx, + mcp, + openapi-pydantic, + python-dotenv, + rich, + typer, + websockets, + + # tests + dirty-equals, + fastapi, + pytestCheckHook, +}: + +buildPythonPackage rec { + pname = "fastmcp"; + version = "2.4.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "jlowin"; + repo = "fastmcp"; + tag = "v${version}"; + hash = "sha256-F4lgMm/84svLZo6SZ7AubsC73s4tffqjJcd9gvA7hGA="; + }; + + postPatch = '' + substituteInPlace pyproject.toml \ + --replace-fail ', "uv-dynamic-versioning>=0.7.0"' "" \ + --replace-fail 'dynamic = ["version"]' 'version = "${version}"' + ''; + + build-system = [ + hatchling + ]; + + dependencies = [ + exceptiongroup + httpx + mcp + openapi-pydantic + python-dotenv + rich + typer + websockets + ]; + + pythonImportsCheck = [ "fastmcp" ]; + + nativeCheckInputs = [ + dirty-equals + fastapi + pytestCheckHook + ]; + + meta = { + description = "The fast, Pythonic way to build MCP servers and clients"; + changelog = "https://github.com/jlowin/fastmcp/releases/tag/v${version}"; + homepage = "https://github.com/jlowin/fastmcp"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ GaetanLepage ]; + }; +} diff --git a/pkgs/development/python-modules/gliner/default.nix b/pkgs/development/python-modules/gliner/default.nix new file mode 100644 index 000000000000..77583b257065 --- /dev/null +++ b/pkgs/development/python-modules/gliner/default.nix @@ -0,0 +1,60 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + + # build-system + setuptools, + + # dependencies + huggingface-hub, + onnxruntime, + sentencepiece, + torch, + tqdm, + transformers, +}: + +buildPythonPackage rec { + pname = "gliner"; + version = "0.2.20"; + pyproject = true; + + src = fetchFromGitHub { + owner = "urchade"; + repo = "GLiNER"; + tag = "v${version}"; + hash = "sha256-aWBDnaiq9Z30YT4sszEVk1WAyU4aH8SFD6ESOBkT2ds="; + }; + + build-system = [ + setuptools + ]; + + dependencies = [ + huggingface-hub + onnxruntime + sentencepiece + torch + tqdm + transformers + ]; + + pythonImportsCheck = [ "gliner" ]; + + # All tests require internet + doCheck = false; + + meta = { + description = "Generalist and Lightweight Model for Named Entity Recognition"; + homepage = "https://github.com/urchade/GLiNER"; + changelog = "https://github.com/urchade/GLiNER/releases/tag/v${version}"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ GaetanLepage ]; + badPlatforms = [ + # terminate called after throwing an instance of 'onnxruntime::OnnxRuntimeException' + # Attempt to use DefaultLogger but none has been registered. + "aarch64-linux" + ]; + }; +} diff --git a/pkgs/development/python-modules/mcp/default.nix b/pkgs/development/python-modules/mcp/default.nix index e0f9c268ac28..e68a6ef12382 100644 --- a/pkgs/development/python-modules/mcp/default.nix +++ b/pkgs/development/python-modules/mcp/default.nix @@ -1,44 +1,54 @@ { - anyio, + lib, buildPythonPackage, - coreutils, fetchFromGitHub, + + # build-system hatchling, + + # dependencies + anyio, httpx, httpx-sse, - lib, pydantic, pydantic-settings, + python-multipart, + sse-starlette, + starlette, + uvicorn, + + # optional-dependencies + # cli + python-dotenv, + typer, + # rich + rich, + # ws + websockets, + + # tests pytest-asyncio, pytest-examples, pytestCheckHook, - python-dotenv, - rich, - sse-starlette, - starlette, - typer, - uvicorn, - websockets, + requests, }: buildPythonPackage rec { pname = "mcp"; - version = "1.6.0"; + version = "1.9.0"; pyproject = true; src = fetchFromGitHub { owner = "modelcontextprotocol"; repo = "python-sdk"; tag = "v${version}"; - hash = "sha256-APm3x4tcDbp8D2ygW43wFyP0llJ6fXZiINHRYShp9ZY="; + hash = "sha256-UH91o2ElS0XLjH67R9QaJ/7AeX6oVkqqOc3588D4s0g="; }; postPatch = '' substituteInPlace pyproject.toml \ --replace-fail ', "uv-dynamic-versioning"' "" \ --replace-fail 'dynamic = ["version"]' 'version = "${version}"' - substituteInPlace tests/client/test_stdio.py \ - --replace '/usr/bin/tee' '${lib.getExe' coreutils "tee"}' ''; build-system = [ hatchling ]; @@ -53,6 +63,7 @@ buildPythonPackage rec { httpx-sse pydantic pydantic-settings + python-multipart sse-starlette starlette uvicorn @@ -77,6 +88,7 @@ buildPythonPackage rec { pytest-asyncio pytest-examples pytestCheckHook + requests ] ++ lib.flatten (lib.attrValues optional-dependencies); pytestFlagsArray = [ @@ -89,6 +101,9 @@ buildPythonPackage rec { "test_command_execution" # performance-dependent test "test_messages_are_executed_concurrently" + + # ExceptionGroup: unhandled errors in a TaskGroup (1 sub-exception) + "test_client_session_version_negotiation_failure" ]; __darwinAllowLocalNetworking = true; diff --git a/pkgs/development/python-modules/staticvectors/default.nix b/pkgs/development/python-modules/staticvectors/default.nix new file mode 100644 index 000000000000..793f80902a8c --- /dev/null +++ b/pkgs/development/python-modules/staticvectors/default.nix @@ -0,0 +1,50 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + + # build-system + setuptools, + + # dependencies + huggingface-hub, + numpy, + safetensors, + tqdm, +}: + +buildPythonPackage rec { + pname = "staticvectors"; + version = "0.2.0"; + pyproject = true; + + src = fetchFromGitHub { + owner = "neuml"; + repo = "staticvectors"; + tag = "v${version}"; + hash = "sha256-p3m22qLxQYma0WtkTE/GzHXkxNHjatqLOdeHh4vtyVc="; + }; + + build-system = [ + setuptools + ]; + + dependencies = [ + huggingface-hub + numpy + safetensors + tqdm + ]; + + pythonImportsCheck = [ "staticvectors" ]; + + # no tests + doCheck = false; + + meta = { + description = "Work with static vector models"; + homepage = "https://github.com/neuml/staticvectors"; + license = lib.licenses.asl20; + maintainers = with lib.maintainers; [ GaetanLepage ]; + }; +} diff --git a/pkgs/development/python-modules/txtai/default.nix b/pkgs/development/python-modules/txtai/default.nix index 4292552242b1..4e3d4788a6c4 100644 --- a/pkgs/development/python-modules/txtai/default.nix +++ b/pkgs/development/python-modules/txtai/default.nix @@ -16,6 +16,9 @@ regex, # optional-dependencies + # agent + mcpadapt, + smolagents, # ann annoy, hnswlib, @@ -25,11 +28,14 @@ # api aiohttp, fastapi, + fastapi-mcp, + httpx, pillow, python-multipart, uvicorn, # cloud # apache-libcloud, (unpackaged) + fasteners, # console rich, # database @@ -38,7 +44,6 @@ # grand-cypher (unpackaged) # grand-graph (unpackaged) networkx, - python-louvain, # model onnx, onnxruntime, @@ -61,8 +66,9 @@ litellm, # llama-cpp-python, (unpackaged) # pipeline-text - fasttext, + gliner, sentencepiece, + staticvectors, # pipeline-train accelerate, bitsandbytes, @@ -70,6 +76,7 @@ peft, skl2onnx, # vectors + fasttext, # pymagnitude-lite, (unpackaged) scikit-learn, sentence-transformers, @@ -82,12 +89,15 @@ xmltodict, # tests - httpx, msgpack, pytestCheckHook, }: let - version = "8.2.0"; + version = "8.5.0"; + agent = [ + mcpadapt + smolagents + ]; ann = [ annoy hnswlib @@ -98,11 +108,16 @@ let api = [ aiohttp fastapi + fastapi-mcp + httpx pillow python-multipart uvicorn ]; - # cloud = [ apache-libcloud ]; + cloud = [ + # apache-libcloud + fasteners + ]; console = [ rich ]; database = [ duckdb @@ -113,7 +128,6 @@ let # grand-cypher # grand-graph networkx - python-louvain sqlalchemy ]; model = [ @@ -145,8 +159,9 @@ let # llama-cpp-python ]; pipeline-text = [ - fasttext + gliner sentencepiece + staticvectors ]; pipeline-train = [ accelerate @@ -186,7 +201,8 @@ let ]; similarity = ann ++ vectors; all = - api + agent + ++ api ++ ann ++ console ++ database @@ -199,8 +215,10 @@ let optional-dependencies = { inherit + agent ann api + cloud console database graph @@ -222,7 +240,7 @@ let owner = "neuml"; repo = "txtai"; tag = "v${version}"; - hash = "sha256-fMzCYw9eqlpGI5FKoyYyxT17EhUFmFP9lrCn/LFC6ks="; + hash = "sha256-kYjlA7pJ+xCC+tu0aaxziKaPo3hph5Ld8P/lVrip/eM="; }; in buildPythonPackage { @@ -264,8 +282,10 @@ buildPythonPackage { msgpack pytestCheckHook python-multipart + timm sqlalchemy ] + ++ optional-dependencies.agent ++ optional-dependencies.ann ++ optional-dependencies.api ++ optional-dependencies.similarity; @@ -280,9 +300,9 @@ buildPythonPackage { "--deselect=test/python/testconsole.py" "--deselect=test/python/testembeddings.py" "--deselect=test/python/testgraph.py" - "--deselect=test/python/testapi/testembeddings.py" - "--deselect=test/python/testapi/testpipelines.py" - "--deselect=test/python/testapi/testworkflow.py" + "--deselect=test/python/testapi/testapiembeddings.py" + "--deselect=test/python/testapi/testapipipelines.py" + "--deselect=test/python/testapi/testapiworkflow.py" "--deselect=test/python/testdatabase/testclient.py" "--deselect=test/python/testdatabase/testduckdb.py" "--deselect=test/python/testdatabase/testencoder.py" @@ -295,6 +315,7 @@ buildPythonPackage { "testInvalidZip" # Downloads from Huggingface "testPipeline" + "testVectors" # Not finding sqlite-vec despite being supplied "testSQLite" "testSQLiteCustom" diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 1879d445a514..764bab2093a5 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -4809,6 +4809,8 @@ self: super: with self; { fastapi-mail = callPackage ../development/python-modules/fastapi-mail { }; + fastapi-mcp = callPackage ../development/python-modules/fastapi-mcp { }; + fastapi-sso = callPackage ../development/python-modules/fastapi-sso { }; fastavro = callPackage ../development/python-modules/fastavro { }; @@ -4845,6 +4847,8 @@ self: super: with self; { fastjsonschema = callPackage ../development/python-modules/fastjsonschema { }; + fastmcp = callPackage ../development/python-modules/fastmcp { }; + fastmri = callPackage ../development/python-modules/fastmri { }; fastnlo-toolkit = toPythonModule ( @@ -5692,6 +5696,8 @@ self: super: with self; { glfw = callPackage ../development/python-modules/glfw { }; + gliner = callPackage ../development/python-modules/gliner { }; + glob2 = callPackage ../development/python-modules/glob2 { }; globus-sdk = callPackage ../development/python-modules/globus-sdk { }; @@ -16734,6 +16740,8 @@ self: super: with self; { staticmap = callPackage ../development/python-modules/staticmap { }; + staticvectors = callPackage ../development/python-modules/staticvectors { }; + statistics = callPackage ../development/python-modules/statistics { }; statmake = callPackage ../development/python-modules/statmake { };