1{ lib
2, buildPythonPackage
3, pythonOlder
4, rustPlatform
5, fetchFromGitHub
6
7 # Check inputs
8, pytestCheckHook
9, networkx
10, numpy
11}:
12
13buildPythonPackage rec {
14 pname = "retworkx";
15 version = "0.8.0";
16 format = "pyproject";
17 disabled = pythonOlder "3.6";
18
19 src = fetchFromGitHub {
20 owner = "Qiskit";
21 repo = "retworkx";
22 rev = version;
23 sha256 = "0plpri6a3d6f1000kmcah9066vq2i37d14bdf8sm96493fhpqhrd";
24 };
25
26 cargoDeps = rustPlatform.fetchCargoTarball {
27 inherit src;
28 name = "${pname}-${version}";
29 hash = "sha256-+k779gmge8wDdoZrWn9ND47kUqt7pqe75Zuj2Byfefo=";
30 };
31
32 nativeBuildInputs = with rustPlatform; [ cargoSetupHook maturinBuildHook ];
33
34 # Needed b/c need to check AFTER python wheel is installed (using Rust Build, not buildPythonPackage)
35 doCheck = false;
36 doInstallCheck = true;
37
38 installCheckInputs = [ pytestCheckHook networkx numpy ];
39
40 preCheck = ''
41 export TESTDIR=$(mktemp -d)
42 cp -r tests/ $TESTDIR
43 pushd $TESTDIR
44 '';
45 postCheck = "popd";
46
47 meta = with lib; {
48 description = "A python graph library implemented in Rust.";
49 homepage = "https://retworkx.readthedocs.io/en/latest/index.html";
50 downloadPage = "https://github.com/Qiskit/retworkx/releases";
51 changelog = "https://github.com/Qiskit/retworkx/releases/tag/${version}";
52 license = licenses.asl20;
53 maintainers = with maintainers; [ drewrisinger ];
54 };
55}