{ lib, buildPythonPackage, hatchling, pydantic-ai-slim, pythonOlder, pytest-vcr, dirty-equals, 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" version = "${version}" description = "Agent Framework / shim to use Pydantic with LLMs" authors = [ { name = "Samuel Colvin", email = "samuel@pydantic.dev" }, { name = "Marcelo Trylesinski", email = "marcelotryle@gmail.com" }, { name = "David Montague", email = "david@pydantic.dev" }, { name = "Alex Hall", email = "alex@pydantic.dev" }, ] license = "MIT" readme = "README.md" requires-python = ">=3.9" dependencies = [ "pydantic-ai-slim[openai,vertexai,groq,anthropic,mistral,cohere,bedrock,cli,mcp,evals]==${version}", ] [project.urls] Homepage = "https://ai.pydantic.dev" Source = "https://github.com/pydantic/pydantic-ai" Documentation = "https://ai.pydantic.dev" Changelog = "https://github.com/pydantic/pydantic-ai/releases" [project.scripts] pai = "pydantic_ai._cli:app" ''; }; in buildPythonPackage rec { pname = "pydantic-ai"; inherit version; pyproject = true; disabled = pythonOlder "3.8"; src = sources.pydantic-ai; build-system = [hatchling]; dependencies = [pydantic-ai-slim]; nativeCheckInputs = [ pydantic-ai-slim pytest-vcr dirty-equals # pytestCheckHook ]; preBuild = '' cp ${pyproject_toml} ./pyproject.toml ''; pythonImportsCheck = [ "pydantic_ai" ]; meta = { description = "Agent Framework / shim to use Pydantic with LLMs"; 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]; }; }