summaryrefslogtreecommitdiff
path: root/Omni/Bild/Deps/pydantic-ai-slim.nix
blob: 067508bccab0fdd40c6072cb31e5e8d0710e57d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
{
  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];
    };
  }