From fb112ee97f04f26ac73ae2413a31b3b5a023bf6a Mon Sep 17 00:00:00 2001 From: Drew Risinger Date: Wed, 29 Jan 2020 12:40:44 -0500 Subject: [PATCH 1/2] add maintainer: drewrisinger University of Maryland PhD Student. Quantum Computing. --- maintainers/maintainer-list.nix | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/maintainers/maintainer-list.nix b/maintainers/maintainer-list.nix index 0da9e6df1715..36ba653c8788 100644 --- a/maintainers/maintainer-list.nix +++ b/maintainers/maintainer-list.nix @@ -1905,6 +1905,12 @@ email = "burkett.andrew@gmail.com"; name = "Andrew Burkett"; }; + drewrisinger = { + email = "drisinger+nixpkgs@gmail.com"; + github = "drewrisinger"; + gitHubId = 10198051; + name = "Drew Risinger"; + }; dsferruzza = { email = "david.sferruzza@gmail.com"; github = "dsferruzza"; From 74a0d4dc3cc21f4657489a722227342136effcbd Mon Sep 17 00:00:00 2001 From: Drew Risinger Date: Thu, 16 Jan 2020 21:28:43 -0500 Subject: [PATCH 2/2] python3Packages.cirq: init at 0.6.1 Add Google's Cirq package. Uses: Quantum information science. --- .../python-modules/cirq/default.nix | 86 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 4 + 2 files changed, 90 insertions(+) create mode 100644 pkgs/development/python-modules/cirq/default.nix diff --git a/pkgs/development/python-modules/cirq/default.nix b/pkgs/development/python-modules/cirq/default.nix new file mode 100644 index 000000000000..d6109e8aabac --- /dev/null +++ b/pkgs/development/python-modules/cirq/default.nix @@ -0,0 +1,86 @@ +{ lib +, buildPythonPackage +, pythonOlder +, fetchFromGitHub +, google_api_python_client +, matplotlib +, networkx +, numpy +, pandas +, pythonProtobuf # pythonPackages.protobuf +, requests +, scipy +, sortedcontainers +, sympy +, typing-extensions + # test inputs +, pytestCheckHook +, pytest-benchmark +, ply +, pydot +, pyyaml +, pygraphviz +}: + +buildPythonPackage rec { + pname = "cirq"; + version = "0.6.1"; + + disabled = pythonOlder "3.5"; + + src = fetchFromGitHub { + owner = "quantumlib"; + repo = "cirq"; + rev = "v${version}"; + sha256 = "0lhr2dka7vpz9xd6akxphrcv2b3ni2cgjywpc1r7qpqa5mrq1q7f"; + }; + + # 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 + # Cirq locks protobuf==3.8.0, but tested working with default pythonPackages.protobuf (3.7). This avoids overrides/pythonPackages.protobuf conflicts + prePatch = '' + substituteInPlace requirements.txt --replace "networkx==2.3" "networkx" \ + --replace "protobuf==3.8.0" "protobuf" + + # Fix sympy 1.5 test failures. Should be fixed in v0.7 + substituteInPlace cirq/optimizers/eject_phased_paulis_test.py --replace "phase_exponent=0.125 + x / 8" "phase_exponent=0.125 + x * 0.125" + substituteInPlace cirq/contrib/quirk/cells/parse_test.py --replace "parse_formula('5t') == 5 * t" "parse_formula('5t') == 5.0 * t" + ''; + + propagatedBuildInputs = [ + google_api_python_client + numpy + matplotlib + networkx + pandas + pythonProtobuf + requests + scipy + sortedcontainers + sympy + typing-extensions + ]; + + doCheck = true; + # pythonImportsCheck = [ "cirq" "cirq.Ciruit" ]; # cirq's importlib hook doesn't work here + dontUseSetuptoolsCheck = true; + checkInputs = [ + pytestCheckHook + pytest-benchmark + ply + pydot + pyyaml + pygraphviz + ]; + # 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 + pytestFlagsArray = [ + "--ignore=dev_tools" # Only needed when developing new code, which is out-of-scope + "--ignore=cirq/google/op_serializer_test.py" # investigating in https://github.com/quantumlib/Cirq/issues/2727 + ]; + + meta = with lib; { + description = "A framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits."; + homepage = "http://github.com/quantumlib/cirq"; + license = licenses.asl20; + maintainers = with maintainers; [ drewrisinger ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 3a93212d0c1f..81f8c7e48a08 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1824,6 +1824,10 @@ in { cmarkgfm = callPackage ../development/python-modules/cmarkgfm { }; + cirq = callPackage ../development/python-modules/cirq { + pythonProtobuf = self.protobuf; + }; + colorcet = callPackage ../development/python-modules/colorcet { }; coloredlogs = callPackage ../development/python-modules/coloredlogs { };