about summary refs log tree commit diff
path: root/pkgs/development/python-modules/pydantic
diff options
context:
space:
mode:
authorDaniel Wheeler <daniel.wheeler2@gmail.com>2019-07-25 17:26:49 -0400
committerFrederik Rietdijk <freddyrietdijk@fridh.nl>2019-07-27 11:50:48 +0200
commitf878d34e5fe57a4fa6e26e0015c4589b25c0b25a (patch)
tree3a85da38a03df6491cbf4046c8944a852de1d3e8 /pkgs/development/python-modules/pydantic
parent1c3c07394aa241dd982e7f0c5fffdb3c953f654c (diff)
pythonPackages.pydantic: init at 0.31
Diffstat (limited to 'pkgs/development/python-modules/pydantic')
-rw-r--r--pkgs/development/python-modules/pydantic/default.nix51
1 files changed, 51 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/pydantic/default.nix b/pkgs/development/python-modules/pydantic/default.nix
new file mode 100644
index 0000000000000..9b713827199b5
--- /dev/null
+++ b/pkgs/development/python-modules/pydantic/default.nix
@@ -0,0 +1,51 @@
+{ lib
+, buildPythonPackage
+, fetchPypi
+, ujson
+, email_validator
+, typing-extensions
+, python
+, isPy3k
+}:
+
+buildPythonPackage rec {
+  pname = "pydantic";
+  version = "0.31";
+  disabled = !isPy3k;
+
+  src = fetchPypi {
+    inherit pname version;
+    sha256 = "0x9xc5hpyrlf05dc4bx9f7v51fahxcahkvh0ij8ibay15nwli53d";
+  };
+
+  propagatedBuildInputs = [
+    ujson
+    email_validator
+    typing-extensions
+  ];
+
+  checkPhase = ''
+    ${python.interpreter} -c """
+from datetime import datetime
+from typing import List
+from pydantic import BaseModel
+
+class User(BaseModel):
+    id: int
+    name = 'John Doe'
+    signup_ts: datetime = None
+    friends: List[int] = []
+
+external_data = {'id': '123', 'signup_ts': '2017-06-01 12:22', 'friends': [1, '2', b'3']}
+user = User(**external_data)
+assert user.id is "123"
+"""
+  '';
+
+  meta = with lib; {
+    homepage = "https://github.com/samuelcolvin/pydantic";
+    description = "Data validation and settings management using Python type hinting";
+    license = licenses.mit;
+    maintainers = with maintainers; [ wd15 ];
+  };
+}