1{
2 fetchFromGitHub,
3 buildPythonPackage,
4 cargo,
5 rustPlatform,
6 rustc,
7 setuptools,
8 setuptools-rust,
9 numpy,
10 fixtures,
11 networkx,
12 testtools,
13 libiconv,
14 stdenv,
15 lib,
16 pytestCheckHook,
17}:
18
19buildPythonPackage rec {
20 pname = "rustworkx";
21 version = "0.16.0";
22 pyproject = true;
23
24 src = fetchFromGitHub {
25 owner = "Qiskit";
26 repo = "rustworkx";
27 rev = version;
28 hash = "sha256-hzB99ReL1bTmj1mYne9rJp2rBeMnmIR17VQFVl7rzr0=";
29 };
30
31 cargoDeps = rustPlatform.fetchCargoVendor {
32 inherit src;
33 hash = "sha256-9NMTGq8KzIvnOXrsUpFHrtM9K/E7RMrE/Aa9mtO7pTI=";
34 };
35
36 nativeBuildInputs = [
37 rustPlatform.cargoSetupHook
38 cargo
39 rustc
40 ];
41
42 build-system = [
43 setuptools
44 setuptools-rust
45 ];
46
47 buildInputs = [ numpy ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ libiconv ];
48
49 nativeCheckInputs = [
50 fixtures
51 networkx
52 pytestCheckHook
53 testtools
54 ];
55
56 preCheck = ''
57 rm -r rustworkx
58 '';
59
60 pythonImportsCheck = [ "rustworkx" ];
61
62 meta = with lib; {
63 description = "High performance Python graph library implemented in Rust";
64 homepage = "https://github.com/Qiskit/rustworkx";
65 license = licenses.asl20;
66 maintainers = with maintainers; [ raitobezarius ];
67 };
68}