Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 21.05 98 lines 2.2 kB view raw
1{ stdenv 2, lib 3, buildPythonPackage 4, pythonOlder 5, fetchFromGitHub 6, matplotlib 7, networkx 8, numpy 9, pandas 10, requests 11, scipy 12, sortedcontainers 13, sympy 14, tqdm 15, typing-extensions 16 # Contrib requirements 17, withContribRequires ? false 18, autoray ? null 19, opt-einsum 20, ply 21, pylatex ? null 22, pyquil ? null 23, quimb ? null 24 # test inputs 25, pytestCheckHook 26, freezegun 27, pytest-asyncio 28}: 29buildPythonPackage rec { 30 pname = "cirq-core"; 31 version = "0.11.0"; 32 33 disabled = pythonOlder "3.6"; 34 35 src = fetchFromGitHub { 36 owner = "quantumlib"; 37 repo = "cirq"; 38 rev = "v${version}"; 39 hash = "sha256-JaKTGnkYhzIFb35SGaho8DRupoT0JFYKA5+rJEq4oXw="; 40 }; 41 42 sourceRoot = "source/${pname}"; 43 44 postPatch = '' 45 substituteInPlace requirements.txt \ 46 --replace "matplotlib~=3.0" "matplotlib" \ 47 --replace "networkx~=2.4" "networkx" \ 48 --replace "numpy~=1.16" "numpy" \ 49 --replace "requests~=2.18" "requests" 50 ''; 51 52 propagatedBuildInputs = [ 53 matplotlib 54 networkx 55 numpy 56 pandas 57 requests 58 scipy 59 sortedcontainers 60 sympy 61 tqdm 62 typing-extensions 63 ] ++ lib.optionals withContribRequires [ 64 autoray 65 opt-einsum 66 ply 67 pylatex 68 pyquil 69 quimb 70 ]; 71 72 checkInputs = [ 73 pytestCheckHook 74 pytest-asyncio 75 freezegun 76 ]; 77 78 pytestFlagsArray = lib.optionals (!withContribRequires) [ 79 # requires external (unpackaged) libraries, so untested. 80 "--ignore=cirq/contrib/" 81 ]; 82 disabledTests = [ 83 "test_metadata_search_path" # tries to import flynt, which isn't in Nixpkgs 84 "test_benchmark_2q_xeb_fidelities" # fails due pandas MultiIndex. Maybe issue with pandas version in nix? 85 ] ++ lib.optionals stdenv.hostPlatform.isAarch64 [ 86 # Seem to fail due to math issues on aarch64? 87 "expectation_from_wavefunction" 88 "test_single_qubit_op_to_framed_phase_form_output_on_example_case" 89 ]; 90 91 meta = with lib; { 92 description = "A framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits."; 93 homepage = "https://github.com/quantumlib/cirq"; 94 changelog = "https://github.com/quantumlib/Cirq/releases/tag/v${version}"; 95 license = licenses.asl20; 96 maintainers = with maintainers; [ drewrisinger ]; 97 }; 98}