2020-01-17 02:28:43 +00:00
{ 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 = " c i r q " ;
version = " 0 . 6 . 1 " ;
disabled = pythonOlder " 3 . 5 " ;
src = fetchFromGitHub {
owner = " q u a n t u m l i b " ;
repo = " c i r q " ;
rev = " v ${ version } " ;
sha256 = " 0 l h r 2 d k a 7 v p z 9 x d 6 a k x p h r c v 2 b 3 n i 2 c g j y w p c 1 r 7 q p q a 5 m r q 1 q 7 f " ;
} ;
# 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 " n e t w o r k x = = 2 . 3 " " n e t w o r k x " \
- - replace " p r o t o b u f = = 3 . 8 . 0 " " p r o t o b u f "
# Fix sympy 1.5 test failures. Should be fixed in v0.7
substituteInPlace cirq/optimizers/eject_phased_paulis_test.py - - replace " p h a s e _ e x p o n e n t = 0 . 1 2 5 + x / 8 " " p h a s e _ e x p o n e n t = 0 . 1 2 5 + x * 0 . 1 2 5 "
substituteInPlace cirq/contrib/quirk/cells/parse_test.py - - replace " p a r s e _ f o r m u l a ( ' 5 t ' ) = = 5 * t " " p a r s e _ f o r m u l a ( ' 5 t ' ) = = 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 = [
" - - i g n o r e = d e v _ t o o l s " # Only needed when developing new code, which is out-of-scope
" - - i g n o r e = c i r q / g o o g l e / o p _ s e r i a l i z e r _ t e s t . p y " # investigating in https://github.com/quantumlib/Cirq/issues/2727
] ;
meta = with lib ; {
description = " A f r a m e w o r k f o r c r e a t i n g , e d i t i n g , a n d i n v o k i n g N o i s y I n t e r m e d i a t e S c a l e Q u a n t u m ( N I S Q ) c i r c u i t s . " ;
2020-03-20 12:36:23 +00:00
homepage = " h t t p s : / / g i t h u b . c o m / q u a n t u m l i b / c i r q " ;
2020-01-17 02:28:43 +00:00
license = licenses . asl20 ;
maintainers = with maintainers ; [ drewrisinger ] ;
} ;
}