1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 fetchFromGitHub,
6 pytestCheckHook,
7 setuptools,
8 ipywidgets,
9 lark,
10 numpy,
11 pyperclip,
12 tqdm,
13 typing-extensions,
14}:
15
16buildPythonPackage rec {
17 pname = "pyzx";
18 version = "0.9.0";
19 pyproject = true;
20
21 disabled = pythonOlder "3.8";
22
23 src = fetchFromGitHub {
24 owner = "zxcalc";
25 repo = "pyzx";
26 tag = "v${version}";
27 hash = "sha256-MhsbJIDeSIeF0LaHhI6nNxPD3ZjBWh5yvLGuwBH41a4=";
28 };
29
30 build-system = [ setuptools ];
31
32 dependencies = [
33 ipywidgets
34 lark
35 numpy
36 pyperclip
37 tqdm
38 typing-extensions
39 ];
40
41 pythonRelaxDeps = [
42 "ipywidgets"
43 "lark"
44 ];
45
46 nativeCheckInputs = [ pytestCheckHook ];
47 disabledTestPaths = [
48 # too expensive, and print results instead of reporting failures:
49 "tests/long_scalar_test.py"
50 "tests/long_test.py"
51 ];
52
53 pythonImportsCheck = [
54 "pyzx"
55 "pyzx.circuit"
56 "pyzx.graph"
57 "pyzx.routing"
58 "pyzx.local_search"
59 "pyzx.scripts"
60 ];
61
62 meta = {
63 description = "Library for quantum circuit rewriting and optimisation using the ZX-calculus";
64 homepage = "https://github.com/zxcalc/pyzx";
65 changelog = "https://github.com/zxcalc/pyzx/blob/${src.tag}/CHANGELOG.md";
66 license = lib.licenses.asl20;
67 maintainers = with lib.maintainers; [ bcdarwin ];
68 };
69}