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