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.21";
27 pyproject = true;
28
29 src = fetchFromGitHub {
30 owner = "pydantic";
31 repo = "pydantic";
32 tag = "v${version}";
33 hash = "sha256-0kwqJsay+4xh+jgDStNciRPJmuqm8GzA+6ble4K4HuI=";
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 ] ++ lib.flatten (lib.attrValues optional-dependencies);
54
55 enableParallelBuilding = true;
56
57 pythonImportsCheck = [ "pydantic" ];
58
59 meta = {
60 description = "Data validation and settings management using Python type hinting";
61 homepage = "https://github.com/pydantic/pydantic";
62 changelog = "https://github.com/pydantic/pydantic/blob/v${version}/HISTORY.md";
63 license = lib.licenses.mit;
64 maintainers = with lib.maintainers; [ wd15 ];
65 };
66}