From 700b90e609646ed419b76452a8e17e1496c195ae Mon Sep 17 00:00:00 2001 From: TomaSajt <62384384+TomaSajt@users.noreply.github.com> Date: Mon, 6 May 2024 17:02:17 +0200 Subject: [PATCH 1/3] python311Packages.biom-format: init at 2.1.15 --- .../python-modules/biom-format/default.nix | 71 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 73 insertions(+) create mode 100644 pkgs/development/python-modules/biom-format/default.nix 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/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 739e2c577792..3f962c433c70 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -1529,6 +1529,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 { }; From 5a9fabb4ecef0925bef4332a31b30a42dcfae703 Mon Sep 17 00:00:00 2001 From: TomaSajt <62384384+TomaSajt@users.noreply.github.com> Date: Mon, 6 May 2024 14:40:54 +0200 Subject: [PATCH 2/3] python311Packages.scikit-bio: format with nixfmt --- .../python-modules/scikit-bio/default.nix | 59 ++++++++++++------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/pkgs/development/python-modules/scikit-bio/default.nix b/pkgs/development/python-modules/scikit-bio/default.nix index 2f49063ae06c..ec86d092af42 100644 --- a/pkgs/development/python-modules/scikit-bio/default.nix +++ b/pkgs/development/python-modules/scikit-bio/default.nix @@ -1,22 +1,23 @@ -{ lib -, buildPythonPackage -, fetchPypi -, cython -, lockfile -, cachecontrol -, decorator -, h5py -, ipython -, matplotlib -, natsort -, numpy -, pandas -, scipy -, hdmedians -, scikit-learn -, coverage -, python -, isPy3k +{ + lib, + buildPythonPackage, + fetchPypi, + cython, + lockfile, + cachecontrol, + decorator, + h5py, + ipython, + matplotlib, + natsort, + numpy, + pandas, + scipy, + hdmedians, + scikit-learn, + coverage, + python, + isPy3k, }: buildPythonPackage rec { @@ -32,7 +33,20 @@ buildPythonPackage rec { nativeBuildInputs = [ cython ]; nativeCheckInputs = [ coverage ]; - propagatedBuildInputs = [ lockfile cachecontrol decorator ipython matplotlib natsort numpy pandas scipy h5py hdmedians scikit-learn ]; + propagatedBuildInputs = [ + lockfile + cachecontrol + decorator + ipython + matplotlib + natsort + numpy + pandas + scipy + h5py + hdmedians + scikit-learn + ]; # cython package not included for tests doCheck = false; @@ -47,7 +61,10 @@ buildPythonPackage rec { homepage = "http://scikit-bio.org/"; description = "Data structures, algorithms and educational resources for bioinformatics"; license = licenses.bsd3; - platforms = [ "x86_64-linux" "x86_64-darwin" ]; + platforms = [ + "x86_64-linux" + "x86_64-darwin" + ]; maintainers = [ ]; }; } From a23b904c8b7238a5d1600f45bfe526a58956b6a9 Mon Sep 17 00:00:00 2001 From: TomaSajt <62384384+TomaSajt@users.noreply.github.com> Date: Mon, 6 May 2024 17:14:29 +0200 Subject: [PATCH 3/3] python311Packages.scikit-bio: unbreak, refactor, run tests, adopt --- .../python-modules/scikit-bio/default.nix | 64 +++++++++---------- 1 file changed, 29 insertions(+), 35 deletions(-) diff --git a/pkgs/development/python-modules/scikit-bio/default.nix b/pkgs/development/python-modules/scikit-bio/default.nix index ec86d092af42..7068063a8cb5 100644 --- a/pkgs/development/python-modules/scikit-bio/default.nix +++ b/pkgs/development/python-modules/scikit-bio/default.nix @@ -1,70 +1,64 @@ { lib, buildPythonPackage, - fetchPypi, + fetchFromGitHub, + setuptools, cython, - lockfile, - cachecontrol, + oldest-supported-numpy, + requests, decorator, - h5py, - ipython, - matplotlib, natsort, numpy, pandas, scipy, + h5py, hdmedians, - scikit-learn, - coverage, + biom-format, python, - isPy3k, + 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 + build-system = [ + setuptools + cython + oldest-supported-numpy + ]; + + dependencies = [ + requests decorator - ipython - matplotlib natsort numpy pandas scipy h5py hdmedians - scikit-learn + biom-format ]; - # cython package not included for tests - doCheck = false; + nativeCheckInputs = [ pytestCheckHook ]; - checkPhase = '' - ${python.interpreter} -m skbio.test - ''; + # 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 ]; }; }