diff mbox series

[bug#48046] : Gnu add astropy

Message ID CAO+9K5r_T32NoHCX08=KfrmVX4Rrm890jwJFm_VdcpFWphU_2g@mail.gmail.com
State Accepted
Headers show
Series [bug#48046] : Gnu add astropy | expand

Checks

Context Check Description
cbaines/submitting builds success
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Sharlatan Hellseher April 26, 2021, 8:01 p.m. UTC
Hi Guix team!

Here is my attempt to pack bulky python package - https://www.astropy.org/
I've disabled test and add minor modification removing `_compiler.c' file.

Main license - https://docs.astropy.org/en/stable/license.html?highlight=license
third party licenses - https://github.com/astropy/astropy/tree/main/licenses
-- 
… наш разум - превосходная объяснительная машина которая способна
найти смысл почти в чем угодно, истолковать любой феномен, но
совершенно не в состоянии принять мысль о непредсказуемости.

Comments

Vinicius Monego May 19, 2021, 6:16 p.m. UTC | #1
Hi,

Em seg, 2021-04-26 às 20:01 +0000, Sharlatan Hellseher escreveu:
> Hi Guix team!
> 
> Here is my attempt to pack bulky python package - 
> https://www.astropy.org/
> I've disabled test and add minor modification removing `_compiler.c'
> file.

I've tried to package AstroPy before but got stuck in the dependencies,
more specifically pytest-astropy. There is a bug somewhere that pytest-
filter-subpackage is not found by setup.py, even though it's listed in
the inputs. I encountered that problem again here, after enabling the
tests.

> +     ;; NOTE: (Sharlatan-20210426T204315+0100): Tests require build
> astropy
> +     ;; module, it needs a good review on how to enable them.
> +     `(#:tests? #f

AstroPy uses pytest, which is not listed in your native-inputs. The
other dependencies I had to add are python-hypothesis, python-pytest-
cov, python-pytest-astropy and python-pytest-xdist. According to the
documentation, it should be as simple as running pytest to run the
entire test suite:

https://docs.astropy.org/en/latest/development/testguide.html#running-tests

If you end up in 'ModuleNotFoundError: No module named "astropy"', you
may have to update PYTHONPATH after the install phase with (add-
installed-pythonpath inputs outputs). That usually happens when
replacing the check phase.

> +    (inputs
> +     `(("asdf" ,python-asdf)
> +       ("beautifulsoup4" ,python-beautifulsoup4)
> +       ("bleach" ,python-bleach)
> +       ("bottleneck" ,python-bottleneck)
> +       ("cfitsio" ,cfitsio)
> +       ("dask" ,python-dask)
> +       ("expat" ,expat)
> +       ("graphviz" ,graphviz)
> +       ("h5py" ,python-h5py)
> +       ("html5lib" ,python-html5lib)
> +       ("jplephem" ,python-jplephem)
> +       ("matplotlib" ,python-matplotlib)
> +       ("mpmath" ,python-mpmath)
> +       ("numpy" ,python-numpy)
> +       ("pandas" ,python-pandas)
> +       ("pyerfa" ,python-pyerfa)
> +       ("pytz" ,python-pytz)
> +       ("pyyaml" ,python-pyyaml)
> +       ("scipy" ,python-scipy)
> +       ("sortedcontainers" ,python-sortedcontainers)
> +       ("wcslib" ,wcslib)))

AstroPy is a library, its Python inputs should be propagated here.
See https://guix.gnu.org/manual/en/html_node/package-Reference.html#package-Reference
for reference.

Also, the documentation states that the only strict requirements are
PyERFA and NumPy:

https://docs.astropy.org/en/stable/install.html

IMO we should only propagate these, and leave the rest in native-inputs
as needed by tests.

Now speaking of the astropy dependencies, pytest-astropy is supposed to
propagate its six dependencies. AFAIK its purpose is to be a
metapackage to install these other 6 pytest modules. PyERFA should also
propagate numpy (liberfa can remain as normal input).

I'll take a look at this package again next week. Could you test these
suggestions in the meantime?

Vinicius
Efraim Flashner Nov. 8, 2021, 8:06 a.m. UTC | #2
Thanks for finishing this up. Patches pushed.
diff mbox series

Patch

From 12680c01148cac6be095f1dfab8beae21977f6ef Mon Sep 17 00:00:00 2001
From: Sharlatan Hellseher <sharlatanus@gmail.com>
Date: Mon, 26 Apr 2021 20:52:09 +0100
Subject: [PATCH] Gnu: Add Astropy

* gnu/packages/astronomy.scm (python-astropy): New variable
---
 gnu/packages/astronomy.scm | 80 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 80 insertions(+)

diff --git a/gnu/packages/astronomy.scm b/gnu/packages/astronomy.scm
index 4660e141a4..c43c98f797 100644
--- a/gnu/packages/astronomy.scm
+++ b/gnu/packages/astronomy.scm
@@ -39,6 +39,7 @@ 
   #:use-module (gnu packages gl)
   #:use-module (gnu packages glib)
   #:use-module (gnu packages gnome)
+  #:use-module (gnu packages graphviz)
   #:use-module (gnu packages gtk)
   #:use-module (gnu packages image)
   #:use-module (gnu packages libusb)
@@ -51,11 +52,14 @@ 
   #:use-module (gnu packages python-check)
   #:use-module (gnu packages python-crypto)
   #:use-module (gnu packages python-science)
+  #:use-module (gnu packages python-web)
   #:use-module (gnu packages python-xyz)
   #:use-module (gnu packages qt)
+  #:use-module (gnu packages time)
   #:use-module (gnu packages version-control)
   #:use-module (gnu packages video)
   #:use-module (gnu packages xiph)
+  #:use-module (gnu packages xml)
   #:use-module (gnu packages xorg)
   #:use-module (guix build-system cmake)
   #:use-module (guix build-system gnu)
@@ -1034,3 +1038,79 @@  astronomical images, especially when there is no WCS information available.")
      "Skyfield computes positions for the stars, planets, and satellites in
 orbit around the Earth.")
     (license license:expat)))
