104 lines
2.1 KiB
Nix
104 lines
2.1 KiB
Nix
{ lib
|
|
, stdenv
|
|
, buildPythonPackage
|
|
, pythonOlder
|
|
, fetchFromGitHub
|
|
, fetchpatch
|
|
, duet
|
|
, 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 = "1.0.0";
|
|
format = "setuptools";
|
|
|
|
disabled = pythonOlder "3.7";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = "quantumlib";
|
|
repo = "cirq";
|
|
rev = "v${version}";
|
|
hash = "sha256-KJ+z4zGrdGIXcGZzqHtWMf8aAzcn9CtltFawcHVldMQ=";
|
|
};
|
|
|
|
sourceRoot = "source/${pname}";
|
|
|
|
postPatch = ''
|
|
substituteInPlace requirements.txt \
|
|
--replace "matplotlib~=3.0" "matplotlib" \
|
|
--replace "networkx~=2.4" "networkx" \
|
|
--replace "numpy~=1.16" "numpy"
|
|
'';
|
|
|
|
propagatedBuildInputs = [
|
|
duet
|
|
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
|
|
];
|
|
|
|
disabledTestPaths = lib.optionals (!withContribRequires) [
|
|
# Requires external (unpackaged) libraries, so untested
|
|
"cirq/contrib/"
|
|
# No need to test the version number
|
|
"cirq/_version_test.py"
|
|
];
|
|
|
|
disabledTests = [
|
|
# Tries to import flynt, which isn't in Nixpkgs
|
|
"test_metadata_search_path"
|
|
# Fails due pandas MultiIndex. Maybe issue with pandas version in nix?
|
|
"test_benchmark_2q_xeb_fidelities"
|
|
];
|
|
|
|
meta = with lib; {
|
|
description = "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 fab ];
|
|
broken = (stdenv.isLinux && stdenv.isAarch64);
|
|
};
|
|
}
|