1{ fetchFromGitHub
2, buildPythonPackage
3, cargo
4, rustPlatform
5, rustc
6, setuptools-rust
7, numpy
8, fixtures
9, networkx
10, libiconv
11, stdenv
12, lib
13}:
14
15buildPythonPackage rec {
16 pname = "rustworkx";
17 version = "0.12.1";
18
19 src = fetchFromGitHub {
20 owner = "Qiskit";
21 repo = pname;
22 rev = version;
23 hash = "sha256-d/KCxhJdyzhTjwJZ+GsXJE4ww30iPaXcPngpCi4hBZw=";
24 };
25
26 cargoDeps = rustPlatform.fetchCargoTarball {
27 inherit src;
28 hash = "sha256-imhiPj763iumRQb+oeBOpICD1nCvzZx+3yQWu1QRRQQ=";
29 };
30
31 nativeBuildInputs = [
32 setuptools-rust
33 rustPlatform.cargoSetupHook
34 cargo
35 rustc
36 ];
37
38 buildInputs = [ numpy ] ++ lib.optionals stdenv.isDarwin [ libiconv ];
39
40 checkInputs = [ fixtures networkx ];
41
42 pythonImportsCheck = [ "rustworkx" ];
43
44 meta = with lib; {
45 description = "A high performance Python graph library implemented in Rust.";
46 homepage = "https://github.com/Qiskit/rustworkx";
47 license = licenses.asl20;
48 maintainers = with maintainers; [ raitobezarius ];
49 };
50}