spicedb: 1.39.1 -> 1.40.0
[NixPkgs.git] / pkgs / development / python-modules / pydantic / default.nix
blob3aa0d0aa2bad7f0ac188c778ddbb2e89fdd0644c
2   lib,
3   buildPythonPackage,
4   fetchFromGitHub,
5   pythonOlder,
7   # build-system
8   hatchling,
9   hatch-fancy-pypi-readme,
11   # native dependencies
12   libxcrypt,
14   # dependencies
15   annotated-types,
16   pydantic-core,
17   typing-extensions,
19   # tests
20   cloudpickle,
21   email-validator,
22   dirty-equals,
23   jsonschema,
24   pytestCheckHook,
25   pytest-mock,
26   eval-type-backport,
27   rich,
30 buildPythonPackage rec {
31   pname = "pydantic";
32   version = "2.10.3";
33   pyproject = true;
35   disabled = pythonOlder "3.8";
37   src = fetchFromGitHub {
38     owner = "pydantic";
39     repo = "pydantic";
40     tag = "v${version}";
41     hash = "sha256-/QxWgViqVmPnX/sO+qkvGl+WQX3OPXpS44CdP2HHOis=";
42   };
44   buildInputs = lib.optionals (pythonOlder "3.9") [ libxcrypt ];
46   build-system = [
47     hatch-fancy-pypi-readme
48     hatchling
49   ];
51   dependencies = [
52     annotated-types
53     pydantic-core
54     typing-extensions
55   ];
57   optional-dependencies = {
58     email = [ email-validator ];
59   };
61   nativeCheckInputs =
62     [
63       cloudpickle
64       dirty-equals
65       jsonschema
66       pytest-mock
67       pytestCheckHook
68       rich
69     ]
70     ++ lib.flatten (lib.attrValues optional-dependencies)
71     ++ lib.optionals (pythonOlder "3.10") [ eval-type-backport ];
73   preCheck = ''
74     export HOME=$(mktemp -d)
75     substituteInPlace pyproject.toml \
76       --replace-fail "'--benchmark-columns', 'min,mean,stddev,outliers,rounds,iterations'," "" \
77       --replace-fail "'--benchmark-group-by', 'group'," "" \
78       --replace-fail "'--benchmark-warmup', 'on'," "" \
79       --replace-fail "'--benchmark-disable'," ""
80   '';
82   pytestFlagsArray = [
83     # suppress warnings with pytest>=8
84     "-Wignore::pydantic.warnings.PydanticDeprecatedSince20"
85     "-Wignore::pydantic.json_schema.PydanticJsonSchemaWarning"
86   ];
88   disabledTests = [
89     # disable failing test with pytest>=8
90     "test_assert_raises_validation_error"
91   ];
93   disabledTestPaths = [
94     "tests/benchmarks"
96     # avoid cyclic dependency
97     "tests/test_docs.py"
98   ];
100   pythonImportsCheck = [ "pydantic" ];
102   meta = with lib; {
103     description = "Data validation and settings management using Python type hinting";
104     homepage = "https://github.com/pydantic/pydantic";
105     changelog = "https://github.com/pydantic/pydantic/blob/v${version}/HISTORY.md";
106     license = licenses.mit;
107     maintainers = with maintainers; [ wd15 ];
108   };