1{ lib 2, stdenv 3, buildPythonPackage 4, pythonOlder 5, fetchFromGitHub 6, fetchpatch 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.0.0"; 35 format = "setuptools"; 36 37 disabled = pythonOlder "3.7"; 38 39 src = fetchFromGitHub { 40 owner = "quantumlib"; 41 repo = "cirq"; 42 rev = "v${version}"; 43 hash = "sha256-KJ+z4zGrdGIXcGZzqHtWMf8aAzcn9CtltFawcHVldMQ="; 44 }; 45 46 sourceRoot = "source/${pname}"; 47 48 postPatch = '' 49 substituteInPlace requirements.txt \ 50 --replace "matplotlib~=3.0" "matplotlib" \ 51 --replace "networkx~=2.4" "networkx" \ 52 --replace "numpy~=1.16" "numpy" 53 ''; 54 55 propagatedBuildInputs = [ 56 duet 57 matplotlib 58 networkx 59 numpy 60 pandas 61 requests 62 scipy 63 sortedcontainers 64 sympy 65 tqdm 66 typing-extensions 67 ] ++ lib.optionals withContribRequires [ 68 autoray 69 opt-einsum 70 ply 71 pylatex 72 pyquil 73 quimb 74 ]; 75 76 checkInputs = [ 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 = [ 90 # Tries to import flynt, which isn't in Nixpkgs 91 "test_metadata_search_path" 92 # Fails due pandas MultiIndex. Maybe issue with pandas version in nix? 93 "test_benchmark_2q_xeb_fidelities" 94 ]; 95 96 meta = with lib; { 97 description = "Framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits"; 98 homepage = "https://github.com/quantumlib/cirq"; 99 changelog = "https://github.com/quantumlib/Cirq/releases/tag/v${version}"; 100 license = licenses.asl20; 101 maintainers = with maintainers; [ drewrisinger fab ]; 102 broken = (stdenv.isLinux && stdenv.isAarch64); 103 }; 104}