git.iko.soy/typeable/nixpkgs
on master help sign in
python3Packages.qutip: init at 4.6.2
commit404254c829ff2e2e87acd5943ce178ec7d753ceb authorFabian G. Dröge <fabian.g.droege@gmail.com> dateMon 1 Nov 2021, 16:47 (5 years ago) parentd917b8c
2 files changed+59
pkgs/development/python-modules/qutip/default.nix+57 pkgs/top-level/python-packages.nix+2
pkgs/development/python-modules/qutip/default.nixnew file+57
@@ -0,0 +1,57 @@
1+{ lib, stdenv, fetchFromGitHub, buildPythonPackage, python, packaging, numpy
2+, cython, scipy, matplotlib, pytestCheckHook, pytest-rerunfailures }:
3+
4+buildPythonPackage rec {
5+ pname = "qutip";
6+ version = "4.6.2";
7+
8+ src = fetchFromGitHub {
9+ owner = pname;
10+ repo = pname;
11+ rev = "v${version}";
12+ sha256 = "04g7ixq1yrrid4lliqbcamnzyw5r0fjbl8ipklps234hvsjfwmxb";
13+ };
14+
15+ # QuTiP says it needs specific (old) Numpy versions. We overwrite them here
16+ # as the tests work perfectly fine with up-to-date packages.
17+ postPatch = ''
18+ substituteInPlace setup.cfg --replace "numpy>=1.16.6,<1.20" "numpy>=1.16.6"
19+ '';
20+
21+ # Disabling OpenMP support on Darwin.
22+ setupPyGlobalFlags = lib.optional (!stdenv.isDarwin) "--with-openmp";
23+
24+ propagatedBuildInputs = [
25+ packaging
26+ numpy
27+ cython
28+ scipy
29+ matplotlib
30+ ];
31+
32+ checkInputs = [
33+ pytestCheckHook
34+ pytest-rerunfailures
35+ ];
36+
37+ # - QuTiP tries to access the home directory to create an rc file for us.
38+ # This of course fails and therefore, we provide a writable temp dir as HOME.
39+ # - We need to go to another directory to run the tests from there.
40+ # This is due to the Cython-compiled modules not being in the correct location
41+ # of the source tree.
42+ # - For running tests, see:
43+ # https://qutip.org/docs/latest/installation.html#verifying-the-installation
44+ checkPhase = ''
45+ export OMP_NUM_THREADS=$NIX_BUILD_CORES
46+ export HOME=$(mktemp -d)
47+ mkdir -p test && cd test
48+ ${python.interpreter} -c "import qutip.testing; qutip.testing.run()"
49+ '';
50+
51+ meta = with lib; {
52+ description = "Open-source software for simulating the dynamics of closed and open quantum systems";
53+ homepage = "https://qutip.org/";
54+ license = licenses.bsd3;
55+ maintainers = [ maintainers.fabiangd ];
56+ };
57+}
pkgs/top-level/python-packages.nix+2
@@ -7896,6 +7896,8 @@ in {
78967896
78977897 queuelib = callPackage ../development/python-modules/queuelib { };
78987898
7899+ qutip = callPackage ../development/python-modules/qutip { };
7900+
78997901 qmk-dotty-dict = callPackage ../development/python-modules/qmk-dotty-dict { };
79007902
79017903 r2pipe = callPackage ../development/python-modules/r2pipe { };