Merge pull request #268619 from tweag/lib-descriptions
[NixPkgs.git] / pkgs / development / python-modules / pydantic-core / default.nix
blob6e273aaef4c90796d04825d6f11bcff0581edc1d
1 { stdenv
2 , lib
3 , buildPythonPackage
4 , fetchFromGitHub
5 , cargo
6 , rustPlatform
7 , rustc
8 , libiconv
9 , typing-extensions
10 , pytestCheckHook
11 , hypothesis
12 , pytest-timeout
13 , pytest-mock
14 , dirty-equals
17 let
18   pydantic-core = buildPythonPackage rec {
19     pname = "pydantic-core";
20     version = "2.6.3";
21     format = "pyproject";
23     src = fetchFromGitHub {
24       owner = "pydantic";
25       repo = "pydantic-core";
26       rev = "refs/tags/v${version}";
27       hash = "sha256-bEVACTlzELXPoCtEHMR1s87KJn/qnE0lO1O4RmdjmPM=";
28     };
30     patches = [
31       ./01-remove-benchmark-flags.patch
32     ];
34     cargoDeps = rustPlatform.fetchCargoTarball {
35       inherit src;
36       name = "${pname}-${version}";
37       hash = "sha256-h9SmMLg/W11h/SQz8Te5OoCKdyG6Fctc5ftqbVQFSwU=";
38     };
40     nativeBuildInputs = [
41       cargo
42       rustPlatform.cargoSetupHook
43       rustPlatform.maturinBuildHook
44       rustc
45       typing-extensions
46     ];
48     buildInputs = lib.optionals stdenv.isDarwin [
49       libiconv
50     ];
52     propagatedBuildInputs = [
53       typing-extensions
54     ];
56     pythonImportsCheck = [ "pydantic_core" ];
58     # escape infinite recursion with pydantic via dirty-equals
59     doCheck = false;
60     passthru.tests.pytest = pydantic-core.overrideAttrs { doCheck = true; };
62     nativeCheckInputs = [
63       pytestCheckHook
64       hypothesis
65       pytest-timeout
66       dirty-equals
67       pytest-mock
68     ];
70     disabledTests = [
71       # RecursionError: maximum recursion depth exceeded while calling a Python object
72       "test_recursive"
73     ];
75     disabledTestPaths = [
76       # no point in benchmarking in nixpkgs build farm
77       "tests/benchmarks"
78     ];
80     meta = with lib; {
81       description = "Core validation logic for pydantic written in rust";
82       homepage = "https://github.com/pydantic/pydantic-core";
83       license = licenses.mit;
84       maintainers = with maintainers; [ blaggacao ];
85     };
86   };
87 in pydantic-core