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.23.0";
33 pyproject = true;
34
35 disabled = pythonOlder "3.8";
36
37 src = fetchPypi {
38 inherit pname version;
39 hash = "sha256-1xSX/vJjUaMyZTN/p3/+uCQj8+ohKDzZRnuwOZkma8Q=";
40 };
41
42 postPatch = ''
43 patchShebangs json/bin/jsonschema_suite
44 '';
45
46 build-system = [
47 hatch-fancy-pypi-readme
48 hatch-vcs
49 hatchling
50 ];
51
52 dependencies =
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 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 = "Implementation of JSON Schema validation";
96 homepage = "https://github.com/python-jsonschema/jsonschema";
97 changelog = "https://github.com/python-jsonschema/jsonschema/blob/v${version}/CHANGELOG.rst";
98 license = licenses.mit;
99 maintainers = with maintainers; [ domenkozar ];
100 mainProgram = "jsonschema";
101 };
102}