2020-04-17 00:18:12 +01:00
|
|
|
{ stdenv
|
|
|
|
, lib
|
2020-01-17 02:28:43 +00:00
|
|
|
, buildPythonPackage
|
|
|
|
, pythonOlder
|
|
|
|
, fetchFromGitHub
|
2021-01-06 09:46:48 +00:00
|
|
|
, google-api-core
|
2020-01-17 02:28:43 +00:00
|
|
|
, matplotlib
|
|
|
|
, networkx
|
|
|
|
, numpy
|
|
|
|
, pandas
|
2020-06-21 23:22:19 +01:00
|
|
|
, protobuf
|
2020-01-17 02:28:43 +00:00
|
|
|
, requests
|
|
|
|
, scipy
|
|
|
|
, sortedcontainers
|
|
|
|
, sympy
|
2021-04-02 20:14:36 +01:00
|
|
|
, tqdm
|
2020-01-17 02:28:43 +00:00
|
|
|
, typing-extensions
|
|
|
|
# test inputs
|
2021-04-02 20:14:36 +01:00
|
|
|
, freezegun
|
2020-01-17 02:28:43 +00:00
|
|
|
, pytestCheckHook
|
2020-05-12 00:00:17 +01:00
|
|
|
, pytest-asyncio
|
2020-01-17 02:28:43 +00:00
|
|
|
, pytest-benchmark
|
|
|
|
, ply
|
|
|
|
, pydot
|
|
|
|
, pyyaml
|
|
|
|
, pygraphviz
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "cirq";
|
2021-04-02 20:14:36 +01:00
|
|
|
version = "0.10.0";
|
2020-01-17 02:28:43 +00:00
|
|
|
|
2020-06-21 23:22:19 +01:00
|
|
|
disabled = pythonOlder "3.6";
|
2020-01-17 02:28:43 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "quantumlib";
|
|
|
|
repo = "cirq";
|
|
|
|
rev = "v${version}";
|
2021-04-02 20:14:36 +01:00
|
|
|
sha256 = "0xinml44n2lfl0q2lb2apmn69gsszlwim83082f66vyk0gpwd4lr";
|
2020-01-17 02:28:43 +00:00
|
|
|
};
|
|
|
|
|
2020-09-01 02:56:40 +01:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace requirements.txt \
|
|
|
|
--replace "matplotlib~=3.0" "matplotlib" \
|
|
|
|
--replace "networkx~=2.4" "networkx" \
|
2020-10-08 04:53:48 +01:00
|
|
|
--replace "numpy~=1.16" "numpy" \
|
2021-04-02 20:14:36 +01:00
|
|
|
--replace "protobuf~=3.13.0" "protobuf"
|
2020-09-01 02:56:40 +01:00
|
|
|
'';
|
|
|
|
|
2020-01-17 02:28:43 +00:00
|
|
|
propagatedBuildInputs = [
|
2021-01-06 09:46:48 +00:00
|
|
|
google-api-core
|
2020-01-17 02:28:43 +00:00
|
|
|
matplotlib
|
|
|
|
networkx
|
2021-04-02 20:14:36 +01:00
|
|
|
numpy
|
2020-01-17 02:28:43 +00:00
|
|
|
pandas
|
2020-06-21 23:22:19 +01:00
|
|
|
protobuf
|
2020-01-17 02:28:43 +00:00
|
|
|
requests
|
|
|
|
scipy
|
|
|
|
sortedcontainers
|
|
|
|
sympy
|
2021-04-02 20:14:36 +01:00
|
|
|
tqdm
|
2020-01-17 02:28:43 +00:00
|
|
|
typing-extensions
|
|
|
|
];
|
|
|
|
|
2020-09-01 02:56:40 +01:00
|
|
|
# pythonImportsCheck = [ "cirq" "cirq.Circuit" ]; # cirq's importlib hook doesn't work here
|
2020-01-17 02:28:43 +00:00
|
|
|
checkInputs = [
|
|
|
|
pytestCheckHook
|
2021-04-02 20:14:36 +01:00
|
|
|
freezegun
|
2020-05-12 00:00:17 +01:00
|
|
|
pytest-asyncio
|
2020-01-17 02:28:43 +00:00
|
|
|
pytest-benchmark
|
|
|
|
ply
|
|
|
|
pydot
|
|
|
|
pyyaml
|
|
|
|
pygraphviz
|
|
|
|
];
|
2020-05-12 00:00:17 +01:00
|
|
|
|
2020-01-17 02:28:43 +00:00
|
|
|
pytestFlagsArray = [
|
|
|
|
"--ignore=dev_tools" # Only needed when developing new code, which is out-of-scope
|
2020-10-08 04:53:48 +01:00
|
|
|
"--ignore=cirq/contrib/" # requires external (unpackaged) python packages, so untested.
|
2020-09-01 02:56:40 +01:00
|
|
|
"--benchmark-disable" # Don't need to run benchmarks when packaging.
|
2020-01-17 02:28:43 +00:00
|
|
|
];
|
2021-04-02 20:14:36 +01:00
|
|
|
disabledTests = lib.optionals stdenv.isAarch64 [
|
2020-04-17 00:18:12 +01:00
|
|
|
# Seem to fail due to math issues on aarch64?
|
|
|
|
"expectation_from_wavefunction"
|
|
|
|
"test_single_qubit_op_to_framed_phase_form_output_on_example_case"
|
2020-10-08 04:53:48 +01:00
|
|
|
] ++ [
|
|
|
|
# slow tests, for quicker building
|
|
|
|
"test_anneal_search_method_calls"
|
|
|
|
"test_density_matrix_from_state_tomography_is_correct"
|
|
|
|
"test_example_runs_qubit_characterizations"
|
|
|
|
"test_example_runs_hello_line_perf"
|
|
|
|
"test_example_runs_bc_mean_field_perf"
|
|
|
|
"test_main_loop"
|
|
|
|
"test_clifford_circuit_2"
|
|
|
|
"test_decompose_specific_matrices"
|
|
|
|
"test_two_qubit_randomized_benchmarking"
|
|
|
|
"test_kak_decomposition_perf"
|
|
|
|
"test_example_runs_simon"
|
|
|
|
"test_decompose_random_unitary"
|
|
|
|
"test_decompose_size_special_unitary"
|
|
|
|
"test_api_retry_5xx_errors"
|
|
|
|
"test_xeb_fidelity"
|
|
|
|
"test_example_runs_phase_estimator_perf"
|
|
|
|
"test_cross_entropy_benchmarking"
|
2020-04-17 00:18:12 +01:00
|
|
|
];
|
2020-01-17 02:28:43 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "A framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits.";
|
2020-03-20 12:36:23 +00:00
|
|
|
homepage = "https://github.com/quantumlib/cirq";
|
2020-09-01 02:56:40 +01:00
|
|
|
changelog = "https://github.com/quantumlib/Cirq/releases/tag/v${version}";
|
2020-01-17 02:28:43 +00:00
|
|
|
license = licenses.asl20;
|
|
|
|
maintainers = with maintainers; [ drewrisinger ];
|
|
|
|
};
|
|
|
|
}
|