diff --git a/pkgs/development/python-modules/scanpy/default.nix b/pkgs/development/python-modules/scanpy/default.nix index 133513e646ad..88b1f4c7f624 100644 --- a/pkgs/development/python-modules/scanpy/default.nix +++ b/pkgs/development/python-modules/scanpy/default.nix @@ -2,9 +2,14 @@ lib, buildPythonPackage, fetchFromGitHub, + + # build-system hatch-vcs, hatchling, + + # dependencies anndata, + fast-array-utils, h5py, joblib, legacy-api-wrap, @@ -25,35 +30,54 @@ tqdm, typing-extensions, umap-learn, - dask, - dask-ml, + # optional-attrs + # dask + dask, + # dask-ml + dask-ml, + # leiden igraph, leidenalg, + # scrublet scikit-image, + # skmisc scikit-misc, - zarr, - pytestCheckHook, + + # tests + jinja2, pytest-cov-stub, pytest-mock, pytest-randomly, pytest-rerunfailures, pytest-xdist, + pytestCheckHook, tuna, + writableTmpDirAsHomeHook, + zarr, }: -buildPythonPackage rec { +buildPythonPackage (finalAttrs: { pname = "scanpy"; - version = "1.11.5"; + version = "1.12.0"; pyproject = true; src = fetchFromGitHub { owner = "scverse"; repo = "scanpy"; - tag = version; - hash = "sha256-GnZ1qJ4SaTLDzfLAH6IHrYeuMBo8PglKUlj4f3ljeR0="; + tag = finalAttrs.version; + hash = "sha256-jpi3SyTaG5mxCqUNSM564MMIrNdz4LBYo9+dn5nYmeY="; }; + # Otherwise, several tests fail to be collected: + # AssertionError: scanpy is already imported, this will mess up test coverage + postPatch = '' + substituteInPlace src/testing/scanpy/_pytest/__init__.py \ + --replace-fail \ + 'assert "scanpy" not in sys.modules,' \ + 'assert True,' + ''; + build-system = [ hatch-vcs hatchling @@ -61,6 +85,7 @@ buildPythonPackage rec { dependencies = [ anndata + fast-array-utils h5py joblib legacy-api-wrap @@ -81,7 +106,9 @@ buildPythonPackage rec { tqdm typing-extensions umap-learn - ]; + ] + ++ fast-array-utils.optional-dependencies.accel + ++ fast-array-utils.optional-dependencies.sparse; optional-dependencies = { # commented attributes are due to some dependencies not being in Nixpkgs @@ -129,13 +156,15 @@ buildPythonPackage rec { }; nativeCheckInputs = [ - pytestCheckHook + jinja2 pytest-cov-stub pytest-mock pytest-randomly pytest-rerunfailures pytest-xdist + pytestCheckHook tuna + writableTmpDirAsHomeHook zarr ]; @@ -151,35 +180,57 @@ buildPythonPackage rec { "tests/test_pca.py" "tests/test_plotting.py" "tests/test_plotting_embedded/" + + # fixture 'backed_adata' not found + "tests/test_backed.py" ]; disabledTests = [ # try to download data: "scanpy.get._aggregated.aggregate" "scanpy.plotting._tools.scatterplots.spatial" + "test_burczynski06" "test_clip" + "test_doc_shape" "test_download_failure" + "test_ebi_expression_atlas" "test_mean_var" + "test_paul15" + "test_pbmc3k" + "test_pbmc3k_processed" "test_regress_out_int" "test_score_with_reference" + "test_visium_datasets" + "test_visium_datasets_dir_change" + "test_visium_datasets_images" # fails to find the trivial test script for some reason: "test_external" + # fixture 'original_settings' not found + "test_defaults" + # AssertionError: Not equal to tolerance rtol=1e-07, atol=0 "test_connectivities_euclidean" + + # assert sc.settings.autoshow + # AssertionError: assert False + "test_resets" + + # FileNotFoundError: [Errno 2] Unable to synchronously create file (unable to open file: name = + # 'write/test.h5ad', errno = 2, error message = 'No such file or directory', flags = 13, o_flags + # = 242) + "test_write" ]; - pythonImportsCheck = [ - "scanpy" - ]; + pythonImportsCheck = [ "scanpy" ]; meta = { description = "Single-cell analysis in Python which scales to >100M cells"; homepage = "https://scanpy.readthedocs.io"; - changelog = "https://github.com/scverse/scanpy/releases/tag/${src.tag}"; + changelog = "https://github.com/scverse/scanpy/releases/tag/${finalAttrs.src.tag}"; license = lib.licenses.bsd3; maintainers = with lib.maintainers; [ bcdarwin ]; mainProgram = "scanpy"; }; -} +})