1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 pythonOlder, 6 7 # build-system 8 hatchling, 9 hatch-fancy-pypi-readme, 10 11 # dependencies 12 annotated-types, 13 pydantic-core, 14 typing-extensions, 15 typing-inspection, 16 17 # tests 18 cloudpickle, 19 email-validator, 20 dirty-equals, 21 jsonschema, 22 pytestCheckHook, 23 pytest-codspeed, 24 pytest-mock, 25 pytest-run-parallel, 26 eval-type-backport, 27 rich, 28}: 29 30buildPythonPackage rec { 31 pname = "pydantic"; 32 version = "2.11.1"; 33 pyproject = true; 34 35 disabled = pythonOlder "3.8"; 36 37 src = fetchFromGitHub { 38 owner = "pydantic"; 39 repo = "pydantic"; 40 tag = "v${version}"; 41 hash = "sha256-82knT2Dzm/p0dz56bH0sZ4WffgFnN5cukbipPBO65fQ="; 42 }; 43 44 postPatch = '' 45 sed -i "/--benchmark/d" pyproject.toml 46 ''; 47 48 build-system = [ 49 hatch-fancy-pypi-readme 50 hatchling 51 ]; 52 53 dependencies = [ 54 annotated-types 55 pydantic-core 56 typing-extensions 57 typing-inspection 58 ]; 59 60 optional-dependencies = { 61 email = [ email-validator ]; 62 }; 63 64 nativeCheckInputs = 65 [ 66 cloudpickle 67 dirty-equals 68 jsonschema 69 pytest-codspeed 70 pytest-mock 71 pytest-run-parallel 72 pytestCheckHook 73 rich 74 ] 75 ++ lib.flatten (lib.attrValues optional-dependencies) 76 ++ lib.optionals (pythonOlder "3.10") [ eval-type-backport ]; 77 78 preCheck = '' 79 export HOME=$(mktemp -d) 80 ''; 81 82 disabledTestPaths = [ 83 "tests/benchmarks" 84 85 # avoid cyclic dependency 86 "tests/test_docs.py" 87 ]; 88 89 pythonImportsCheck = [ "pydantic" ]; 90 91 meta = with lib; { 92 description = "Data validation and settings management using Python type hinting"; 93 homepage = "https://github.com/pydantic/pydantic"; 94 changelog = "https://github.com/pydantic/pydantic/blob/${src.tag}/HISTORY.md"; 95 license = licenses.mit; 96 maintainers = with maintainers; [ wd15 ]; 97 }; 98}