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