nixpkgs/pkgs/development/python-modules/qiskit-ignis/default.nix
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

80 lines
1.8 KiB
Nix

{
lib,
stdenv,
pythonOlder,
buildPythonPackage,
fetchFromGitHub,
numpy,
qiskit-terra,
scikit-learn,
scipy,
# Optional package inputs
withVisualization ? false,
matplotlib,
withCvx ? false,
cvxpy,
withJit ? false,
numba,
# Check Inputs
pytestCheckHook,
ddt,
pyfakefs,
qiskit-aer,
}:
buildPythonPackage rec {
pname = "qiskit-ignis";
version = "0.7.1";
format = "setuptools";
disabled = pythonOlder "3.6";
# Pypi's tarball doesn't contain tests
src = fetchFromGitHub {
owner = "Qiskit";
repo = "qiskit-ignis";
rev = "refs/tags/${version}";
hash = "sha256-WyLNtZhtuGzqCJdOBvtBjZZiGFQihpeSjJQtP7lI248=";
};
propagatedBuildInputs =
[
numpy
qiskit-terra
scikit-learn
scipy
]
++ lib.optionals (withCvx) [ cvxpy ]
++ lib.optionals (withVisualization) [ matplotlib ]
++ lib.optionals (withJit) [ numba ];
# Tests
pythonImportsCheck = [ "qiskit.ignis" ];
dontUseSetuptoolsCheck = true;
preCheck = ''
export HOME=$TMPDIR
'';
nativeCheckInputs = [
pytestCheckHook
ddt
pyfakefs
qiskit-aer
];
disabledTests =
[
"test_tensored_meas_cal_on_circuit" # Flaky test, occasionally returns result outside bounds
]
++ lib.optionals stdenv.hostPlatform.isAarch64 [
"test_fitters" # Fails check that arrays are close. Might be due to aarch64 math issues.
];
meta = with lib; {
description = "Qiskit tools for quantum hardware verification, noise characterization, and error correction";
homepage = "https://qiskit.org/ignis";
downloadPage = "https://github.com/QISKit/qiskit-ignis/releases";
changelog = "https://qiskit.org/documentation/release_notes.html";
license = licenses.asl20;
maintainers = with maintainers; [ drewrisinger ];
};
}