nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 fetchPypi,
4 buildPythonPackage,
5 rustPlatform,
6 pytestCheckHook,
7 psutil,
8 cbor2,
9 hypothesis,
10}:
11
12buildPythonPackage rec {
13 pname = "pycddl";
14 version = "0.6.4";
15 pyproject = true;
16
17 src = fetchPypi {
18 inherit pname version;
19 hash = "sha256-aUa6Q3e1RwvWN0NPqbJtWW3o/yzJxUc0g7gUGKUlOXo=";
20 };
21
22 nativeBuildInputs = with rustPlatform; [
23 maturinBuildHook
24 cargoSetupHook
25 ];
26
27 postPatch = ''
28 # We don't place pytest-benchmark in the closure because we have no
29 # intention of running the benchmarks. Make sure pip doesn't fail as a
30 # result of it being missing by removing it from the requirements list.
31 sed -i -e /pytest-benchmark/d requirements-dev.txt
32
33 # Now that we've gotten rid of pytest-benchmark we need to get rid of the
34 # benchmarks too, otherwise they fail at import time due to the missing
35 # dependency.
36 rm tests/test_benchmarks.py
37 '';
38
39 cargoDeps = rustPlatform.fetchCargoVendor {
40 inherit pname version src;
41 hash = "sha256-cEpvkSqe/wRCxEajmM148jbo6a346x2t81pMRpKEJyE=";
42 };
43
44 nativeCheckInputs = [
45 hypothesis
46 pytestCheckHook
47 psutil
48 cbor2
49 ];
50
51 disabledTests = [
52 # flaky
53 "test_memory_usage"
54 ];
55
56 pythonImportsCheck = [ "pycddl" ];
57
58 meta = {
59 description = "Python bindings for the Rust cddl crate";
60 homepage = "https://gitlab.com/tahoe-lafs/pycddl";
61 changelog = "https://gitlab.com/tahoe-lafs/pycddl/-/tree/v${version}#release-notes";
62 license = lib.licenses.mit;
63 maintainers = [ lib.maintainers.exarkun ];
64 };
65}