about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/python-modules/pydantic/1.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/python-modules/pydantic/1.nix')
-rw-r--r--nixpkgs/pkgs/development/python-modules/pydantic/1.nix76
1 files changed, 76 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/python-modules/pydantic/1.nix b/nixpkgs/pkgs/development/python-modules/pydantic/1.nix
new file mode 100644
index 000000000000..e1fc840f0ee1
--- /dev/null
+++ b/nixpkgs/pkgs/development/python-modules/pydantic/1.nix
@@ -0,0 +1,76 @@
+{ lib
+, buildPythonPackage
+, cython
+, email-validator
+, fetchFromGitHub
+, pytest-mock
+, pytestCheckHook
+, python-dotenv
+, pythonOlder
+, setuptools
+, typing-extensions
+, libxcrypt
+}:
+
+buildPythonPackage rec {
+  pname = "pydantic";
+  version = "1.10.13";
+  pyproject = true;
+
+  disabled = pythonOlder "3.7";
+
+  src = fetchFromGitHub {
+    owner = "pydantic";
+    repo = "pydantic";
+    rev = "refs/tags/v${version}";
+    hash = "sha256-ruDVcCLPVuwIkHOjYVuKOoP3hHHr7ItIY55Y6hUgR74=";
+  };
+
+  nativeBuildInputs = [
+    setuptools
+    cython
+  ];
+
+  buildInputs = lib.optionals (pythonOlder "3.9") [
+    libxcrypt
+  ];
+
+  propagatedBuildInputs = [
+    typing-extensions
+  ];
+
+  passthru.optional-dependencies = {
+    dotenv = [
+      python-dotenv
+    ];
+    email = [
+      email-validator
+    ];
+  };
+
+  nativeCheckInputs = [
+    pytest-mock
+    pytestCheckHook
+  ] ++ lib.flatten (lib.attrValues passthru.optional-dependencies);
+
+  pytestFlagsArray = [
+    # https://github.com/pydantic/pydantic/issues/4817
+    "-W" "ignore::pytest.PytestReturnNotNoneWarning"
+  ];
+
+  preCheck = ''
+    export HOME=$(mktemp -d)
+  '';
+
+  enableParallelBuilding = true;
+
+  pythonImportsCheck = [ "pydantic" ];
+
+  meta = with lib; {
+    description = "Data validation and settings management using Python type hinting";
+    homepage = "https://github.com/pydantic/pydantic";
+    changelog = "https://github.com/pydantic/pydantic/blob/v${version}/HISTORY.md";
+    license = licenses.mit;
+    maintainers = with maintainers; [ wd15 ];
+  };
+}