1{
2 buildPythonPackage,
3 fetchPypi,
4 hypothesis,
5 lib,
6 nix-update-script,
7 pytestCheckHook,
8 pythonOlder,
9 rustPlatform,
10}:
11
12buildPythonPackage rec {
13 pname = "jsonschema-rs";
14 version = "0.30.0";
15
16 pyproject = true;
17
18 disabled = pythonOlder "3.8";
19
20 # Fetching from Pypi, because there is no Cargo.lock in the GitHub repo.
21 src = fetchPypi {
22 inherit version;
23 pname = "jsonschema_rs";
24 hash = "sha256-KfmI0ik3HWrv1WDFsT5xvxyRyXKg2DpmxeuUHOR9MZM=";
25 };
26
27 cargoDeps = rustPlatform.fetchCargoVendor {
28 inherit src;
29 name = "${pname}-${version}";
30 hash = "sha256-LNT2wQnOaVMBrI+fW6wbIRaTYPvw3ESinI5KY8wjp1o=";
31 };
32
33 nativeBuildInputs = with rustPlatform; [
34 cargoSetupHook
35 maturinBuildHook
36 ];
37
38 nativeCheckInputs = [
39 hypothesis
40 pytestCheckHook
41 ];
42
43 pythonImportsCheck = [ "jsonschema_rs" ];
44
45 passthru.updateScript = nix-update-script { };
46
47 meta = {
48 description = "High-performance JSON Schema validator for Python";
49 homepage = "https://github.com/Stranger6667/jsonschema/tree/master/crates/jsonschema-py";
50 changelog = "https://github.com/Stranger6667/jsonschema/blob/python-v${version}/crates/jsonschema-py/CHANGELOG.md";
51 license = lib.licenses.mit;
52 teams = [ lib.teams.apm ];
53 };
54}