diff --git a/pkgs/development/python-modules/biom-format/default.nix b/pkgs/development/python-modules/biom-format/default.nix new file mode 100644 index 000000000000..ca5ff3a83fb7 --- /dev/null +++ b/pkgs/development/python-modules/biom-format/default.nix @@ -0,0 +1,71 @@ +{ + lib, + buildPythonPackage, + fetchFromGitHub, + fetchpatch, + setuptools, + cython, + click, + numpy, + scipy, + pandas, + h5py, + pytestCheckHook, +}: + +buildPythonPackage rec { + pname = "biom-format"; + version = "2.1.15"; + pyproject = true; + + src = fetchFromGitHub { + owner = "biocore"; + repo = "biom-format"; + rev = "refs/tags/${version}"; + hash = "sha256-WRBc+C/UWme7wYogy4gH4KTIdIqU3KmBm2jWzGNxGQg="; + }; + + patches = [ + # fixes a test, can be removed in next version after 2.1.15 + (fetchpatch { + name = "fix-dataframe-comparison.patch"; + url = "https://github.com/biocore/biom-format/commit/5d1c921ca2cde5d7332508503ce990a7209d1fdc.patch"; + hash = "sha256-nyHi469ivjJSQ01yIk/6ZMXFdoo9wVuazJHnFdy2nBg="; + }) + ]; + + build-system = [ + setuptools + cython + numpy + ]; + + dependencies = [ + click + numpy + scipy + pandas + h5py + ]; + + # make pytest resolve the package from $out + # some tests don't work if we change the level of directory nesting + preCheck = '' + mkdir biom_tests + mv biom/tests biom_tests/tests + rm -r biom + ''; + + nativeCheckInputs = [ pytestCheckHook ]; + + pytestFlagsArray = [ "biom_tests/tests" ]; + + pythonImportsCheck = [ "biom" ]; + + meta = { + homepage = "http://biom-format.org/"; + description = "Biological Observation Matrix (BIOM) format"; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ tomasajt ]; + }; +} diff --git a/pkgs/development/python-modules/scikit-bio/default.nix b/pkgs/development/python-modules/scikit-bio/default.nix index 2f49063ae06c..7068063a8cb5 100644 --- a/pkgs/development/python-modules/scikit-bio/default.nix +++ b/pkgs/development/python-modules/scikit-bio/default.nix @@ -1,53 +1,64 @@ -{ lib -, buildPythonPackage -, fetchPypi -, cython -, lockfile -, cachecontrol -, decorator -, h5py -, ipython -, matplotlib -, natsort -, numpy -, pandas -, scipy -, hdmedians -, scikit-learn -, coverage -, python -, isPy3k +{ + lib, + buildPythonPackage, + fetchFromGitHub, + setuptools, + cython, + oldest-supported-numpy, + requests, + decorator, + natsort, + numpy, + pandas, + scipy, + h5py, + hdmedians, + biom-format, + python, + pytestCheckHook, }: buildPythonPackage rec { - version = "0.6.0"; - format = "setuptools"; pname = "scikit-bio"; - disabled = !isPy3k; + version = "0.6.0"; + pyproject = true; - src = fetchPypi { - inherit pname version; - hash = "sha256-EBBafDwVrlkQJEkn8punqjUjSxnr5lE7hIRUc0OywQ8="; + src = fetchFromGitHub { + owner = "scikit-bio"; + repo = "scikit-bio"; + rev = "refs/tags/${version}"; + hash = "sha256-v8/r52pJpMi34SekPQBf7CqRbs+ZEyPR3WO5RBB7uKg="; }; - nativeBuildInputs = [ cython ]; - nativeCheckInputs = [ coverage ]; - propagatedBuildInputs = [ lockfile cachecontrol decorator ipython matplotlib natsort numpy pandas scipy h5py hdmedians scikit-learn ]; + build-system = [ + setuptools + cython + oldest-supported-numpy + ]; - # cython package not included for tests - doCheck = false; + dependencies = [ + requests + decorator + natsort + numpy + pandas + scipy + h5py + hdmedians + biom-format + ]; - checkPhase = '' - ${python.interpreter} -m skbio.test - ''; + nativeCheckInputs = [ pytestCheckHook ]; + + # only the $out dir contains the built cython extensions, so we run the tests inside there + pytestFlagsArray = [ "${placeholder "out"}/${python.sitePackages}/skbio" ]; pythonImportsCheck = [ "skbio" ]; - meta = with lib; { + meta = { homepage = "http://scikit-bio.org/"; description = "Data structures, algorithms and educational resources for bioinformatics"; - license = licenses.bsd3; - platforms = [ "x86_64-linux" "x86_64-darwin" ]; - maintainers = [ ]; + license = lib.licenses.bsd3; + maintainers = with lib.maintainers; [ tomasajt ]; }; } diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 28fc5dbf9c84..595234057606 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1531,6 +1531,8 @@ self: super: with self; { binwalk-full = self.binwalk.override { visualizationSupport = true; }; + biom-format = callPackage ../development/python-modules/biom-format { }; + biopandas = callPackage ../development/python-modules/biopandas { }; biopython = callPackage ../development/python-modules/biopython { };