about summary refs log tree commit diff
path: root/pkgs/development/python-modules/pydantic-core/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/pydantic-core/default.nix')
-rw-r--r--pkgs/development/python-modules/pydantic-core/default.nix71
1 files changed, 71 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/pydantic-core/default.nix b/pkgs/development/python-modules/pydantic-core/default.nix
new file mode 100644
index 000000000000..c61a060fd432
--- /dev/null
+++ b/pkgs/development/python-modules/pydantic-core/default.nix
@@ -0,0 +1,71 @@
+{ lib
+, buildPythonPackage
+, fetchFromGitHub
+, cargo
+, rustPlatform
+, rustc
+, 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
+  ];
+
+  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 ];
+  };
+}