1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-02-17 08:28:20 +00:00

python3Packages.cirq: 0.9.1 -> 0.10.0

This commit is contained in:
Drew Risinger 2021-04-02 15:14:36 -04:00
parent d69c3d1e48
commit 6864b3192e

View file

@ -3,7 +3,6 @@
, buildPythonPackage , buildPythonPackage
, pythonOlder , pythonOlder
, fetchFromGitHub , fetchFromGitHub
, freezegun
, google-api-core , google-api-core
, matplotlib , matplotlib
, networkx , networkx
@ -14,8 +13,10 @@
, scipy , scipy
, sortedcontainers , sortedcontainers
, sympy , sympy
, tqdm
, typing-extensions , typing-extensions
# test inputs # test inputs
, freezegun
, pytestCheckHook , pytestCheckHook
, pytest-asyncio , pytest-asyncio
, pytest-benchmark , pytest-benchmark
@ -27,7 +28,7 @@
buildPythonPackage rec { buildPythonPackage rec {
pname = "cirq"; pname = "cirq";
version = "0.9.1"; version = "0.10.0";
disabled = pythonOlder "3.6"; disabled = pythonOlder "3.6";
@ -35,42 +36,36 @@ buildPythonPackage rec {
owner = "quantumlib"; owner = "quantumlib";
repo = "cirq"; repo = "cirq";
rev = "v${version}"; rev = "v${version}";
sha256 = "0mygvpq7kzga8l1w2jvwv9a2n3akpss45hrx250gdrnqjp6xrw64"; sha256 = "0xinml44n2lfl0q2lb2apmn69gsszlwim83082f66vyk0gpwd4lr";
}; };
postPatch = '' postPatch = ''
substituteInPlace requirements.txt \ substituteInPlace requirements.txt \
--replace "freezegun~=0.3.15" "freezegun" \
--replace "matplotlib~=3.0" "matplotlib" \ --replace "matplotlib~=3.0" "matplotlib" \
--replace "networkx~=2.4" "networkx" \ --replace "networkx~=2.4" "networkx" \
--replace "numpy~=1.16" "numpy" \ --replace "numpy~=1.16" "numpy" \
--replace "protobuf~=3.12.0" "protobuf" --replace "protobuf~=3.13.0" "protobuf"
# Fix serialize_sympy_constants test by allowing small errors in pi
substituteInPlace cirq/google/arg_func_langs_test.py \
--replace "'float_value': float(str(np.float32(sympy.pi)))" "'float_value': pytest.approx(float(str(np.float32(sympy.pi))))"
''; '';
propagatedBuildInputs = [ propagatedBuildInputs = [
freezegun
google-api-core google-api-core
numpy
matplotlib matplotlib
networkx networkx
numpy
pandas pandas
protobuf protobuf
requests requests
scipy scipy
sortedcontainers sortedcontainers
sympy sympy
tqdm
typing-extensions typing-extensions
]; ];
doCheck = true;
# pythonImportsCheck = [ "cirq" "cirq.Circuit" ]; # cirq's importlib hook doesn't work here # pythonImportsCheck = [ "cirq" "cirq.Circuit" ]; # cirq's importlib hook doesn't work here
dontUseSetuptoolsCheck = true;
checkInputs = [ checkInputs = [
pytestCheckHook pytestCheckHook
freezegun
pytest-asyncio pytest-asyncio
pytest-benchmark pytest-benchmark
ply ply
@ -84,9 +79,7 @@ buildPythonPackage rec {
"--ignore=cirq/contrib/" # requires external (unpackaged) python packages, so untested. "--ignore=cirq/contrib/" # requires external (unpackaged) python packages, so untested.
"--benchmark-disable" # Don't need to run benchmarks when packaging. "--benchmark-disable" # Don't need to run benchmarks when packaging.
]; ];
disabledTests = [ disabledTests = lib.optionals stdenv.isAarch64 [
"test_convert_to_ion_gates" # fails on some systems due to rounding error, 0.75 != 0.750...2
] ++ lib.optionals stdenv.isAarch64 [
# Seem to fail due to math issues on aarch64? # Seem to fail due to math issues on aarch64?
"expectation_from_wavefunction" "expectation_from_wavefunction"
"test_single_qubit_op_to_framed_phase_form_output_on_example_case" "test_single_qubit_op_to_framed_phase_form_output_on_example_case"