1{
2 lib,
3 attrs,
4 buildPythonPackage,
5 fetchPypi,
6 hatch-fancy-pypi-readme,
7 hatch-vcs,
8 hatchling,
9 importlib-resources,
10 jsonschema-specifications,
11 pkgutil-resolve-name,
12 pip,
13 pytestCheckHook,
14 pythonOlder,
15 referencing,
16 rpds-py,
17
18 # optionals
19 fqdn,
20 idna,
21 isoduration,
22 jsonpointer,
23 rfc3339-validator,
24 rfc3986-validator,
25 rfc3987,
26 uri-template,
27 webcolors,
28}:
29
30buildPythonPackage rec {
31 pname = "jsonschema";
32 version = "4.21.1";
33 format = "pyproject";
34
35 disabled = pythonOlder "3.8";
36
37 src = fetchPypi {
38 inherit pname version;
39 hash = "sha256-hXJ8ACefX6a+2+YjjSqmQDvt2LSGSrESB9B988wbLuU=";
40 };
41
42 postPatch = ''
43 patchShebangs json/bin/jsonschema_suite
44 '';
45
46 nativeBuildInputs = [
47 hatch-fancy-pypi-readme
48 hatch-vcs
49 hatchling
50 ];
51
52 propagatedBuildInputs =
53 [
54 attrs
55 jsonschema-specifications
56 referencing
57 rpds-py
58 ]
59 ++ lib.optionals (pythonOlder "3.9") [
60 importlib-resources
61 pkgutil-resolve-name
62 ];
63
64 passthru.optional-dependencies = {
65 format = [
66 fqdn
67 idna
68 isoduration
69 jsonpointer
70 rfc3339-validator
71 rfc3987
72 uri-template
73 webcolors
74 ];
75 format-nongpl = [
76 fqdn
77 idna
78 isoduration
79 jsonpointer
80 rfc3339-validator
81 rfc3986-validator
82 uri-template
83 webcolors
84 ];
85 };
86
87 nativeCheckInputs = [
88 pip
89 pytestCheckHook
90 ];
91
92 pythonImportsCheck = [ "jsonschema" ];
93
94 meta = with lib; {
95 description = "An implementation of JSON Schema validation";
96 mainProgram = "jsonschema";
97 homepage = "https://github.com/python-jsonschema/jsonschema";
98 license = licenses.mit;
99 maintainers = with maintainers; [ domenkozar ];
100 };
101}