mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-25 23:20:55 +00:00
pythonPackages.pydantic: init at 0.31
This commit is contained in:
parent
1c3c07394a
commit
f878d34e5f
51
pkgs/development/python-modules/pydantic/default.nix
Normal file
51
pkgs/development/python-modules/pydantic/default.nix
Normal file
|
@ -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 ];
|
||||
};
|
||||
}
|
|
@ -6043,6 +6043,8 @@ in {
|
|||
|
||||
uvicorn = callPackage ../development/python-modules/uvicorn { };
|
||||
|
||||
pydantic = callPackage ../development/python-modules/pydantic { };
|
||||
|
||||
});
|
||||
|
||||
in fix' (extends overrides packages)
|
||||
|
|
Loading…
Reference in a new issue