1{ lib
2, stdenv
3, buildPythonPackage
4, pythonOlder
5, rustPlatform
6, fetchFromGitHub
7, libiconv
8 # Check inputs
9, pytestCheckHook
10, fixtures
11, graphviz
12, matplotlib
13, networkx
14, numpy
15, pydot
16}:
17
18buildPythonPackage rec {
19 pname = "retworkx";
20 version = "0.11.0";
21 format = "pyproject";
22 disabled = pythonOlder "3.6";
23
24 src = fetchFromGitHub {
25 owner = "Qiskit";
26 repo = "retworkx";
27 rev = version;
28 hash = "sha256-o3XPMTaiFH5cBtyqtW650wiDBElLvCmERr2XwwdPO1c=";
29 };
30
31 cargoDeps = rustPlatform.fetchCargoTarball {
32 inherit src;
33 name = "${pname}-${version}";
34 hash = "sha256-Zhk4m+HNtimhPWfiBLi9dqJ0fp2D8d0u9k6ROG0/jBo=";
35 };
36
37 nativeBuildInputs = with rustPlatform; [ cargoSetupHook maturinBuildHook ];
38
39 buildInputs = lib.optionals stdenv.isDarwin [ libiconv ];
40
41 pythonImportsCheck = [ "retworkx" ];
42 checkInputs = [
43 pytestCheckHook
44 fixtures
45 graphviz
46 matplotlib
47 networkx
48 numpy
49 pydot
50 ];
51
52 preCheck = ''
53 export TESTDIR=$(mktemp -d)
54 cp -r tests/ $TESTDIR
55 pushd $TESTDIR
56 '';
57 postCheck = "popd";
58
59 meta = with lib; {
60 description = "A python graph library implemented in Rust.";
61 homepage = "https://retworkx.readthedocs.io/en/latest/index.html";
62 downloadPage = "https://github.com/Qiskit/retworkx/releases";
63 changelog = "https://github.com/Qiskit/retworkx/releases/tag/${version}";
64 license = licenses.asl20;
65 maintainers = with maintainers; [ drewrisinger ];
66 };
67}