1{ 2 stdenv, 3 lib, 4 buildPythonPackage, 5 fetchFromGitHub, 6 cargo, 7 rustPlatform, 8 rustc, 9 libiconv, 10 typing-extensions, 11 pytestCheckHook, 12 hypothesis, 13 pytest-timeout, 14 pytest-mock, 15 dirty-equals, 16 pydantic, 17}: 18 19let 20 pydantic-core = buildPythonPackage rec { 21 pname = "pydantic-core"; 22 version = "2.33.2"; 23 pyproject = true; 24 25 src = fetchFromGitHub { 26 owner = "pydantic"; 27 repo = "pydantic-core"; 28 tag = "v${version}"; 29 hash = "sha256-2jUkd/Y92Iuq/A31cevqjZK4bCOp+AEC/MAnHSt2HLY="; 30 }; 31 32 cargoDeps = rustPlatform.fetchCargoVendor { 33 inherit pname version src; 34 hash = "sha256-MY6Gxoz5Q7nCptR+zvdABh2agfbpqOtfTtor4pmkb9c="; 35 }; 36 37 nativeBuildInputs = [ 38 cargo 39 rustPlatform.cargoSetupHook 40 rustc 41 ]; 42 43 build-system = [ 44 rustPlatform.maturinBuildHook 45 typing-extensions 46 ]; 47 48 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ]; 49 50 dependencies = [ typing-extensions ]; 51 52 pythonImportsCheck = [ "pydantic_core" ]; 53 54 # escape infinite recursion with pydantic via dirty-equals 55 doCheck = false; 56 passthru.tests.pytest = pydantic-core.overrideAttrs { doCheck = true; }; 57 58 nativeCheckInputs = [ 59 pytestCheckHook 60 hypothesis 61 pytest-timeout 62 dirty-equals 63 pytest-mock 64 ]; 65 66 disabledTests = [ 67 # RecursionError: maximum recursion depth exceeded while calling a Python object 68 "test_recursive" 69 ]; 70 71 disabledTestPaths = [ 72 # no point in benchmarking in nixpkgs build farm 73 "tests/benchmarks" 74 ]; 75 76 meta = with lib; { 77 changelog = "https://github.com/pydantic/pydantic-core/releases/tag/v${version}"; 78 description = "Core validation logic for pydantic written in rust"; 79 homepage = "https://github.com/pydantic/pydantic-core"; 80 license = licenses.mit; 81 maintainers = pydantic.meta.maintainers; 82 }; 83 }; 84in 85pydantic-core