Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 20.03 88 lines 2.6 kB view raw
1{ lib 2, buildPythonPackage 3, pythonOlder 4, fetchFromGitHub 5, google_api_python_client 6, matplotlib 7, networkx 8, numpy 9, pandas 10, pythonProtobuf # pythonPackages.protobuf 11, requests 12, scipy 13, sortedcontainers 14, sympy 15, typing-extensions 16 # test inputs 17, pytestCheckHook 18, pytest-benchmark 19, ply 20, pydot 21, pyyaml 22, pygraphviz 23, isPy38 24}: 25 26buildPythonPackage rec { 27 pname = "cirq"; 28 version = "0.6.1"; 29 30 disabled = pythonOlder "3.5"; 31 32 src = fetchFromGitHub { 33 owner = "quantumlib"; 34 repo = "cirq"; 35 rev = "v${version}"; 36 sha256 = "0lhr2dka7vpz9xd6akxphrcv2b3ni2cgjywpc1r7qpqa5mrq1q7f"; 37 }; 38 39 # Cirq 0.6 requires networkx==2.3 only for optional qiskit dependency/test, disable this to avoid networkx version conflicts. https://github.com/quantumlib/Cirq/issues/2368 40 # Cirq locks protobuf==3.8.0, but tested working with default pythonPackages.protobuf (3.7). This avoids overrides/pythonPackages.protobuf conflicts 41 prePatch = '' 42 substituteInPlace requirements.txt --replace "networkx==2.3" "networkx" \ 43 --replace "protobuf==3.8.0" "protobuf" 44 45 # Fix sympy 1.5 test failures. Should be fixed in v0.7 46 substituteInPlace cirq/optimizers/eject_phased_paulis_test.py --replace "phase_exponent=0.125 + x / 8" "phase_exponent=0.125 + x * 0.125" 47 substituteInPlace cirq/contrib/quirk/cells/parse_test.py --replace "parse_formula('5t') == 5 * t" "parse_formula('5t') == 5.0 * t" 48 ''; 49 50 propagatedBuildInputs = [ 51 google_api_python_client 52 numpy 53 matplotlib 54 networkx 55 pandas 56 pythonProtobuf 57 requests 58 scipy 59 sortedcontainers 60 sympy 61 typing-extensions 62 ]; 63 64 doCheck = true; 65 # pythonImportsCheck = [ "cirq" "cirq.Ciruit" ]; # cirq's importlib hook doesn't work here 66 dontUseSetuptoolsCheck = true; 67 checkInputs = [ 68 pytestCheckHook 69 pytest-benchmark 70 ply 71 pydot 72 pyyaml 73 pygraphviz 74 ]; 75 # TODO: enable op_serializer_test. Error is type checking, for some reason wants bool instead of numpy.bool_. Not sure if protobuf or internal issue 76 pytestFlagsArray = [ 77 "--ignore=dev_tools" # Only needed when developing new code, which is out-of-scope 78 "--ignore=cirq/google/op_serializer_test.py" # investigating in https://github.com/quantumlib/Cirq/issues/2727 79 ]; 80 81 meta = with lib; { 82 description = "A framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits."; 83 homepage = "http://github.com/quantumlib/cirq"; 84 license = licenses.asl20; 85 maintainers = with maintainers; [ drewrisinger ]; 86 broken = isPy38; 87 }; 88}