unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
From: Roel Janssen <roel@gnu.org>
To: 48774@debbugs.gnu.org
Subject: [bug#48774] [PATCH] Fix build of python-scanpy
Date: Tue, 1 Jun 2021 10:33:34 +0200	[thread overview]
Message-ID: <4ee322e7-2aaf-750a-bee7-4bbc8d7bd64b@gnu.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 346 bytes --]

Dear Guix,

The attached two patches update python-anndata and python-scanpy, which 
effectively fix the build for python-scanpy.

python-anndata switched to a PEP518 setup instead of the regular Python 
"setup.py" approach.  So with some help on IRC, I added custom phases 
inspired by the python-tinycss2 package.

Kind regards,
Roel Janssen


[-- Attachment #2: 0001-gnu-python-anndata-Update-to-0.7.6.patch --]
[-- Type: text/x-patch, Size: 3114 bytes --]

From 04527e305c96addea2c231b901758339e576d146 Mon Sep 17 00:00:00 2001
From: Roel Janssen <roel@gnu.org>
Date: Tue, 1 Jun 2021 10:20:10 +0200
Subject: [PATCH 1/2] gnu: python-anndata: Update to 0.7.6.

* gnu/packages/python-xyz.scm (python-anndata): Update to 0.7.6.
---
 gnu/packages/python-xyz.scm | 35 +++++++++++++++++++++++++----------
 1 file changed, 25 insertions(+), 10 deletions(-)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index a5cc04edaf..973123b385 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -21046,28 +21046,41 @@ N-dimensional arrays for Python.")
 (define-public python-anndata
   (package
     (name "python-anndata")
-    (version "0.7.1")
+    (version "0.7.6")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "anndata" version))
        (sha256
         (base32
-         "0rnfbpr55j1a1bi2kd4mz444741hrn74kz90h5rnjr59jmpfnh09"))))
+         "1ch8yp0xmag6z0kl01pljm35lbbwax7lrimfhiclpkd4m6xngk53"))))
     (build-system python-build-system)
     (arguments
-     `(#:phases
+     `(#:tests? #f ; The tarball from PyPi doesn't include tests.
+       #:phases
        (modify-phases %standard-phases
-         (add-after 'unpack 'delete-inconvenient-tests
-           (lambda _
-             ;; This test depends on python-scikit-learn.
-             (delete-file "anndata/tests/test_inplace_subset.py")
-             #t))
          (delete 'check)
-         (add-after 'install 'check
+         (add-before 'build 'relax-dependency-requirements
+           (lambda _
+             ;; We need to upgrade python-pandas to avoid
+             ;; https://github.com/pandas-dev/pandas/issues/35446
+             (substitute* "pyproject.toml"
+               (("pandas>=1.1.1") "pandas>=1.0.5"))))
+         (replace 'build
+           (lambda _
+             ;; ZIP does not support timestamps before 1980.
+             (setenv "SOURCE_DATE_EPOCH" "315532800")
+             (invoke "flit" "build")))
+         (replace 'install
            (lambda* (#:key inputs outputs #:allow-other-keys)
              (add-installed-pythonpath inputs outputs)
-             (invoke "pytest" "-vv"))))))
+             (let ((out (assoc-ref outputs "out")))
+               (for-each (lambda (wheel)
+                           (format #true wheel)
+                           (invoke "python" "-m" "pip" "install"
+                                   wheel (string-append "--prefix=" out)))
+                         (find-files "dist" "\\.whl$")))
+             #t)))))
     (propagated-inputs
      `(("python-h5py" ,python-h5py)
        ("python-importlib-metadata" ,python-importlib-metadata)
@@ -21080,6 +21093,8 @@ N-dimensional arrays for Python.")
     (native-inputs
      `(("python-joblib" ,python-joblib)
        ("python-pytest" ,python-pytest)
+       ("python-toml" ,python-toml)
+       ("python-flit" ,python-flit)
        ("python-setuptools-scm" ,python-setuptools-scm)))
     (home-page "https://github.com/theislab/anndata")
     (synopsis "Annotated data for data analysis pipelines")
-- 
2.31.1


[-- Attachment #3: 0002-gnu-python-scanpy-Update-to-1.7.2.patch --]
[-- Type: text/x-patch, Size: 3560 bytes --]

From 094705a4ee2c46e8ed1b98c39c03b2a21c688c5e Mon Sep 17 00:00:00 2001
From: Roel Janssen <roel@gnu.org>
Date: Tue, 1 Jun 2021 10:25:12 +0200
Subject: [PATCH 2/2] gnu: python-scanpy: Update to 1.7.2.

* gnu/packages/bioinformatics.scm (python-scanpy): Update to 1.7.2.
---
 gnu/packages/bioinformatics.scm | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/gnu/packages/bioinformatics.scm b/gnu/packages/bioinformatics.scm
index 1f018befe6..2b64a04150 100644
--- a/gnu/packages/bioinformatics.scm
+++ b/gnu/packages/bioinformatics.scm
@@ -122,6 +122,7 @@
   #:use-module (gnu packages popt)
   #:use-module (gnu packages protobuf)
   #:use-module (gnu packages python)
+  #:use-module (gnu packages python-build)
   #:use-module (gnu packages python-check)
   #:use-module (gnu packages python-compression)
   #:use-module (gnu packages python-science)
@@ -11096,14 +11097,14 @@ in RNA-seq data.")
 (define-public python-scanpy
   (package
     (name "python-scanpy")
-    (version "1.4.6")
+    (version "1.7.2")
     (source
      (origin
        (method url-fetch)
        (uri (pypi-uri "scanpy" version))
        (sha256
         (base32
-         "0s2b6cvaigx4wzw3850qb93sjwwxbzh22kpbp498zklc5rjpbz4l"))))
+         "0c66adnfizsyk0h8bv2yhmay876z0klpxwpn4z6m71wly7yplpmd"))))
     (build-system python-build-system)
     (arguments
      `(#:phases
@@ -11114,12 +11115,25 @@ in RNA-seq data.")
              (delete-file-recursively "scanpy/tests/notebooks")
              (delete-file "scanpy/tests/test_clustering.py")
              (delete-file "scanpy/tests/test_datasets.py")
+             (delete-file "scanpy/tests/test_highly_variable_genes.py")
 
              ;; TODO: I can't get the plotting tests to work, even with Xvfb.
              (delete-file "scanpy/tests/test_plotting.py")
              (delete-file "scanpy/tests/test_preprocessing.py")
              (delete-file "scanpy/tests/test_read_10x.py")
 
+             ;; The following tests need anndata.tests, which aren't included
+             ;; in the final python-anndata package.
+             (delete-file "scanpy/tests/test_combat.py")
+             (delete-file "scanpy/tests/test_embedding_plots.py")
+             (delete-file "scanpy/tests/test_normalization.py")
+             (delete-file "scanpy/tests/test_pca.py")
+             (delete-file "scanpy/tests/external/test_scrublet.py")
+
+             ;; The following tests requires 'scanorama', which isn't
+             ;; packaged yet.
+             (delete-file "scanpy/tests/external/test_scanorama_integrate.py")
+
              (setenv "PYTHONPATH"
                      (string-append (getcwd) ":"
                                     (getenv "PYTHONPATH")))
@@ -11144,11 +11158,14 @@ in RNA-seq data.")
        ("python-seaborn" ,python-seaborn)
        ("python-statsmodels" ,python-statsmodels)
        ("python-tables" ,python-tables)
+       ("python-pytoml" ,python-pytoml)
        ("python-tqdm" ,python-tqdm)
        ("python-umap-learn" ,python-umap-learn)))
     (native-inputs
-     `(("python-pytest" ,python-pytest)
-       ("python-setuptools-scm" ,python-setuptools-scm)))
+     `(("python-leidenalg" ,python-leidenalg)
+       ("python-pytest" ,python-pytest)
+       ("python-setuptools-scm" ,python-setuptools-scm)
+       ("python-sinfo" ,python-sinfo)))
     (home-page "https://github.com/theislab/scanpy")
     (synopsis "Single-Cell Analysis in Python.")
     (description "Scanpy is a scalable toolkit for analyzing single-cell gene
-- 
2.31.1


             reply	other threads:[~2021-06-01  8:35 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-01  8:33 Roel Janssen [this message]
2021-06-04 11:54 ` [bug#48774] [PATCH] Fix build of python-scanpy Mathieu Othacehe
2021-06-04 21:58   ` bug#48774: " Roel Janssen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4ee322e7-2aaf-750a-bee7-4bbc8d7bd64b@gnu.org \
    --to=roel@gnu.org \
    --cc=48774@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).