1{ lib
2, pkgs
3, buildPythonPackage
4, pythonOlder
5, pytestCheckHook
6, pytest-xdist
7, fetchFromGitHub
8, numpy
9, pybind11
10, cirq-core
11, matplotlib
12, networkx
13, scipy
14, setuptools
15, wheel
16, pandas
17}:
18
19buildPythonPackage rec {
20 pname = "stim";
21 version = "1.9.0";
22 format = "pyproject";
23
24 disabled = pythonOlder "3.6";
25
26 src = pkgs.fetchFromGitHub {
27 owner = "quantumlib";
28 repo = "Stim";
29 rev = "refs/tags/v${version}";
30 hash = "sha256-zXWdJjFkf74FCWxyVMF8dx0P8GmUkuHFxUo5wYNU2o0=";
31 };
32
33 postPatch = ''
34 # asked to relax this in https://github.com/quantumlib/Stim/issues/623
35 substituteInPlace pyproject.toml \
36 --replace "pybind11==" "pybind11>="
37 '';
38
39 nativeBuildInputs = [
40 pybind11
41 setuptools
42 wheel
43 ];
44
45 propagatedBuildInputs = [
46 numpy
47 ];
48
49 nativeCheckInputs = [
50 pytestCheckHook
51 pytest-xdist
52
53 cirq-core
54 matplotlib
55 networkx
56 scipy
57 pandas
58 ];
59
60 meta = {
61 description = "A tool for high performance simulation and analysis of quantum stabilizer circuits, especially quantum error correction (QEC) circuits.";
62 license = lib.licenses.asl20;
63 maintainers = with lib.maintainers; [ chrispattison ];
64 homepage = "https://github.com/quantumlib/stim";
65 };
66
67 pythonImportsCheck = [ "stim" ];
68
69 enableParallelBuilding = true;
70
71 disabledTestPaths = [
72 # No pymatching
73 "glue/sample/src/sinter/main_test.py"
74 "glue/sample/src/sinter/decoding_test.py"
75 "glue/sample/src/sinter/predict_test.py"
76 "glue/sample/src/sinter/collection_test.py"
77 "glue/sample/src/sinter/collection_work_manager.py"
78 "glue/sample/src/sinter/worker_test.py"
79 ];
80}