about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/pydantic-core/default.nix
blob: 7826712acb6ecdb6d9a359346e5fdf376f7b7afe (plain) (blame)
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
{ stdenv
, lib
, buildPythonPackage
, fetchFromGitHub
, cargo
, rustPlatform
, rustc
, libiconv
, typing-extensions
, pytestCheckHook
, hypothesis
, pytest-timeout
, pytest-mock
, dirty-equals
}:

buildPythonPackage rec {
  pname = "pydantic-core";
  version = "2.3.0";
  format = "pyproject";

  src = fetchFromGitHub {
    owner = "pydantic";
    repo = "pydantic-core";
    rev = "v${version}";
    hash = "sha256-Wi+b+xiJtVi3KIy6bzT29kyHFSI7mbMNrLa/Iu3cTEY=";
  };

  patches = [
    ./01-remove-benchmark-flags.patch
  ];

  cargoDeps = rustPlatform.importCargoLock {
    lockFile = ./Cargo.lock;
  };

  nativeBuildInputs = [
    cargo
    rustPlatform.cargoSetupHook
    rustPlatform.maturinBuildHook
    rustc
    typing-extensions
  ];

  buildInputs = lib.optionals stdenv.isDarwin [
    libiconv
  ];

  propagatedBuildInputs = [
    typing-extensions
  ];

  pythonImportsCheck = [ "pydantic_core" ];

  nativeCheckInputs = [
    pytestCheckHook
    hypothesis
    pytest-timeout
    dirty-equals
    pytest-mock
  ];
  disabledTests = [
    # RecursionError: maximum recursion depth exceeded while calling a Python object
    "test_recursive"
  ];
  disabledTestPaths = [
    # no point in benchmarking in nixpkgs build farm
    "tests/benchmarks"
  ];

  meta = with lib; {
    description = "Core validation logic for pydantic written in rust";
    homepage = "https://github.com/pydantic/pydantic-core";
    license = licenses.mit;
    maintainers = with maintainers; [ blaggacao ];
  };
}