unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#48046] [PATCH]: Gnu add astropy
@ 2021-04-26 20:01 Sharlatan Hellseher
  2021-05-19 18:16 ` Vinicius Monego
  2021-10-30  2:51 ` [bug#48046] [PATCH v2 0/3] Add Astropy Vinicius Monego
  0 siblings, 2 replies; 12+ messages in thread
From: Sharlatan Hellseher @ 2021-04-26 20:01 UTC (permalink / raw)
  To: 48046

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

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
-- 
… наш разум - превосходная объяснительная машина которая способна
найти смысл почти в чем угодно, истолковать любой феномен, но
совершенно не в состоянии принять мысль о непредсказуемости.

[-- Attachment #2: 0001-Gnu-Add-Astropy.patch --]
[-- Type: text/x-patch, Size: 4455 bytes --]

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


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [bug#48046] [PATCH]: Gnu add astropy
  2021-04-26 20:01 [bug#48046] [PATCH]: Gnu add astropy Sharlatan Hellseher
@ 2021-05-19 18:16 ` Vinicius Monego
  2021-05-22 20:00   ` Sharlatan Hellseher
  2021-10-30  2:51 ` [bug#48046] [PATCH v2 0/3] Add Astropy Vinicius Monego
  1 sibling, 1 reply; 12+ messages in thread
From: Vinicius Monego @ 2021-05-19 18:16 UTC (permalink / raw)
  To: Sharlatan Hellseher; +Cc: 48046

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
 





^ permalink raw reply	[flat|nested] 12+ messages in thread

* [bug#48046] [PATCH]: Gnu add astropy
  2021-05-19 18:16 ` Vinicius Monego
@ 2021-05-22 20:00   ` Sharlatan Hellseher
  2021-05-23 17:54     ` Vinicius Monego
  0 siblings, 1 reply; 12+ messages in thread
From: Sharlatan Hellseher @ 2021-05-22 20:00 UTC (permalink / raw)
  To: Vinicius Monego; +Cc: 48046

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

Hi Vinicius,

My attempt to make Astropy test working failed as well. the project
heavily depends on TOX which requires pip to install missing
dependencies for itself. I run test with pytest but it looks like it's
not allowed by this
https://github.com/astropy/astropy/blob/main/astropy/__init__.py#L139

I'll come back to conquer it once again when I have some fresh ideas.

On Wed, 19 May 2021 at 18:16, Vinicius Monego <monego@posteo.net> wrote:
>
> 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
>
>


-- 

… наш разум - превосходная объяснительная машина которая способна
найти смысл почти в чем угодно, истолковать любой феномен, но
совершенно не в состоянии принять мысль о непредсказуемости.

[-- Attachment #2: 0001-gnu-astropy-rc1.patch --]
[-- Type: text/x-patch, Size: 5408 bytes --]

From 4b0d8e20915ee674054cb3bd1b3573a9f42bd08a Mon Sep 17 00:00:00 2001
From: Sharlatan Hellseher <sharlatanus@gmail.com>
Date: Sat, 22 May 2021 20:52:49 +0100
Subject: [PATCH] gnu: astropy: rc1

* gnu/packages/astronomy.scm (python-astropy)
 [inputs]: refactor inputs
 [package] Attemp to make test working no-successufl run, it failed with

starting phase `check'
/tmp/guix-build-python-astropy-4.2.1.drv-0/astropy-4.2.1/astropy/config/configuration.py:582: ConfigurationMissingWarning: Configuration defaults will be used due to FileNotFoundError:2 on None
  warn(ConfigurationMissingWarning(msg))
ImportError while loading conftest '/tmp/guix-build-python-astropy-4.2.1.drv-0/astropy-4.2.1/conftest.py'.
conftest.py:11: in <module>
    from astropy import __version__
astropy/__init__.py:248: in <module>
    _initialize_astropy()
astropy/__init__.py:203: in _initialize_astropy
    raise ImportError('You appear to be trying to import astropy from '
E   ImportError: You appear to be trying to import astropy from within a source checkout or from an editable installation without building the extension modules first. Either run:
E
E     pip install -e .
E
E   or
E
E     python setup.py build_ext --inplace
E
E   to make sure the extension modules are built
command "pytest" "-vv" failed with status 4
builder for `/gnu/store/syjzb0sjd01af6i13k5pa6snwxk1im3x-python-astropy-4.2.1.drv' failed with exit code 1
---
 gnu/packages/astronomy.scm | 71 +++++++++++++++++++++-----------------
 1 file changed, 40 insertions(+), 31 deletions(-)

diff --git a/gnu/packages/astronomy.scm b/gnu/packages/astronomy.scm
index b607fbd3d7..8ea665380e 100644
--- a/gnu/packages/astronomy.scm
+++ b/gnu/packages/astronomy.scm
@@ -1085,13 +1085,17 @@ orbit around the Earth.")
     (arguments
      ;; NOTE: (Sharlatan-20210426T204315+0100): Tests require build astropy
      ;; module, it needs a good review on how to enable them.
-     `(#:tests? #f
+     `(;#:tests? #f
        #:phases
        (modify-phases %standard-phases
          (add-before 'build 'setenv-astropy-system-all
            (lambda _
              (setenv "ASTROPY_USE_SYSTEM_ALL" "1")
              #t))
+         (replace 'check
+           (lambda* (#:key inputs outputs #:allow-other-keys)
+             (add-installed-pythonpath inputs outputs)
+             (invoke "pytest" "-vv")))
          ;; NOTE: (Sharlatan-20210426T200127+0100): it fails during install
          ;; phases without the file is removed
          ;;
@@ -1108,37 +1112,42 @@ orbit around the Earth.")
              #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)
+       ("python-asdf" ,python-asdf)("expat" ,expat)
+       ("python-beautifulsoup4" ,python-beautifulsoup4)
+       ("python-bleach" ,python-bleach)
+       ("python-bottleneck" ,python-bottleneck)
+       ("python-coverage" ,python-coverage)
+       ("python-cython" ,python-cython)
+       ("python-dask" ,python-dask)
+       ("python-extension-helpers" ,python-extension-helpers)
+       ("python-graphviz" ,graphviz)
+       ("python-h5py" ,python-h5py)
+       ("python-html5lib" ,python-html5lib)
+       ("python-hypothesis" ,python-hypothesis)
+       ("python-ipython" ,python-ipython)
+       ("python-jplephem" ,python-jplephem)
+       ("python-matplotlib" ,python-matplotlib)
+       ("python-mpmath" ,python-mpmath)
+       ("python-objgraph" ,python-objgraph)
+       ("python-pandas" ,python-pandas)
+       ("python-pkg-config" ,pkg-config)
+       ("python-pytest" ,python-pytest)
+       ("python-pytest-astropy" ,python-pytest-astropy)
+       ("python-pytest-cov" ,python-pytest-cov)
+       ("python-pytest-xdist" ,python-pytest-xdist)
+       ("python-pytz" ,python-pytz)
+       ("python-pyyaml" ,python-pyyaml)
+       ("python-scipy" ,python-scipy)
+       ("python-setuptools" ,python-setuptools)
+       ("python-setuptools-scm" ,python-setuptools-scm)
+       ("python-sgp4" ,python-sgp4)
+       ("python-skyfield" ,python-skyfield)
+       ("python-sortedcontainers" ,python-sortedcontainers)
+       ("python-tox" ,python-tox)
        ("wcslib" ,wcslib)))
+    (propagated-inputs
+     `(("python-numpy" ,python-numpy)
+       ("python-pyerfa" ,python-pyerfa)))
     (home-page "https://astropy.org/")
     (synopsis "Astronomy and astrophysics core library")
     (description
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [bug#48046] [PATCH]: Gnu add astropy
  2021-05-22 20:00   ` Sharlatan Hellseher
@ 2021-05-23 17:54     ` Vinicius Monego
  2021-05-23 20:01       ` Sharlatan Hellseher
  0 siblings, 1 reply; 12+ messages in thread
From: Vinicius Monego @ 2021-05-23 17:54 UTC (permalink / raw)
  To: Sharlatan Hellseher; +Cc: 48046

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

Hi Sharlatan,

Thanks for continuing the work on the astropy package, I managed to
finish it this time. I am resending your patch with the following
modifications:

- Moved the package definition from the bottom to the middle of the
file (to avoid merge conflicts)
- Removed all optional inputs and propagated the remaining. I left only
those listed in install_requires, setup_requires, test_requires and
test[extras] in setup.cfg
- Changed synopsis and description
- Changed package labels to match the package name    
- Made the compiler file writable instead of deleting it
- Deleted the makdir-astropy phase (it wasn't needed)
- Added license for the jquery bundle that is not replaced

and then I made my own improvements on that patch: enabling tests and
unbundling some external libraries.

I removed the optional packages because astropy is a core package,
which will be a dependency for its many extensions. It's important that
it builds with a high probability of success or the chain will break.
Some of its optional dependencies, e.g. Pandas, have a broken build in
aarch64 at the moment. The "full" astropy package could be installed
easily from a manifest file and the tests can run again with
astropy.test().

> the project heavily depends on TOX which requires pip to install
> missing dependencies for itself.

I don't think that a project can heavily depend on tox, all it does is
manage a virtual environment with dependencies to run the tests. Guix
does the same so tox is redundant here. Tests will still run with the
testing framework.

Two more suggestions for future Python patches:

> +         (replace 'check
> +           (lambda* (#:key inputs outputs #:allow-other-keys)
> +             (add-installed-pythonpath inputs outputs)
> +             (invoke "pytest" "-vv")))

When a project contains tests as part of the application code, as in
Astropy, tests should run with "pytest --pyargs module". See Pytest
Integration Pratices:
https://docs.pytest.org/en/documentation-restructure/background/goodpractices.html

It's also good practice in Guix to use (when tests?) when overriding
the check phase to allow --without-tests=pkg.
  
> ImportError: You appear to be trying to import astropy from within a
> source checkout or from an editable installation without building the
> extension modules first. Either run:

I fixed this error by running the second command before the tests.

If you don't mind the modifications I did, I will call this patchset
complete and wait for a committer to review.

Vinicius

[-- Attachment #2: 0001-gnu-Add-python-astropy.patch --]
[-- Type: text/x-patch, Size: 2651 bytes --]

From d7245f0852a1a2f39bdba277b4287e2a753955a6 Mon Sep 17 00:00:00 2001
From: Sharlatan Hellseher <sharlatanus@gmail.com>
Date: Mon, 26 Apr 2021 20:52:09 +0100
Subject: [PATCH 1/6] gnu: Add python-astropy.

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

diff --git a/gnu/packages/astronomy.scm b/gnu/packages/astronomy.scm
index 6d1c4ddfe6..b32f3f7cf5 100644
--- a/gnu/packages/astronomy.scm
+++ b/gnu/packages/astronomy.scm
@@ -547,6 +547,54 @@ accurately in real time at any rate desired.")
      `(#:configure-flags '("-DENABLE_GTK=ON" "-DENABLE_QT=OFF")
        #:tests? #f))))
 
+(define-public python-astropy
+  (package
+    (name "python-astropy")
+    (version "4.2.1")
+    (source
+     (origin
+       (method url-fetch)
+       (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")))
+         ;; Permission denied: './astropy/_compiler.c'.
+         (add-before 'install 'writable-compiler
+           (lambda _ (make-file-writable "astropy/_compiler.c"))))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)
+       ("python-coverage" ,python-coverage)
+       ("python-cython" ,python-cython)
+       ("python-extension-helpers" ,python-extension-helpers)
+       ("python-ipython" ,python-ipython)
+       ("python-objgraph" ,python-objgraph)
+       ("python-setuptools-scm" ,python-setuptools-scm)
+       ("python-sgp4" ,python-sgp4)
+       ("python-skyfield" ,python-skyfield)))
+    (inputs
+     `(("cfitsio" ,cfitsio)
+       ("wcslib" ,wcslib)))
+    (propagated-inputs
+     `(("python-numpy" ,python-numpy)
+       ("python-pyerfa" ,python-pyerfa)))
+    (home-page "https://www.astropy.org/")
+    (synopsis "Core package for Astronomy in Python")
+    (description
+     "Astropy is a single core package for Astronomy in Python.  It contains
+much of the core functionality and some common tools needed for performing
+astronomy and astrophysics.")
+    (license (list license:bsd-3     ;astropy
+                   license:expat)))) ;jquery
+
 (define-public libnova
   (package
     (name "libnova")
-- 
2.31.1


[-- Attachment #3: 0002-gnu-python-pytest-astropy-Propagate-inputs.patch --]
[-- Type: text/x-patch, Size: 2582 bytes --]

From 7a119c602124c24555aacd0a39d634127e7b65d0 Mon Sep 17 00:00:00 2001
From: Vinicius Monego <monego@posteo.net>
Date: Sat, 22 May 2021 14:49:54 -0300
Subject: [PATCH 2/6] gnu: python-pytest-astropy: Propagate inputs.

* gnu/packages/python-check.scm (python-pytest-astropy)[arguments]: Add new
phase to skip a version check bug.
[native-inputs]: Remove python-pytest. Move python-attrs, python-hypothesis,
python-pytest-arraydiff, python-pytest-astropy-header, python-pytest-cov,
python-pytest-filter-subpackage, python-pytest-mock, python-pytest-openfiles,
python-pytest-remotedata ...
[propagated-inputs]: ... here.
---
 gnu/packages/python-check.scm | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/python-check.scm b/gnu/packages/python-check.scm
index f0b454eec9..b75d0fb155 100644
--- a/gnu/packages/python-check.scm
+++ b/gnu/packages/python-check.scm
@@ -286,12 +286,20 @@ Astropy project, but is optimized for use with astropy-related projects.")
         (base32 "18j6z6y2fvykmcs5z0mldhhaxxn6wzpnhlm2ps7m8r5z5kmh1631"))))
     (build-system python-build-system)
     (arguments
-     ;; No tests provided
-     '(#:tests? #f))
+     `(#:tests? #f ; there are no tests
+       #:phases
+       (modify-phases %standard-phases
+         ;; There is a bug somewhere that makes pytest-filter-subpackage appear
+         ;; as version 0.0.0 to setup.py.  Remove it from the requirements.
+         (add-after 'unpack 'remove-requirement
+           (lambda _
+             (substitute* "setup.cfg"
+               ((".*pytest-filter-subpackage.*") "")))))))
     (native-inputs
+     `(("python-setuptools-scm" ,python-setuptools-scm)))
+    (propagated-inputs
      `(("attrs" ,python-attrs)
        ("hypothesis" ,python-hypothesis)
-       ("pytest" ,python-pytest)
        ("pytest-arraydiff" ,python-pytest-arraydiff)
        ("pytest-astropy-header" ,python-pytest-astropy-header)
        ("pytest-cov" ,python-pytest-cov)
@@ -299,8 +307,7 @@ Astropy project, but is optimized for use with astropy-related projects.")
        ("pytest-filter-subpackage" ,python-pytest-filter-subpackage)
        ("pytest-mock" ,python-pytest-mock)
        ("pytest-openfiles" ,python-pytest-openfiles)
-       ("pytest-remotedata" ,python-pytest-remotedata)
-       ("setuptools-scm" ,python-setuptools-scm)))
+       ("pytest-remotedata" ,python-pytest-remotedata)))
     (home-page "https://github.com/astropy/pytest-astropy")
     (synopsis
      "Metapackage for all the testing machinery used by the Astropy Project")
-- 
2.31.1


[-- Attachment #4: 0003-gnu-python-pyerfa-Adjust-inputs.patch --]
[-- Type: text/x-patch, Size: 1062 bytes --]

From 256038d0d9eae6509d96bd370404f30a723715f0 Mon Sep 17 00:00:00 2001
From: Vinicius Monego <monego@posteo.net>
Date: Sat, 22 May 2021 14:58:15 -0300
Subject: [PATCH 3/6] gnu: python-pyerfa: Adjust inputs.

* gnu/packages/astronomy.scm (python-pyerfa)[inputs]: Move python-numpy to ...
[propagated-inputs]: ... here.
---
 gnu/packages/astronomy.scm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/astronomy.scm b/gnu/packages/astronomy.scm
index b32f3f7cf5..4c5c86a3dc 100644
--- a/gnu/packages/astronomy.scm
+++ b/gnu/packages/astronomy.scm
@@ -992,8 +992,9 @@ JPL ephemerides use to predict raw (x,y,z) planetary positions.")
        ("setuptools-scm" ,python-setuptools-scm)
        ("pytest-doctestplus" ,python-pytest-doctestplus)))
     (inputs
-     `(("liberfa" ,erfa)
-       ("numpy" ,python-numpy)))
+     `(("liberfa" ,erfa)))
+    (propagated-inputs
+     `(("numpy" ,python-numpy)))
     (home-page "https://github.com/liberfa/pyerfa")
     (synopsis "Python bindings for ERFA")
     (description
-- 
2.31.1


[-- Attachment #5: 0004-gnu-Add-wcslib-7.3.patch --]
[-- Type: text/x-patch, Size: 1116 bytes --]

From fda2610f09b0849645d17b906ade3c8fdc493cb5 Mon Sep 17 00:00:00 2001
From: Vinicius Monego <monego@posteo.net>
Date: Sat, 22 May 2021 15:14:59 -0300
Subject: [PATCH 4/6] gnu: Add wcslib-7.3.

* gnu/packages/astronomy.scm (wcslib-7.3): New variable.
---
 gnu/packages/astronomy.scm | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/gnu/packages/astronomy.scm b/gnu/packages/astronomy.scm
index 4c5c86a3dc..6e0fdeb969 100644
--- a/gnu/packages/astronomy.scm
+++ b/gnu/packages/astronomy.scm
@@ -205,6 +205,20 @@ coordinate systems in a @dfn{FITS} (Flexible Image Transport System) image
 header.")
     (license license:lgpl3+)))
 
+(define-public wcslib-7.3
+  (package
+    (inherit wcslib)
+    (name "wcslib")
+    (version "7.3")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (string-append
+             "ftp://ftp.atnf.csiro.au/pub/software/wcslib/wcslib-" version
+             ".tar.bz2"))
+       (sha256
+        (base32 "0q99k61l2zh6irzkd5195aama37mlm0nivamz6j6r8l2ad1cy0ab"))))))
+
 (define-public weightwatcher
   (package
     (name "weightwatcher")
-- 
2.31.1


[-- Attachment #6: 0005-gnu-python-astropy-Enable-tests.patch --]
[-- Type: text/x-patch, Size: 3754 bytes --]

From d226f4d8560d78da88ae9ebfdc48abf443b572e0 Mon Sep 17 00:00:00 2001
From: Vinicius Monego <monego@posteo.net>
Date: Sat, 22 May 2021 17:13:35 -0300
Subject: [PATCH 5/6] gnu: python-astropy: Enable tests.

* gnu/packages/astronomy.scm (python-astropy)[arguments]: Enable tests.
[phases]{setenv-astropy-system-all}: Move to after 'unpack. Rename to
'preparations'. Set HOME to /tmp. Allow xfail tests to pass.
{writable-compiler}: New phase.
{check}: Override phase.
[native-inputs]: Add python-pytest, python-pytest-astropy, python-pytest-xdist.
[inputs]: Remove wcslib. Add wcslib-7.3.
---
 gnu/packages/astronomy.scm | 37 ++++++++++++++++++++++++++++---------
 1 file changed, 28 insertions(+), 9 deletions(-)

diff --git a/gnu/packages/astronomy.scm b/gnu/packages/astronomy.scm
index 6e0fdeb969..d9785696bb 100644
--- a/gnu/packages/astronomy.scm
+++ b/gnu/packages/astronomy.scm
@@ -573,17 +573,31 @@ accurately in real time at any rate desired.")
         (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
+     `(#:phases
        (modify-phases %standard-phases
-         (add-before 'build 'setenv-astropy-system-all
+         (add-after 'unpack 'preparations
            (lambda _
-             (setenv "ASTROPY_USE_SYSTEM_ALL" "1")))
-         ;; Permission denied: './astropy/_compiler.c'.
+             ;; Use our own libraries in place of bundles.
+             (setenv "ASTROPY_USE_SYSTEM_ALL" "1")
+             ;; Some tests require a writable home.
+             (setenv "HOME" "/tmp")
+             ;; Relax xfail tests.
+             (substitute* "setup.cfg"
+               (("xfail_strict = true") "xfail_strict = false"))))
+         ;; This file is opened in both install and check phases.
          (add-before 'install 'writable-compiler
-           (lambda _ (make-file-writable "astropy/_compiler.c"))))))
+           (lambda _ (make-file-writable "astropy/_compiler.c")))
+         (add-before 'check 'writable-compiler
+           (lambda _ (make-file-writable "astropy/_compiler.c")))
+         (replace 'check
+           (lambda* (#:key inputs outputs tests? #:allow-other-keys)
+             (when tests?
+               (add-installed-pythonpath inputs outputs)
+               ;; Extensions have to be rebuilt before running the tests.
+               (invoke "python" "setup.py" "build_ext" "--inplace")
+               (invoke "python" "-m" "pytest" "--pyargs" "astropy"
+                       ;; Skip tests that need remote data.
+                       "-m" "not remote_data")))))))
     (native-inputs
      `(("pkg-config" ,pkg-config)
        ("python-coverage" ,python-coverage)
@@ -591,12 +605,17 @@ accurately in real time at any rate desired.")
        ("python-extension-helpers" ,python-extension-helpers)
        ("python-ipython" ,python-ipython)
        ("python-objgraph" ,python-objgraph)
+       ("python-pytest" ,python-pytest)
+       ("python-pytest-astropy" ,python-pytest-astropy)
+       ("python-pytest-xdist" ,python-pytest-xdist)
        ("python-setuptools-scm" ,python-setuptools-scm)
        ("python-sgp4" ,python-sgp4)
        ("python-skyfield" ,python-skyfield)))
     (inputs
      `(("cfitsio" ,cfitsio)
-       ("wcslib" ,wcslib)))
+       ;; Astropy 4.2.1 bundles wcslib 7.3 and that is the only version it
+       ;; accepts.  Version 7.5 will not be validated in the build.
+       ("wcslib" ,wcslib-7.3)))
     (propagated-inputs
      `(("python-numpy" ,python-numpy)
        ("python-pyerfa" ,python-pyerfa)))
-- 
2.31.1


[-- Attachment #7: 0006-gnu-python-astropy-Unbundle-ply-and-configobj.patch --]
[-- Type: text/x-patch, Size: 2737 bytes --]

From be70ce67532c8b5c14bebdf3a4c0ce483bc86530 Mon Sep 17 00:00:00 2001
From: Vinicius Monego <monego@posteo.net>
Date: Sat, 22 May 2021 15:09:37 -0300
Subject: [PATCH 6/6] gnu: python-astropy: Unbundle ply and configobj.

* gnu/packages/astronomy.scm (python-astropy)[arguments]: Replace references
to external ply and configobj and delete the bundles.
[propagated-inputs]: Add python-ply, python-configobj.
---
 gnu/packages/astronomy.scm | 24 ++++++++++++++++++++++--
 1 file changed, 22 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/astronomy.scm b/gnu/packages/astronomy.scm
index d9785696bb..17617eef9b 100644
--- a/gnu/packages/astronomy.scm
+++ b/gnu/packages/astronomy.scm
@@ -583,7 +583,25 @@ accurately in real time at any rate desired.")
              (setenv "HOME" "/tmp")
              ;; Relax xfail tests.
              (substitute* "setup.cfg"
-               (("xfail_strict = true") "xfail_strict = false"))))
+               (("xfail_strict = true") "xfail_strict = false"))
+             ;; Delete ply and configobj because we have them.  They are not
+             ;; covered by ASTROPY_USE_SYSTEM_ALL.
+             (with-directory-excursion "astropy/extern"
+               (for-each delete-file-recursively '("ply" "configobj")))
+             ;; Replace all references to external ply.
+             (let ((ply-files '("coordinates/angle_utilities.py"
+                                "units/format/cds.py"
+                                "units/format/ogip.py"
+                                "units/format/generic.py")))
+               (with-directory-excursion "astropy"
+                 (map (lambda (file)
+                        (substitute* file (("astropy.extern.ply")
+                                           "ply")))
+                      ply-files)))
+             ;; Replace reference to external configobj.
+             (with-directory-excursion "astropy/config"
+               (substitute* "configuration.py"
+                 (("from astropy.extern.configobj ") "")))             ))
          ;; This file is opened in both install and check phases.
          (add-before 'install 'writable-compiler
            (lambda _ (make-file-writable "astropy/_compiler.c")))
@@ -617,7 +635,9 @@ accurately in real time at any rate desired.")
        ;; accepts.  Version 7.5 will not be validated in the build.
        ("wcslib" ,wcslib-7.3)))
     (propagated-inputs
-     `(("python-numpy" ,python-numpy)
+     `(("python-configobj" ,python-configobj)
+       ("python-numpy" ,python-numpy)
+       ("python-ply" ,python-ply)
        ("python-pyerfa" ,python-pyerfa)))
     (home-page "https://www.astropy.org/")
     (synopsis "Core package for Astronomy in Python")
-- 
2.31.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [bug#48046] [PATCH]: Gnu add astropy
  2021-05-23 17:54     ` Vinicius Monego
@ 2021-05-23 20:01       ` Sharlatan Hellseher
  2021-10-29 21:35         ` Sharlatan Hellseher
  0 siblings, 1 reply; 12+ messages in thread
From: Sharlatan Hellseher @ 2021-05-23 20:01 UTC (permalink / raw)
  To: Vinicius Monego; +Cc: 48046

Hi Vinicius,

It' fantastic! Thanks for your feedback and modification, I'm
absolutely ok with them.

When astropy is accepted it will open a way for other astronomical
packages which are depend on it,
and I've noticed some other packages in master require astropy for
tests so it would beneficial to have it merged :)!

On Sun, 23 May 2021 at 17:54, Vinicius Monego <monego@posteo.net> wrote:
>
> Hi Sharlatan,
>
> Thanks for continuing the work on the astropy package, I managed to
> finish it this time. I am resending your patch with the following
> modifications:
>
> - Moved the package definition from the bottom to the middle of the
> file (to avoid merge conflicts)
> - Removed all optional inputs and propagated the remaining. I left only
> those listed in install_requires, setup_requires, test_requires and
> test[extras] in setup.cfg
> - Changed synopsis and description
> - Changed package labels to match the package name
> - Made the compiler file writable instead of deleting it
> - Deleted the makdir-astropy phase (it wasn't needed)
> - Added license for the jquery bundle that is not replaced
>
> and then I made my own improvements on that patch: enabling tests and
> unbundling some external libraries.
>
> I removed the optional packages because astropy is a core package,
> which will be a dependency for its many extensions. It's important that
> it builds with a high probability of success or the chain will break.
> Some of its optional dependencies, e.g. Pandas, have a broken build in
> aarch64 at the moment. The "full" astropy package could be installed
> easily from a manifest file and the tests can run again with
> astropy.test().
>
> > the project heavily depends on TOX which requires pip to install
> > missing dependencies for itself.
>
> I don't think that a project can heavily depend on tox, all it does is
> manage a virtual environment with dependencies to run the tests. Guix
> does the same so tox is redundant here. Tests will still run with the
> testing framework.
>
> Two more suggestions for future Python patches:
>
> > +         (replace 'check
> > +           (lambda* (#:key inputs outputs #:allow-other-keys)
> > +             (add-installed-pythonpath inputs outputs)
> > +             (invoke "pytest" "-vv")))
>
> When a project contains tests as part of the application code, as in
> Astropy, tests should run with "pytest --pyargs module". See Pytest
> Integration Pratices:
> https://docs.pytest.org/en/documentation-restructure/background/goodpractices.html
>
> It's also good practice in Guix to use (when tests?) when overriding
> the check phase to allow --without-tests=pkg.
>
> > ImportError: You appear to be trying to import astropy from within a
> > source checkout or from an editable installation without building the
> > extension modules first. Either run:
>
> I fixed this error by running the second command before the tests.
>
> If you don't mind the modifications I did, I will call this patchset
> complete and wait for a committer to review.
>
> Vinicius



-- 

… наш разум - превосходная объяснительная машина которая способна
найти смысл почти в чем угодно, истолковать любой феномен, но
совершенно не в состоянии принять мысль о непредсказуемости.




^ permalink raw reply	[flat|nested] 12+ messages in thread

* [bug#48046] [PATCH]: Gnu add astropy
  2021-05-23 20:01       ` Sharlatan Hellseher
@ 2021-10-29 21:35         ` Sharlatan Hellseher
  2021-10-29 22:58           ` Vinicius Monego
  0 siblings, 1 reply; 12+ messages in thread
From: Sharlatan Hellseher @ 2021-10-29 21:35 UTC (permalink / raw)
  To: 48046; +Cc: Vinicius Monego

Hi Guix team!

Is this set of patches still in review or just dromaint :)?

Regards

On Sun, 23 May 2021 at 21:01, Sharlatan Hellseher <sharlatanus@gmail.com> wrote:
>
> Hi Vinicius,
>
> It' fantastic! Thanks for your feedback and modification, I'm
> absolutely ok with them.
>
> When astropy is accepted it will open a way for other astronomical
> packages which are depend on it,
> and I've noticed some other packages in master require astropy for
> tests so it would beneficial to have it merged :)!
>
> On Sun, 23 May 2021 at 17:54, Vinicius Monego <monego@posteo.net> wrote:
> >
> > Hi Sharlatan,
> >
> > Thanks for continuing the work on the astropy package, I managed to
> > finish it this time. I am resending your patch with the following
> > modifications:
> >
> > - Moved the package definition from the bottom to the middle of the
> > file (to avoid merge conflicts)
> > - Removed all optional inputs and propagated the remaining. I left only
> > those listed in install_requires, setup_requires, test_requires and
> > test[extras] in setup.cfg
> > - Changed synopsis and description
> > - Changed package labels to match the package name
> > - Made the compiler file writable instead of deleting it
> > - Deleted the makdir-astropy phase (it wasn't needed)
> > - Added license for the jquery bundle that is not replaced
> >
> > and then I made my own improvements on that patch: enabling tests and
> > unbundling some external libraries.
> >
> > I removed the optional packages because astropy is a core package,
> > which will be a dependency for its many extensions. It's important that
> > it builds with a high probability of success or the chain will break.
> > Some of its optional dependencies, e.g. Pandas, have a broken build in
> > aarch64 at the moment. The "full" astropy package could be installed
> > easily from a manifest file and the tests can run again with
> > astropy.test().
> >
> > > the project heavily depends on TOX which requires pip to install
> > > missing dependencies for itself.
> >
> > I don't think that a project can heavily depend on tox, all it does is
> > manage a virtual environment with dependencies to run the tests. Guix
> > does the same so tox is redundant here. Tests will still run with the
> > testing framework.
> >
> > Two more suggestions for future Python patches:
> >
> > > +         (replace 'check
> > > +           (lambda* (#:key inputs outputs #:allow-other-keys)
> > > +             (add-installed-pythonpath inputs outputs)
> > > +             (invoke "pytest" "-vv")))
> >
> > When a project contains tests as part of the application code, as in
> > Astropy, tests should run with "pytest --pyargs module". See Pytest
> > Integration Pratices:
> > https://docs.pytest.org/en/documentation-restructure/background/goodpractices.html
> >
> > It's also good practice in Guix to use (when tests?) when overriding
> > the check phase to allow --without-tests=pkg.
> >
> > > ImportError: You appear to be trying to import astropy from within a
> > > source checkout or from an editable installation without building the
> > > extension modules first. Either run:
> >
> > I fixed this error by running the second command before the tests.
> >
> > If you don't mind the modifications I did, I will call this patchset
> > complete and wait for a committer to review.
> >
> > Vinicius
>
>
>
> --
>
> … наш разум - превосходная объяснительная машина которая способна
> найти смысл почти в чем угодно, истолковать любой феномен, но
> совершенно не в состоянии принять мысль о непредсказуемости.



-- 

… наш разум - превосходная объяснительная машина которая способна
найти смысл почти в чем угодно, истолковать любой феномен, но
совершенно не в состоянии принять мысль о непредсказуемости.




^ permalink raw reply	[flat|nested] 12+ messages in thread

* [bug#48046] [PATCH]: Gnu add astropy
  2021-10-29 21:35         ` Sharlatan Hellseher
@ 2021-10-29 22:58           ` Vinicius Monego
  0 siblings, 0 replies; 12+ messages in thread
From: Vinicius Monego @ 2021-10-29 22:58 UTC (permalink / raw)
  To: Sharlatan Hellseher, 48046

Hi Sharlatan,

I was looking at this series once again and there are some fixes I will
have to do in a resubmission.

The main problem right now is that astropy is tied to a specific wcs
version that it bundles. The code can't compile with the 7.5 version in
Guix. Astropy 4.2 comes with wcs 7.3 and 4.3 comes with wcs 7.6. I
tried to update wcs in guix to 7.6 but tests failed in this version.
Not sure what is the best approach in this, packaging a separate wcs at
7.3 and keep astropy at 4.2.1, or use the bundle.

Anyway, I'll submit this series again later.

Vinicius

Em sex, 2021-10-29 às 22:35 +0100, Sharlatan Hellseher escreveu:
> Hi Guix team!
> 
> Is this set of patches still in review or just dromaint :)?
> 
> Regards
> 
> On Sun, 23 May 2021 at 21:01, Sharlatan Hellseher
> <sharlatanus@gmail.com> wrote:
> > 
> > Hi Vinicius,
> > 
> > It' fantastic! Thanks for your feedback and modification, I'm
> > absolutely ok with them.
> > 
> > When astropy is accepted it will open a way for other astronomical
> > packages which are depend on it,
> > and I've noticed some other packages in master require astropy for
> > tests so it would beneficial to have it merged :)!
> > 
> > On Sun, 23 May 2021 at 17:54, Vinicius Monego <monego@posteo.net>
> > wrote:
> > > 
> > > Hi Sharlatan,
> > > 
> > > Thanks for continuing the work on the astropy package, I managed
> > > to
> > > finish it this time. I am resending your patch with the following
> > > modifications:
> > > 
> > > - Moved the package definition from the bottom to the middle of
> > > the
> > > file (to avoid merge conflicts)
> > > - Removed all optional inputs and propagated the remaining. I
> > > left only
> > > those listed in install_requires, setup_requires, test_requires
> > > and
> > > test[extras] in setup.cfg
> > > - Changed synopsis and description
> > > - Changed package labels to match the package name
> > > - Made the compiler file writable instead of deleting it
> > > - Deleted the makdir-astropy phase (it wasn't needed)
> > > - Added license for the jquery bundle that is not replaced
> > > 
> > > and then I made my own improvements on that patch: enabling tests
> > > and
> > > unbundling some external libraries.
> > > 
> > > I removed the optional packages because astropy is a core
> > > package,
> > > which will be a dependency for its many extensions. It's
> > > important that
> > > it builds with a high probability of success or the chain will
> > > break.
> > > Some of its optional dependencies, e.g. Pandas, have a broken
> > > build in
> > > aarch64 at the moment. The "full" astropy package could be
> > > installed
> > > easily from a manifest file and the tests can run again with
> > > astropy.test().
> > > 
> > > > the project heavily depends on TOX which requires pip to
> > > > install
> > > > missing dependencies for itself.
> > > 
> > > I don't think that a project can heavily depend on tox, all it
> > > does is
> > > manage a virtual environment with dependencies to run the tests.
> > > Guix
> > > does the same so tox is redundant here. Tests will still run with
> > > the
> > > testing framework.
> > > 
> > > Two more suggestions for future Python patches:
> > > 
> > > > +         (replace 'check
> > > > +           (lambda* (#:key inputs outputs #:allow-other-keys)
> > > > +             (add-installed-pythonpath inputs outputs)
> > > > +             (invoke "pytest" "-vv")))
> > > 
> > > When a project contains tests as part of the application code, as
> > > in
> > > Astropy, tests should run with "pytest --pyargs module". See
> > > Pytest
> > > Integration Pratices:
> > > https://docs.pytest.org/en/documentation-restructure/background/goodpractices.html
> > > 
> > > It's also good practice in Guix to use (when tests?) when
> > > overriding
> > > the check phase to allow --without-tests=pkg.
> > > 
> > > > ImportError: You appear to be trying to import astropy from
> > > > within a
> > > > source checkout or from an editable installation without
> > > > building the
> > > > extension modules first. Either run:
> > > 
> > > I fixed this error by running the second command before the
> > > tests.
> > > 
> > > If you don't mind the modifications I did, I will call this
> > > patchset
> > > complete and wait for a committer to review.
> > > 
> > > Vinicius
> > 
> > 
> > 
> > --
> > 
> > … наш разум - превосходная объяснительная машина которая способна
> > найти смысл почти в чем угодно, истолковать любой феномен, но
> > совершенно не в состоянии принять мысль о непредсказуемости.
> 
> 
> 






^ permalink raw reply	[flat|nested] 12+ messages in thread

* [bug#48046] [PATCH v2 0/3] Add Astropy.
  2021-04-26 20:01 [bug#48046] [PATCH]: Gnu add astropy Sharlatan Hellseher
  2021-05-19 18:16 ` Vinicius Monego
@ 2021-10-30  2:51 ` Vinicius Monego
  2021-10-30  2:51   ` [bug#48046] [PATCH v2 1/3] gnu: python-pytest-astropy: Adjust inputs Vinicius Monego
                     ` (3 more replies)
  1 sibling, 4 replies; 12+ messages in thread
From: Vinicius Monego @ 2021-10-30  2:51 UTC (permalink / raw)
  To: 48046; +Cc: Vinicius Monego

Changes in this series:

Merged astropy patches into one and added myself as co-author.
Moved unbundling code from phase to snippet.
Updated astropy to 4.3.1.
Added python-jplephem to native-inputs in astropy.
Removed wcs patch and used the wcs bundle from astropy.

Sharlatan Hellseher (1):
  gnu: Add python-astropy.

Vinicius Monego (2):
  gnu: python-pytest-astropy: Adjust inputs.
  gnu: python-pyerfa: Adjust inputs.

 gnu/packages/astronomy.scm    | 101 +++++++++++++++++++++++++++++++++-
 gnu/packages/python-check.scm |  17 ++++--
 2 files changed, 111 insertions(+), 7 deletions(-)


base-commit: e1261ddd38cf02a0f046f3a5360502d659b4e7d4
-- 
2.30.2





^ permalink raw reply	[flat|nested] 12+ messages in thread

* [bug#48046] [PATCH v2 1/3] gnu: python-pytest-astropy: Adjust inputs.
  2021-10-30  2:51 ` [bug#48046] [PATCH v2 0/3] Add Astropy Vinicius Monego
@ 2021-10-30  2:51   ` Vinicius Monego
  2021-10-30  2:51   ` [bug#48046] [PATCH v2 2/3] gnu: python-pyerfa: " Vinicius Monego
                     ` (2 subsequent siblings)
  3 siblings, 0 replies; 12+ messages in thread
From: Vinicius Monego @ 2021-10-30  2:51 UTC (permalink / raw)
  To: 48046; +Cc: Vinicius Monego

* gnu/packages/python-check.scm (python-pytest-astropy)[arguments]: Add new
phase to skip a version check bug.
[native-inputs]: Remove python-pytest. Move python-attrs, python-hypothesis,
python-pytest-arraydiff, python-pytest-astropy-header, python-pytest-cov,
python-pytest-filter-subpackage, python-pytest-mock, python-pytest-openfiles,
python-pytest-remotedata to ...
[propagated-inputs]: ... here.
---
 gnu/packages/python-check.scm | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/python-check.scm b/gnu/packages/python-check.scm
index a13bd0baa4..0cc0468d00 100644
--- a/gnu/packages/python-check.scm
+++ b/gnu/packages/python-check.scm
@@ -341,12 +341,20 @@ Astropy project, but is optimized for use with astropy-related projects.")
         (base32 "18j6z6y2fvykmcs5z0mldhhaxxn6wzpnhlm2ps7m8r5z5kmh1631"))))
     (build-system python-build-system)
     (arguments
-     ;; No tests provided
-     '(#:tests? #f))
+     `(#:tests? #f ; there are no tests
+       #:phases
+       (modify-phases %standard-phases
+         ;; There is a bug somewhere that makes pytest-filter-subpackage appear
+         ;; as version 0.0.0 to setup.py.  Remove it from the requirements.
+         (add-after 'unpack 'remove-requirement
+           (lambda _
+             (substitute* "setup.cfg"
+               ((".*pytest-filter-subpackage.*") "")))))))
     (native-inputs
+     `(("python-setuptools-scm" ,python-setuptools-scm)))
+    (propagated-inputs
      `(("attrs" ,python-attrs)
        ("hypothesis" ,python-hypothesis)
-       ("pytest" ,python-pytest)
        ("pytest-arraydiff" ,python-pytest-arraydiff)
        ("pytest-astropy-header" ,python-pytest-astropy-header)
        ("pytest-cov" ,python-pytest-cov)
@@ -354,8 +362,7 @@ Astropy project, but is optimized for use with astropy-related projects.")
        ("pytest-filter-subpackage" ,python-pytest-filter-subpackage)
        ("pytest-mock" ,python-pytest-mock)
        ("pytest-openfiles" ,python-pytest-openfiles)
-       ("pytest-remotedata" ,python-pytest-remotedata)
-       ("setuptools-scm" ,python-setuptools-scm)))
+       ("pytest-remotedata" ,python-pytest-remotedata)))
     (home-page "https://github.com/astropy/pytest-astropy")
     (synopsis
      "Metapackage for all the testing machinery used by the Astropy Project")
-- 
2.30.2





^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [bug#48046] [PATCH v2 2/3] gnu: python-pyerfa: Adjust inputs.
  2021-10-30  2:51 ` [bug#48046] [PATCH v2 0/3] Add Astropy Vinicius Monego
  2021-10-30  2:51   ` [bug#48046] [PATCH v2 1/3] gnu: python-pytest-astropy: Adjust inputs Vinicius Monego
@ 2021-10-30  2:51   ` Vinicius Monego
  2021-10-30  2:51   ` [bug#48046] [PATCH v2 3/3] gnu: Add python-astropy Vinicius Monego
  2021-11-08  8:06   ` bug#48046: [PATCH v2 0/3] Add Astropy Efraim Flashner
  3 siblings, 0 replies; 12+ messages in thread
From: Vinicius Monego @ 2021-10-30  2:51 UTC (permalink / raw)
  To: 48046; +Cc: Vinicius Monego

* gnu/packages/astronomy.scm (python-pyerfa)[inputs]: Move python-numpy to ...
[propagated-inputs]: ... here.
---
 gnu/packages/astronomy.scm | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/gnu/packages/astronomy.scm b/gnu/packages/astronomy.scm
index 1fb6f5a38b..95846749af 100644
--- a/gnu/packages/astronomy.scm
+++ b/gnu/packages/astronomy.scm
@@ -6,6 +6,7 @@
 ;;; Copyright © 2020 R Veera Kumar <vkor@vkten.in>
 ;;; Copyright © 2020, 2021 Guillaume Le Vaillant <glv@posteo.net>
 ;;; Copyright © 2021 Sharlatan Hellseher <sharlatanus@gmail.com>
+;;; Copyright © 2021 Vinicius Monego <monego@posteo.net>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1009,8 +1010,9 @@ JPL ephemerides use to predict raw (x,y,z) planetary positions.")
        ("setuptools-scm" ,python-setuptools-scm)
        ("pytest-doctestplus" ,python-pytest-doctestplus)))
     (inputs
-     `(("liberfa" ,erfa)
-       ("numpy" ,python-numpy)))
+     `(("liberfa" ,erfa)))
+    (propagated-inputs
+     `(("numpy" ,python-numpy)))
     (home-page "https://github.com/liberfa/pyerfa")
     (synopsis "Python bindings for ERFA")
     (description
-- 
2.30.2





^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [bug#48046] [PATCH v2 3/3] gnu: Add python-astropy.
  2021-10-30  2:51 ` [bug#48046] [PATCH v2 0/3] Add Astropy Vinicius Monego
  2021-10-30  2:51   ` [bug#48046] [PATCH v2 1/3] gnu: python-pytest-astropy: Adjust inputs Vinicius Monego
  2021-10-30  2:51   ` [bug#48046] [PATCH v2 2/3] gnu: python-pyerfa: " Vinicius Monego
@ 2021-10-30  2:51   ` Vinicius Monego
  2021-11-08  8:06   ` bug#48046: [PATCH v2 0/3] Add Astropy Efraim Flashner
  3 siblings, 0 replies; 12+ messages in thread
From: Vinicius Monego @ 2021-10-30  2:51 UTC (permalink / raw)
  To: 48046; +Cc: Sharlatan Hellseher

From: Sharlatan Hellseher <sharlatanus@gmail.com>

This patch was co-authored with Vinicius Monego.

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

diff --git a/gnu/packages/astronomy.scm b/gnu/packages/astronomy.scm
index 95846749af..ec48c787e3 100644
--- a/gnu/packages/astronomy.scm
+++ b/gnu/packages/astronomy.scm
@@ -57,6 +57,7 @@
   #: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)
@@ -613,6 +614,100 @@ accurately in real time at any rate desired.")
      `(#:configure-flags '("-DENABLE_GTK=ON" "-DENABLE_QT=OFF")
        #:tests? #f))))
 
+(define-public python-astropy
+  (package
+    (name "python-astropy")
+    (version "4.3.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "astropy" version))
+       (sha256
+        (base32 "0lfd6n7v7kas4wvacddnwgccax3ks908735dzilg7dsf7ci52f9d"))
+       (modules '((guix build utils)))
+       (snippet
+        '(begin
+           ;; Remove Python bundles.
+           (with-directory-excursion "astropy/extern"
+             (for-each delete-file-recursively '("ply" "configobj")))
+           ;; Remove cextern bundles and leave the wcslib bundle.  Astropy
+           ;; upgrades to different versions of wcslib every few releases
+           ;; and tests break every upgrade.
+           ;; TODO: unbundle wcslib.
+           (with-directory-excursion "cextern"
+             (for-each delete-file-recursively '("cfitsio" "expat")))
+           #t))))
+    (build-system python-build-system)
+    (arguments
+     `(#:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'preparations
+           (lambda _
+             ;; Use our own libraries in place of bundles, with the
+             ;; exception of wcslib.
+             (setenv "ASTROPY_USE_SYSTEM_CFITSIO" "1")
+             (setenv "ASTROPY_USE_SYSTEM_EXPAT" "1")
+             ;; Some tests require a writable home.
+             (setenv "HOME" "/tmp")
+             ;; Relax xfail tests.
+             (substitute* "setup.cfg"
+               (("xfail_strict = true") "xfail_strict = false"))
+             ;; Replace all references to external ply.
+             (let ((ply-files '("coordinates/angle_formats.py"
+                                "utils/parsing.py")))
+               (with-directory-excursion "astropy"
+                 (map (lambda (file)
+                        (substitute* file (("astropy.extern.ply")
+                                           "ply")))
+                      ply-files)))
+             ;; Replace reference to external configobj.
+             (with-directory-excursion "astropy/config"
+               (substitute* "configuration.py"
+                 (("from astropy.extern.configobj ") "")))))
+         ;; This file is opened in both install and check phases.
+         (add-before 'install 'writable-compiler
+           (lambda _ (make-file-writable "astropy/_compiler.c")))
+         (add-before 'check 'writable-compiler
+           (lambda _ (make-file-writable "astropy/_compiler.c")))
+         (replace 'check
+           (lambda* (#:key inputs outputs tests? #:allow-other-keys)
+             (when tests?
+               (add-installed-pythonpath inputs outputs)
+               ;; Extensions have to be rebuilt before running the tests.
+               (invoke "python" "setup.py" "build_ext" "--inplace")
+               (invoke "python" "-m" "pytest" "--pyargs" "astropy"
+                       ;; Skip tests that need remote data.
+                       "-m" "not remote_data")))))))
+    (native-inputs
+     `(("pkg-config" ,pkg-config)
+       ("python-coverage" ,python-coverage)
+       ("python-cython" ,python-cython)
+       ("python-extension-helpers" ,python-extension-helpers)
+       ("python-ipython" ,python-ipython)
+       ("python-jplephem" ,python-jplephem)
+       ("python-objgraph" ,python-objgraph)
+       ("python-pytest" ,python-pytest)
+       ("python-pytest-astropy" ,python-pytest-astropy)
+       ("python-pytest-xdist" ,python-pytest-xdist)
+       ("python-setuptools-scm" ,python-setuptools-scm)
+       ("python-sgp4" ,python-sgp4)
+       ("python-skyfield" ,python-skyfield)))
+    (inputs
+     `(("cfitsio" ,cfitsio)
+       ("expat" ,expat)))
+    (propagated-inputs
+     `(("python-configobj" ,python-configobj)
+       ("python-numpy" ,python-numpy)
+       ("python-ply" ,python-ply)
+       ("python-pyerfa" ,python-pyerfa)))
+    (home-page "https://www.astropy.org/")
+    (synopsis "Core package for Astronomy in Python")
+    (description
+     "Astropy is a single core package for Astronomy in Python.  It contains
+much of the core functionality and some common tools needed for performing
+astronomy and astrophysics.")
+    (license license:bsd-3)))
+
 (define-public libnova
   (package
     (name "libnova")
-- 
2.30.2





^ permalink raw reply related	[flat|nested] 12+ messages in thread

* bug#48046: [PATCH v2 0/3] Add Astropy.
  2021-10-30  2:51 ` [bug#48046] [PATCH v2 0/3] Add Astropy Vinicius Monego
                     ` (2 preceding siblings ...)
  2021-10-30  2:51   ` [bug#48046] [PATCH v2 3/3] gnu: Add python-astropy Vinicius Monego
@ 2021-11-08  8:06   ` Efraim Flashner
  3 siblings, 0 replies; 12+ messages in thread
From: Efraim Flashner @ 2021-11-08  8:06 UTC (permalink / raw)
  To: 48046-done

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

Thanks for finishing this up. Patches pushed.

-- 
Efraim Flashner   <efraim@flashner.co.il>   רנשלפ םירפא
GPG key = A28B F40C 3E55 1372 662D  14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2021-11-08  8:11 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-26 20:01 [bug#48046] [PATCH]: Gnu add astropy Sharlatan Hellseher
2021-05-19 18:16 ` Vinicius Monego
2021-05-22 20:00   ` Sharlatan Hellseher
2021-05-23 17:54     ` Vinicius Monego
2021-05-23 20:01       ` Sharlatan Hellseher
2021-10-29 21:35         ` Sharlatan Hellseher
2021-10-29 22:58           ` Vinicius Monego
2021-10-30  2:51 ` [bug#48046] [PATCH v2 0/3] Add Astropy Vinicius Monego
2021-10-30  2:51   ` [bug#48046] [PATCH v2 1/3] gnu: python-pytest-astropy: Adjust inputs Vinicius Monego
2021-10-30  2:51   ` [bug#48046] [PATCH v2 2/3] gnu: python-pyerfa: " Vinicius Monego
2021-10-30  2:51   ` [bug#48046] [PATCH v2 3/3] gnu: Add python-astropy Vinicius Monego
2021-11-08  8:06   ` bug#48046: [PATCH v2 0/3] Add Astropy Efraim Flashner

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).