nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, attrs
3, buildPythonPackage
4, fetchPypi
5, importlib-metadata
6, importlib-resources
7, pyrsistent
8, pythonOlder
9, setuptools-scm
10, twisted
11, typing-extensions
12}:
13
14buildPythonPackage rec {
15 pname = "jsonschema";
16 version = "4.5.1";
17 format = "pyproject";
18
19 disabled = pythonOlder "3.7";
20
21 src = fetchPypi {
22 inherit pname version;
23 sha256 = "sha256-fG2IJhk0DDNHob9zFeFH5tPa5DkDOuY4PWrLkIwQHfw=";
24 };
25
26 postPatch = ''
27 patchShebangs json/bin/jsonschema_suite
28 '';
29
30 SETUPTOOLS_SCM_PRETEND_VERSION = version;
31
32 nativeBuildInputs = [
33 setuptools-scm
34 ];
35
36 propagatedBuildInputs = [
37 attrs
38 pyrsistent
39 ] ++ lib.optionals (pythonOlder "3.8") [
40 importlib-metadata
41 typing-extensions
42 ] ++ lib.optionals (pythonOlder "3.9") [
43 importlib-resources
44 ];
45
46 checkInputs = [
47 twisted
48 ];
49
50 checkPhase = ''
51 export JSON_SCHEMA_TEST_SUITE=json
52 trial jsonschema
53 '';
54
55 pythonImportsCheck = [
56 "jsonschema"
57 ];
58
59 meta = with lib; {
60 description = "An implementation of JSON Schema validation for Python";
61 homepage = "https://github.com/python-jsonschema/jsonschema";
62 license = licenses.mit;
63 maintainers = with maintainers; [ domenkozar ];
64 };
65}