about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/pydantic-core/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/pydantic-core/default.nix')
-rw-r--r--nixpkgs/pkgs/development/python-modules/pydantic-core/default.nix112
1 files changed, 61 insertions, 51 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/pydantic-core/default.nix b/nixpkgs/pkgs/development/python-modules/pydantic-core/default.nix
index 7826712acb6e..6e273aaef4c9 100644
--- a/nixpkgs/pkgs/development/python-modules/pydantic-core/default.nix
+++ b/nixpkgs/pkgs/development/python-modules/pydantic-core/default.nix
@@ -14,64 +14,74 @@
 , dirty-equals
 }:
 
-buildPythonPackage rec {
-  pname = "pydantic-core";
-  version = "2.3.0";
-  format = "pyproject";
+let
+  pydantic-core = buildPythonPackage rec {
+    pname = "pydantic-core";
+    version = "2.6.3";
+    format = "pyproject";
 
-  src = fetchFromGitHub {
-    owner = "pydantic";
-    repo = "pydantic-core";
-    rev = "v${version}";
-    hash = "sha256-Wi+b+xiJtVi3KIy6bzT29kyHFSI7mbMNrLa/Iu3cTEY=";
-  };
+    src = fetchFromGitHub {
+      owner = "pydantic";
+      repo = "pydantic-core";
+      rev = "refs/tags/v${version}";
+      hash = "sha256-bEVACTlzELXPoCtEHMR1s87KJn/qnE0lO1O4RmdjmPM=";
+    };
 
-  patches = [
-    ./01-remove-benchmark-flags.patch
-  ];
+    patches = [
+      ./01-remove-benchmark-flags.patch
+    ];
 
-  cargoDeps = rustPlatform.importCargoLock {
-    lockFile = ./Cargo.lock;
-  };
+    cargoDeps = rustPlatform.fetchCargoTarball {
+      inherit src;
+      name = "${pname}-${version}";
+      hash = "sha256-h9SmMLg/W11h/SQz8Te5OoCKdyG6Fctc5ftqbVQFSwU=";
+    };
+
+    nativeBuildInputs = [
+      cargo
+      rustPlatform.cargoSetupHook
+      rustPlatform.maturinBuildHook
+      rustc
+      typing-extensions
+    ];
+
+    buildInputs = lib.optionals stdenv.isDarwin [
+      libiconv
+    ];
+
+    propagatedBuildInputs = [
+      typing-extensions
+    ];
 
-  nativeBuildInputs = [
-    cargo
-    rustPlatform.cargoSetupHook
-    rustPlatform.maturinBuildHook
-    rustc
-    typing-extensions
-  ];
+    pythonImportsCheck = [ "pydantic_core" ];
 
-  buildInputs = lib.optionals stdenv.isDarwin [
-    libiconv
-  ];
+    # escape infinite recursion with pydantic via dirty-equals
+    doCheck = false;
+    passthru.tests.pytest = pydantic-core.overrideAttrs { doCheck = true; };
 
-  propagatedBuildInputs = [
-    typing-extensions
-  ];
+    nativeCheckInputs = [
+      pytestCheckHook
+      hypothesis
+      pytest-timeout
+      dirty-equals
+      pytest-mock
+    ];
 
-  pythonImportsCheck = [ "pydantic_core" ];
+    disabledTests = [
+      # RecursionError: maximum recursion depth exceeded while calling a Python object
+      "test_recursive"
+    ];
 
-  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"
-  ];
+    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 ];
+    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 ];
+    };
   };
-}
+in pydantic-core