at master 2.4 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 6 # build-system 7 pybind11, 8 setuptools, 9 10 # dependencies 11 numpy, 12 13 # tests 14 cirq-core, 15 matplotlib, 16 networkx, 17 pandas, 18 pytest-xdist, 19 pytestCheckHook, 20 scipy, 21}: 22 23buildPythonPackage rec { 24 pname = "stim"; 25 version = "1.15.0"; 26 pyproject = true; 27 28 src = fetchFromGitHub { 29 owner = "quantumlib"; 30 repo = "Stim"; 31 tag = "v${version}"; 32 hash = "sha256-Wls7dJkuV/RXnMizwrYOJOKopWEf1r21FKoKHjmpEQ0="; 33 }; 34 35 postPatch = '' 36 # asked to relax this in https://github.com/quantumlib/Stim/issues/623 37 substituteInPlace pyproject.toml \ 38 --replace-quiet "pybind11~=" "pybind11>=" 39 40 # Simple workgroud about https://github.com/networkx/networkx/pull/4829 41 # https://github.com/quantumlib/Stim/commit/c0dd0b1c8125b2096cd54b6f72884a459e47fe3e 42 substituteInPlace glue/lattice_surgery/stimzx/_zx_graph_solver.py \ 43 --replace-fail "networkx.testing.assert_graphs_equal" "assert networkx.utils.edges_equal" 44 45 substituteInPlace glue/lattice_surgery/stimzx/_text_diagram_parsing.py \ 46 --replace-fail "nx.testing.assert_graphs_equal" "assert nx.utils.edges_equal" 47 48 substituteInPlace glue/lattice_surgery/stimzx/_text_diagram_parsing_test.py \ 49 --replace-fail "nx.testing.assert_graphs_equal" "assert nx.utils.edges_equal" 50 ''; 51 52 build-system = [ 53 pybind11 54 setuptools 55 ]; 56 57 dependencies = [ numpy ]; 58 59 nativeCheckInputs = [ 60 cirq-core 61 matplotlib 62 networkx 63 pandas 64 pytest-xdist 65 pytestCheckHook 66 scipy 67 ]; 68 69 pythonImportsCheck = [ "stim" ]; 70 71 enableParallelBuilding = true; 72 73 enabledTestPaths = [ 74 # From .github/workflows 75 "src/" 76 "glue/cirq" 77 ]; 78 79 disabledTests = [ 80 # AssertionError: Sample rate 1.0 is over 5 standard deviations away from 1.0. 81 "test_frame_simulator_sampling_noisy_gates_agrees_with_cirq_data" 82 "test_tableau_simulator_sampling_noisy_gates_agrees_with_cirq_data" 83 ]; 84 85 meta = { 86 description = "Tool for high performance simulation and analysis of quantum stabilizer circuits, especially quantum error correction (QEC) circuits"; 87 mainProgram = "stim"; 88 homepage = "https://github.com/quantumlib/stim"; 89 changelog = "https://github.com/quantumlib/Stim/releases/tag/${src.tag}"; 90 license = lib.licenses.asl20; 91 maintainers = with lib.maintainers; [ chrispattison ]; 92 }; 93}