diff mbox series

[bug#48046] : Gnu add astropy

Message ID 7055d87cdde449415e62f0b0c15d96deb378af67.camel@posteo.net
State Accepted
Headers show
Series [bug#48046] : Gnu add astropy | expand

Checks

Context Check Description
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Vinicius Monego May 23, 2021, 5:54 p.m. UTC
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

Comments

Sharlatan Hellseher May 23, 2021, 8:01 p.m. UTC | #1
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
Sharlatan Hellseher Oct. 29, 2021, 9:35 p.m. UTC | #2
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
>
>
>
> --
>
> … наш разум - превосходная объяснительная машина которая способна
> найти смысл почти в чем угодно, истолковать любой феномен, но
> совершенно не в состоянии принять мысль о непредсказуемости.
Vinicius Monego Oct. 29, 2021, 10:58 p.m. UTC | #3
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
> > 
> > 
> > 
> > --
> > 
> > … наш разум - превосходная объяснительная машина которая способна
> > найти смысл почти в чем угодно, истолковать любой феномен, но
> > совершенно не в состоянии принять мысль о непредсказуемости.
> 
> 
>
diff mbox series

Patch

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