+
+(define-public python-astropy
+  (package
+    (name "python-astropy")
+    (version "4.2.1")
+    (source
+     (origin
+       (method url-fetch)
+       ;; Source: https://github.com/astropy/astropy
+       (uri (pypi-uri "astropy" version))
+       (sha256
+        (base32 "09w4q64c6bykcdp8xdq5fgsdjqrcihqhqjszqjp3s5a1493kwj7d"))))
+    (build-system python-build-system)
+    (arguments
+     ;; NOTE: (Sharlatan-20210426T204315+0100): Tests require build astropy
+     ;; module, it needs a good review on how to enable them.
+     `(#:tests? #f
+       #:phases
+       (modify-phases %standard-phases
+         (add-before 'build 'setenv-astropy-system-all
+           (lambda _
+             (setenv "ASTROPY_USE_SYSTEM_ALL" "1")
+             #t))
+         ;; NOTE: (Sharlatan-20210426T200127+0100): it fails during install
+         ;; phases without the file is removed
+         ;;
+         ;; PermissionError: [Errno 13] Permission denied: './astropy/_compiler.c'
+         (add-before 'install 'remove-compiler-c
+           (lambda _
+             (delete-file "astropy/_compiler.c")
+             #t))
+         (add-before 'install 'makdir-astropy
+           (lambda* (#:key outputs #:allow-other-keys)
+             (let ((out (assoc-ref outputs "out")))
+               (mkdir-p
+                (string-append out "/astropy")))
+             #t)))))
+    (native-inputs
+     `(("cfitsio" ,cfitsio)
+       ("coverage" ,python-coverage)
+       ("cython" ,python-cython)
+       ("extension-helpers" ,python-extension-helpers)
+       ("ipython" ,python-ipython)
+       ("objgraph" ,python-objgraph)
+       ("pkg-config" ,pkg-config)
+       ("setuptools-scm" ,python-setuptools-scm)
+       ("sgp4" ,python-sgp4)
+       ("skyfield" ,python-skyfield)))
+    (inputs
+     `(("asdf" ,python-asdf)
+       ("beautifulsoup4" ,python-beautifulsoup4)
+       ("bleach" ,python-bleach)
+       ("bottleneck" ,python-bottleneck)
+       ("cfitsio" ,cfitsio)
+       ("dask" ,python-dask)
+       ("expat" ,expat)
+       ("graphviz" ,graphviz)
+       ("h5py" ,python-h5py)
+       ("html5lib" ,python-html5lib)
+       ("jplephem" ,python-jplephem)
+       ("matplotlib" ,python-matplotlib)
+       ("mpmath" ,python-mpmath)
+       ("numpy" ,python-numpy)
+       ("pandas" ,python-pandas)
+       ("pyerfa" ,python-pyerfa)
+       ("pytz" ,python-pytz)
+       ("pyyaml" ,python-pyyaml)
+       ("scipy" ,python-scipy)
+       ("sortedcontainers" ,python-sortedcontainers)
+       ("wcslib" ,wcslib)))
+    (home-page "https://astropy.org/")
+    (synopsis "Astronomy and astrophysics core library")
+    (description
+     "Astropy Project is a single core package for Astronomy in Python and foster
+interoperability between Python astronomy packages.")
+    (license license:bsd-3)))
-- 
2.31.1