528354e66c
Folds the cython_3 attribute into the primary cython attribute and migrates all packages from the versioned attribute. The old version will be provided through the cython_0 attribute in an effort to phase it out.
94 lines
2 KiB
Nix
94 lines
2 KiB
Nix
{ lib
|
|
, stdenv
|
|
, buildPythonPackage
|
|
, cvxopt
|
|
, cvxpy
|
|
, cython_0
|
|
, fetchFromGitHub
|
|
, ipython
|
|
, matplotlib
|
|
, numpy
|
|
, packaging
|
|
, pytest-rerunfailures
|
|
, pytestCheckHook
|
|
, python
|
|
, pythonOlder
|
|
, scipy
|
|
}:
|
|
|
|
buildPythonPackage rec {
|
|
pname = "qutip";
|
|
version = "4.7.5";
|
|
format = "setuptools";
|
|
|
|
disabled = pythonOlder "3.7";
|
|
|
|
src = fetchFromGitHub {
|
|
owner = pname;
|
|
repo = pname;
|
|
rev = "refs/tags/v${version}";
|
|
hash = "sha256-4nXZPZFu9L+Okha3qvPil1KvLGO1EbrzotQjqQ8r9l8=";
|
|
};
|
|
|
|
nativeBuildInputs = [
|
|
cython_0
|
|
];
|
|
|
|
propagatedBuildInputs = [
|
|
numpy
|
|
packaging
|
|
scipy
|
|
];
|
|
|
|
nativeCheckInputs = [
|
|
pytestCheckHook
|
|
pytest-rerunfailures
|
|
] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
|
|
|
|
# Disabling OpenMP support on Darwin.
|
|
setupPyGlobalFlags = lib.optionals (!stdenv.isDarwin) [
|
|
"--with-openmp"
|
|
];
|
|
|
|
# QuTiP tries to access the home directory to create an rc file for us.
|
|
# We need to go to another directory to run the tests from there.
|
|
# This is due to the Cython-compiled modules not being in the correct location
|
|
# of the source tree.
|
|
preCheck = ''
|
|
export HOME=$(mktemp -d);
|
|
export OMP_NUM_THREADS=$NIX_BUILD_CORES
|
|
mkdir -p test && cd test
|
|
'';
|
|
|
|
# For running tests, see https://qutip.org/docs/latest/installation.html#verifying-the-installation
|
|
checkPhase = ''
|
|
runHook preCheck
|
|
${python.interpreter} -c "import qutip.testing; qutip.testing.run()"
|
|
runHook postCheck
|
|
'';
|
|
|
|
pythonImportsCheck = [
|
|
"qutip"
|
|
];
|
|
|
|
passthru.optional-dependencies = {
|
|
graphics = [
|
|
matplotlib
|
|
];
|
|
ipython = [
|
|
ipython
|
|
];
|
|
semidefinite = [
|
|
cvxpy
|
|
cvxopt
|
|
];
|
|
};
|
|
|
|
meta = with lib; {
|
|
description = "Open-source software for simulating the dynamics of closed and open quantum systems";
|
|
homepage = "https://qutip.org/";
|
|
changelog = "https://github.com/qutip/qutip/releases/tag/v${version}";
|
|
license = licenses.bsd3;
|
|
maintainers = with maintainers; [ fabiangd ];
|
|
};
|
|
}
|