1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 cython,
8 setuptools,
9
10 # dependencies
11 typing-extensions,
12
13 # optional-dependencies
14 python-dotenv,
15 email-validator,
16
17 # tests
18 distutils,
19 pytest-mock,
20 pytest7CheckHook,
21 writableTmpDirAsHomeHook,
22}:
23
24buildPythonPackage rec {
25 pname = "pydantic";
26 version = "1.10.24";
27 pyproject = true;
28
29 src = fetchFromGitHub {
30 owner = "pydantic";
31 repo = "pydantic";
32 tag = "v${version}";
33 hash = "sha256-eDmVpo6tI6a1lfBOU7Bvq9Wv/+I959c7krYPzZEoQig=";
34 };
35
36 build-system = [
37 cython
38 setuptools
39 ];
40
41 dependencies = [ typing-extensions ];
42
43 optional-dependencies = {
44 dotenv = [ python-dotenv ];
45 email = [ email-validator ];
46 };
47
48 nativeCheckInputs = [
49 distutils
50 pytest-mock
51 pytest7CheckHook
52 writableTmpDirAsHomeHook
53 ]
54 ++ lib.flatten (lib.attrValues optional-dependencies);
55
56 enableParallelBuilding = true;
57
58 pythonImportsCheck = [ "pydantic" ];
59
60 meta = {
61 description = "Data validation and settings management using Python type hinting";
62 homepage = "https://github.com/pydantic/pydantic";
63 changelog = "https://github.com/pydantic/pydantic/blob/v${version}/HISTORY.md";
64 license = lib.licenses.mit;
65 maintainers = with lib.maintainers; [ wd15 ];
66 };
67}