From 3b56b0d384b5c7a07118326d1c8821c1454a5b7b Mon Sep 17 00:00:00 2001 From: Drew Risinger Date: Wed, 19 May 2021 18:42:58 -0400 Subject: [PATCH] python3Packages.cirq-core: init at 0.11.0 --- .../python-modules/cirq-core/default.nix | 98 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 100 insertions(+) create mode 100644 pkgs/development/python-modules/cirq-core/default.nix diff --git a/pkgs/development/python-modules/cirq-core/default.nix b/pkgs/development/python-modules/cirq-core/default.nix new file mode 100644 index 00000000000..54e2fa1954d --- /dev/null +++ b/pkgs/development/python-modules/cirq-core/default.nix @@ -0,0 +1,98 @@ +{ stdenv +, lib +, buildPythonPackage +, pythonOlder +, fetchFromGitHub +, matplotlib +, networkx +, numpy +, pandas +, requests +, scipy +, sortedcontainers +, sympy +, tqdm +, typing-extensions + # Contrib requirements +, withContribRequires ? false +, autoray ? null +, opt-einsum +, ply +, pylatex ? null +, pyquil ? null +, quimb ? null + # test inputs +, pytestCheckHook +, freezegun +, pytest-asyncio +}: +buildPythonPackage rec { + pname = "cirq-core"; + version = "0.11.0"; + + disabled = pythonOlder "3.6"; + + src = fetchFromGitHub { + owner = "quantumlib"; + repo = "cirq"; + rev = "v${version}"; + hash = "sha256-JaKTGnkYhzIFb35SGaho8DRupoT0JFYKA5+rJEq4oXw="; + }; + + sourceRoot = "source/${pname}"; + + postPatch = '' + substituteInPlace requirements.txt \ + --replace "matplotlib~=3.0" "matplotlib" \ + --replace "networkx~=2.4" "networkx" \ + --replace "numpy~=1.16" "numpy" \ + --replace "requests~=2.18" "requests" + ''; + + propagatedBuildInputs = [ + matplotlib + networkx + numpy + pandas + requests + scipy + sortedcontainers + sympy + tqdm + typing-extensions + ] ++ lib.optionals withContribRequires [ + autoray + opt-einsum + ply + pylatex + pyquil + quimb + ]; + + checkInputs = [ + pytestCheckHook + pytest-asyncio + freezegun + ]; + + pytestFlagsArray = lib.optionals (!withContribRequires) [ + # requires external (unpackaged) libraries, so untested. + "--ignore=cirq/contrib/" + ]; + disabledTests = [ + "test_metadata_search_path" # tries to import flynt, which isn't in Nixpkgs + "test_benchmark_2q_xeb_fidelities" # fails due pandas MultiIndex. Maybe issue with pandas version in nix? + ] ++ lib.optionals stdenv.hostPlatform.isAarch64 [ + # Seem to fail due to math issues on aarch64? + "expectation_from_wavefunction" + "test_single_qubit_op_to_framed_phase_form_output_on_example_case" + ]; + + meta = with lib; { + description = "A framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits."; + homepage = "https://github.com/quantumlib/cirq"; + changelog = "https://github.com/quantumlib/Cirq/releases/tag/v${version}"; + license = licenses.asl20; + maintainers = with maintainers; [ drewrisinger ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 6db0f528b1f..368897ae765 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1361,6 +1361,8 @@ in { cirq = callPackage ../development/python-modules/cirq { }; + cirq-core = callPackage ../development/python-modules/cirq-core { }; + ciscomobilityexpress = callPackage ../development/python-modules/ciscomobilityexpress { }; ciso8601 = callPackage ../development/python-modules/ciso8601 { };