diff --git a/pkgs/development/python-modules/cnvkit/default.nix b/pkgs/development/python-modules/cnvkit/default.nix index 168ba0b0882b..4911f8b004cd 100644 --- a/pkgs/development/python-modules/cnvkit/default.nix +++ b/pkgs/development/python-modules/cnvkit/default.nix @@ -1,31 +1,31 @@ { lib, - fetchFromGitHub, - rPackages, buildPythonPackage, + fetchFromGitHub, + fetchpatch, + + # dependencies + R, biopython, - numpy, - scipy, - scikit-learn, - pandas, matplotlib, - reportlab, - pysam, - future, - pillow, + numpy, + pandas, pomegranate, pyfaidx, - python, - pythonOlder, - R, + pysam, + rPackages, + reportlab, + scikit-learn, + scipy, + + # tests + pytestCheckHook, }: buildPythonPackage rec { pname = "cnvkit"; version = "0.9.12"; - format = "setuptools"; - - disabled = pythonOlder "3.7"; + pyproject = true; src = fetchFromGitHub { owner = "etal"; @@ -34,50 +34,58 @@ buildPythonPackage rec { hash = "sha256-ZdE3EUNZpEXRHTRKwVhuj3BWQWczpdFbg4pVr0+AHiQ="; }; - postPatch = '' - # see https://github.com/etal/cnvkit/issues/589 - substituteInPlace setup.py \ - --replace 'joblib < 1.0' 'joblib' - # see https://github.com/etal/cnvkit/issues/680 - substituteInPlace test/test_io.py \ - --replace 'test_read_vcf' 'dont_test_read_vcf' - ''; - - propagatedBuildInputs = [ - biopython - numpy - scipy - scikit-learn - pandas - matplotlib - reportlab - pyfaidx - pysam - future - pillow - pomegranate - rPackages.DNAcopy + patches = [ + (fetchpatch { + name = "fix-numpy2-compat"; + url = "https://github.com/etal/cnvkit/commit/5cb6aeaf40ea5572063cf9914c456c307b7ddf7a.patch"; + hash = "sha256-VwGAMGKuX2Kx9xL9GX/PB94/7LkT0dSLbWIfVO8F9NI="; + }) ]; - nativeCheckInputs = [ R ]; + pythonRelaxDeps = [ + # https://github.com/etal/cnvkit/issues/815 + "pomegranate" + ]; - checkPhase = '' - pushd test/ - ${python.interpreter} test_io.py - ${python.interpreter} test_genome.py - ${python.interpreter} test_cnvlib.py - ${python.interpreter} test_commands.py - ${python.interpreter} test_r.py - popd # test/ + # Numpy 2 compatibility + postPatch = '' + substituteInPlace skgenome/intersect.py \ + --replace-fail "np.string_" "np.bytes_" ''; + dependencies = [ + biopython + matplotlib + numpy + pandas + pomegranate + pyfaidx + pysam + rPackages.DNAcopy + reportlab + scikit-learn + scipy + ]; + pythonImportsCheck = [ "cnvlib" ]; - meta = with lib; { + nativeCheckInputs = [ + pytestCheckHook + R + ]; + + disabledTests = [ + # AttributeError: module 'pomegranate' has no attribute 'NormalDistribution' + # https://github.com/etal/cnvkit/issues/815 + "test_batch" + "test_segment_hmm" + ]; + + meta = { homepage = "https://cnvkit.readthedocs.io"; description = "Python library and command-line software toolkit to infer and visualize copy number from high-throughput DNA sequencing data"; changelog = "https://github.com/etal/cnvkit/releases/tag/v${version}"; - license = licenses.asl20; - maintainers = [ maintainers.jbedo ]; + license = lib.licenses.asl20; + maintainers = [ lib.maintainers.jbedo ]; }; } diff --git a/pkgs/development/python-modules/pomegranate/default.nix b/pkgs/development/python-modules/pomegranate/default.nix index 071c15c7e100..cbf7630bfa6b 100644 --- a/pkgs/development/python-modules/pomegranate/default.nix +++ b/pkgs/development/python-modules/pomegranate/default.nix @@ -1,5 +1,6 @@ { lib, + stdenv, buildPythonPackage, fetchFromGitHub, @@ -7,45 +8,63 @@ setuptools, # dependencies - numpy, - joblib, + apricot-select, networkx, + numpy, + scikit-learn, scipy, - pyyaml, - cython, + torch, + + # tests + pytestCheckHook, }: buildPythonPackage rec { pname = "pomegranate"; - version = "0.14.8"; + version = "1.1.0"; pyproject = true; src = fetchFromGitHub { repo = pname; owner = "jmschrei"; - # no tags for recent versions: https://github.com/jmschrei/pomegranate/issues/974 tag = "v${version}"; - hash = "sha256-PoDAtNm/snq4isotkoCTVYUuwr9AKKwiXIojUFMH/YE="; + hash = "sha256-p2Gn0FXnsAHvRUeAqx4M1KH0+XvDl3fmUZZ7MiMvPSs="; }; - nativeBuildInputs = [ setuptools ]; + build-system = [ setuptools ]; - propagatedBuildInputs = [ - numpy - joblib + dependencies = [ + apricot-select networkx + numpy + scikit-learn scipy - pyyaml - cython + torch ]; - # https://github.com/etal/cnvkit/issues/815 - passthru.skipBulkUpdate = true; + pythonImportsCheck = [ "pomegranate" ]; - meta = with lib; { + nativeCheckInputs = [ + pytestCheckHook + ]; + + pytestFlagsArray = lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [ + # AssertionError: Arrays are not almost equal to 6 decimals + "--deselect=tests/distributions/test_normal_full.py::test_fit" + "--deselect=tests/distributions/test_normal_full.py::test_from_summaries" + "--deselect=tests/distributions/test_normal_full.py::test_serialization" + ]; + + disabledTests = [ + # AssertionError: Arrays are not almost equal to 6 decimals + "test_sample" + ]; + + meta = { description = "Probabilistic and graphical models for Python, implemented in cython for speed"; homepage = "https://github.com/jmschrei/pomegranate"; - license = licenses.mit; - maintainers = with maintainers; [ rybern ]; + changelog = "https://github.com/jmschrei/pomegranate/releases/tag/v${version}"; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ rybern ]; }; }