1{ 2 lib, 3 stdenv, 4 buildPythonPackage, 5 pythonOlder, 6 fetchFromGitHub, 7 duet, 8 matplotlib, 9 networkx, 10 numpy, 11 pandas, 12 requests, 13 scipy, 14 sortedcontainers, 15 sympy, 16 tqdm, 17 typing-extensions, 18 # Contrib requirements 19 withContribRequires ? false, 20 autoray ? null, 21 opt-einsum, 22 ply, 23 pylatex ? null, 24 pyquil ? null, 25 quimb ? null, 26 # test inputs 27 pytestCheckHook, 28 freezegun, 29 pytest-asyncio, 30}: 31 32buildPythonPackage rec { 33 pname = "cirq-core"; 34 version = "1.3.0"; 35 format = "setuptools"; 36 37 disabled = pythonOlder "3.9"; 38 39 src = fetchFromGitHub { 40 owner = "quantumlib"; 41 repo = "cirq"; 42 rev = "refs/tags/v${version}"; 43 hash = "sha256-JAJJciFg3BuRha1wTKixtKWcYy3NA2mNpniPyPHTTe8="; 44 }; 45 46 sourceRoot = "${src.name}/${pname}"; 47 48 postPatch = '' 49 substituteInPlace requirements.txt \ 50 --replace "matplotlib~=3.0" "matplotlib" 51 ''; 52 53 propagatedBuildInputs = 54 [ 55 duet 56 matplotlib 57 networkx 58 numpy 59 pandas 60 requests 61 scipy 62 sortedcontainers 63 sympy 64 tqdm 65 typing-extensions 66 ] 67 ++ lib.optionals withContribRequires [ 68 autoray 69 opt-einsum 70 ply 71 pylatex 72 pyquil 73 quimb 74 ]; 75 76 nativeCheckInputs = [ 77 pytestCheckHook 78 pytest-asyncio 79 freezegun 80 ]; 81 82 disabledTestPaths = lib.optionals (!withContribRequires) [ 83 # Requires external (unpackaged) libraries, so untested 84 "cirq/contrib/" 85 # No need to test the version number 86 "cirq/_version_test.py" 87 ]; 88 89 disabledTests = lib.optionals stdenv.isAarch64 [ 90 # https://github.com/quantumlib/Cirq/issues/5924 91 "test_prepare_two_qubit_state_using_sqrt_iswap" 92 ]; 93 94 meta = with lib; { 95 description = "Framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits"; 96 homepage = "https://github.com/quantumlib/cirq"; 97 changelog = "https://github.com/quantumlib/Cirq/releases/tag/v${version}"; 98 license = licenses.asl20; 99 maintainers = with maintainers; [ 100 drewrisinger 101 fab 102 ]; 103 }; 104}