Files
nixpkgs/pkgs/development/python-modules/cirq-core/default.nix
T
Artturin e0464e4788 treewide: replace stdenv.is with stdenv.hostPlatform.is
In preparation for the deprecation of `stdenv.isX`.

These shorthands are not conducive to cross-compilation because they
hide the platforms.

Darwin might get cross-compilation for which the continued usage of `stdenv.isDarwin` will get in the way

One example of why this is bad and especially affects compiler packages
https://www.github.com/NixOS/nixpkgs/pull/343059

There are too many files to go through manually but a treewide should
get users thinking when they see a `hostPlatform.isX` in a place where it
doesn't make sense.

```
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv.is" "stdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenv'.is" "stdenv'.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "clangStdenv.is" "clangStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "gccStdenv.is" "gccStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "stdenvNoCC.is" "stdenvNoCC.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "inherit (stdenv) is" "inherit (stdenv.hostPlatform) is"
fd --type f "\.nix" | xargs sd --fixed-strings "buildStdenv.is" "buildStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "effectiveStdenv.is" "effectiveStdenv.hostPlatform.is"
fd --type f "\.nix" | xargs sd --fixed-strings "originalStdenv.is" "originalStdenv.hostPlatform.is"
```
2024-09-25 00:04:37 +03:00

108 lines
2.0 KiB
Nix

{
lib,
stdenv,
attrs,
autoray ? null,
buildPythonPackage,
duet,
fetchFromGitHub,
freezegun,
matplotlib,
networkx,
numpy,
opt-einsum,
pandas,
ply,
pylatex ? null,
pyquil ? null,
pytest-asyncio,
pytestCheckHook,
pythonOlder,
quimb ? null,
requests,
scipy,
setuptools,
sortedcontainers,
sympy,
tqdm,
typing-extensions,
withContribRequires ? false,
}:
buildPythonPackage rec {
pname = "cirq-core";
version = "1.4.1";
pyproject = true;
disabled = pythonOlder "3.10";
src = fetchFromGitHub {
owner = "quantumlib";
repo = "cirq";
rev = "refs/tags/v${version}";
hash = "sha256-1GcRDVgYF+1igZQFlQbiWZmU1WNIJh4CcOftQe6OP6I=";
};
sourceRoot = "${src.name}/${pname}";
postPatch = ''
substituteInPlace requirements.txt \
--replace-fail "matplotlib~=3.0" "matplotlib"
'';
build-system = [ setuptools ];
dependencies =
[
attrs
duet
matplotlib
networkx
numpy
pandas
requests
scipy
sortedcontainers
sympy
tqdm
typing-extensions
]
++ lib.optionals withContribRequires [
autoray
opt-einsum
ply
pylatex
pyquil
quimb
];
nativeCheckInputs = [
pytestCheckHook
pytest-asyncio
freezegun
];
disabledTestPaths = lib.optionals (!withContribRequires) [
# Requires external (unpackaged) libraries, so untested
"cirq/contrib/"
# No need to test the version number
"cirq/_version_test.py"
];
disabledTests = lib.optionals stdenv.hostPlatform.isAarch64 [
# https://github.com/quantumlib/Cirq/issues/5924
"test_prepare_two_qubit_state_using_sqrt_iswap"
];
meta = with lib; {
description = "Framework for creating, editing, and invoking Noisy Intermediate Scale Quantum (NISQ) circuits";
homepage = "https://github.com/quantumlib/cirq";
changelog = "https://github.com/quantumlib/Cirq/releases/tag/v${version}";
license = licenses.asl20;
maintainers = with maintainers; [
drewrisinger
fab
];
};
}