{ lib, buildPythonPackage, hatchling, pydantic, logfire-api, httpx, eval-type-backport, griffe, pydantic-graph, pythonOlder, sources, writeTextFile, }: let version = sources.pydantic-ai.version; pyproject_toml = writeTextFile { name = "pyproject.toml"; text = '' [build-system] requires = ["hatchling"] build-backend = "hatchling.build" [project] name = "pydantic-ai-slim" version = "${version}" description = "Agent Framework / shim to use Pydantic with LLMs, slim package" authors = [{ name = "Samuel Colvin", email = "samuel@pydantic.dev" }] license = "MIT" readme = "README.md" requires-python = ">=3.9" dependencies = [ "eval-type-backport>=0.2.0", "griffe>=1.3.2", "httpx>=0.27", "pydantic>=2.10", "pydantic-graph==0.1.9", "exceptiongroup; python_version < '3.11'", "opentelemetry-api>=1.28.0", "typing-inspection>=0.4.0", ] [tool.hatch.metadata] allow-direct-references = true [project.scripts] pai = "pydantic_ai._cli:app" [tool.hatch.build.targets.wheel] packages = ["pydantic_ai"] ''; }; in buildPythonPackage rec { pname = "pydantic-ai-slim"; inherit version; pyproject = true; disabled = pythonOlder "3.8"; src = sources.pydantic-ai; build-system = [hatchling]; sourceRoot = "pydantic-ai-src/pydantic_ai_slim"; dependencies = [ pydantic logfire-api httpx eval-type-backport griffe pydantic-graph ]; nativeCheckInputs = [ pydantic logfire-api httpx eval-type-backport griffe pydantic-graph ]; preBuild = '' cp ${pyproject_toml} ./pyproject.toml ''; pythonImportsCheck = [ "pydantic-ai-slim[openai,vertexai,groq,anthropic,mistral,cohere]" ]; meta = { description = "Graph and finite state machine library"; homepage = "https://github.com/pydantic/pydantic-ai"; changelog = "https://github.com/pydantic/pydantic-ai/releases/tag/v${version}"; license = lib.licenses.mit; maintainers = with lib.maintainers; [bsima]; }; }