Skip to content

A roadmap for package infrastructure without astropy-helpers #52

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 19 commits into from
Dec 12, 2019

Conversation

astrofrog
Copy link
Member

@astrofrog astrofrog commented Mar 7, 2019

This is an APE describing a roadmap for transitioning away from astropy-helpers in favor of more standardize tools in the Python ecosystem. The short version is that:

  • Pure-Python packages that use astropy-helpers currently can already be refactored to not rely on astropy-helpers, and in fact several packages have already done so (see links in the implementation section).

  • Packages with C extensions can start to make some of the changes here but should wait a little before making the more significant changes related in particular to build-time dependencies since they require a recent version of pip (19.0 or later) - but we wanted to start the discussion now to start planning the changes.

A fraction of astropy-helpers would continue to exist as a more general extension-helpers package specifically geared towards packages with compiled extensions, and this could be used outside the astropy project, and would no longer be included as a sub-module.

Even though we can't make some of these changes in the core package yet, we wanted to start the discussion now so as to be able to make sure there are no issues in the current Python packaging ecosystem that would prevent these changes.

This is just a draft at this point, and we welcome detailed comments! If some points prove to be controversial, we'll try and set up a call so that we can discuss things and see if we can reach a consensus! Please also say if any aspects of this is confusing - some of us have spent far too much time thinking about this, and there may be some points that could be explained better.

@astrofrog astrofrog force-pushed the ape-astropy-helpers branch from 20b4930 to ecb943c Compare March 7, 2019 18:18
Copy link
Member

@nabobalis nabobalis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In favour of these changes and we have started on the SunPy side.

APE17.rst Outdated
such as the core astropy package which have all their tags on branches (at least
in recent years), we will need to add a ‘developer’ tag on ``master`` straight
after branching, e.g. after creating a ``v4.0.x`` branch we should tag the next
commit on ``master`` as ``v4.1.dev``.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This example is quite confusing, probably more helpful if only have the pointer to the docs.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like this should be noted somewhere, though, or it will be forgotten in the future. Maybe part of release instructions?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It also seems a bit problematic because it means affiliated packages would have to start doing this. And many affiliated packages do not have standardized release procedures/instructions...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No I don't think affiliated packages would need to do this. This issue only occurs for packages that have a workflow where they tag releases in branches, but in my experience most affiliated packages don't do release branches.

Copy link
Member Author

@astrofrog astrofrog Jul 29, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should leave this in the APE - the APE is not documentation but just a technical document for the project, and I think it's important to note this here. But I've added a sentence that says

In any case, the documentation about how to release the core package as well astropy-affiliated packages will need to be updated to reflect the use of setuptools_scm.

and I've added links to the pages that need to be updated.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are including instructions about how to use setuptools_scm with release branches in an upcoming packaging guide.

Copy link
Member

@mwcraig mwcraig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm looking forward to this. Being able to test by subpackage would be very helpful.

APE17.rst Outdated
such as the core astropy package which have all their tags on branches (at least
in recent years), we will need to add a ‘developer’ tag on ``master`` straight
after branching, e.g. after creating a ``v4.0.x`` branch we should tag the next
commit on ``master`` as ``v4.1.dev``.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like this should be noted somewhere, though, or it will be forgotten in the future. Maybe part of release instructions?

Copy link
Member

@larrybradley larrybradley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is great!

@olebole
Copy link
Member

olebole commented Mar 8, 2019

+1 since it simplifies packaging.

@hamogu
Copy link
Member

hamogu commented Mar 8, 2019

+1 I also note that of the 400 packages that use astropy-helpers, I'm probably responsible for 8, only 2 of which are active and one 1 of which is not pure-python. (I'll try to remember to delete experiemental remaining packages from github ...)

@mhvk
Copy link
Contributor

mhvk commented Mar 9, 2019

Another 👍 though like @bsipocz I use ./setup.py test -P <module> a lot (also for my own package), and like that it does the docs as well; I also use --remote-data somewhat regularly.

Copy link
Member

@pllim pllim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am very supportive of this! Long term yield is positive.

Note that we also have to update the dev docs for the project to go with this.

APE17.rst Outdated
Astropy-helpers provides a way for developers to use ``setup_package.py`` files
throughout a package to define extensions and definitions for external
libraries. This is one of the only parts of astropy-helpers which we think it
makes sense to preserve, and we argue that it is so general that it should be
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it though? Won't defining package data and so on be clearer if they all happen in the root level at setup.cfg or something? There should be only one obvious way to do things?

| submodule | |
+-------------------------------------+-------------------------------------+

We propose that a new package called extension-helpers be created starting from
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not convinced yet another package is necessary. Instead, we can show them how things should be done "natively" over at template?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite understand how this would work as @pllim is proposing. Then wouldn't we have to push updates to all users of this stuff if e.g. we need to update the OpenMP stuff?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our draft packaging guide shows both how to define extensions natively for simple cases and with extension-helpers:

https://oa-packaging-guide-preview.readthedocs.io/en/latest/extensions.html

For astropy, it's definitely the case that we have enough extensions that using extension-helpers would be a lot simpler than defining everything in the setup.py file, and the auto-detection of cython files is also a nice feature.

@pllim - are you satisfied with this or do you have specific wording recommendations for the APE?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think for packages that have one or two C extensions might not need to use extension_helpers as the standard ways of registering extensions would be sufficient. Certainly for core I think extensions_helpers would simplify things enough to warrant it's existence.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay. I think I understand now. Thanks!

@astrofrog astrofrog force-pushed the ape-astropy-helpers branch from 5bde343 to c53050c Compare July 29, 2019 18:45
@eteq
Copy link
Member

eteq commented Dec 11, 2019

Following some discussions at the Astropy Coordination Meeting (mostly with @astrofrog and myself), I've identified a few things to add to this APE (or possibly say "out of scope for the APE, but should do in the implementation stage"):

  1. We should commit to a "migration guide" for users of the existing helpers to switch to the new scheme. Tentatively it would be generated based on the Astropy core experience, and would be "released" once the process is done in the core.
  2. We should state a deadline we're aiming for to end support for the "old" astropy-helpers. 2 years (i.e. Astropy LTS 5.0) might be a good deadline. Dependent on the "migration guide" being done and demonstrated successful (i.e., "used" by some affiliated or coordinated package)
  3. Relatedly, we should be sure the package template is up to date and at least as usable (maybe more, with these changes!) before we can declare victory on the transition. (which I think is implicit in the current text, but perhaps should be explicit)

@astrofrog
Copy link
Member Author

@eteq - I think the following section should now address all your points:

https://github.com/astropy/astropy-APEs/blob/7f2b4dabb9386a47697e0e4a0da5499804e75386/APE17.rst#timeline-for-changes

Please check whenever you can and confirm whether you agree!

@taldcroft
Copy link
Member

The new Timeline for changes section looks fine to me, so approving this. In the second paragraph there are a few instances of the word "should" that might be changed to "shall" or "will" (e.g. " the migration guide should be advertised widely to all maintainers") to convey a more definitive requirement, but there is no doubt that these things will happen so this change is optional to me.

Copy link
Member

@eteq eteq left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Big picture, I understand the necessity and am happy with the changes that have addressed my concerns. I have several inline suggestions for clarity/to record side-channel conversation items, but I think they're all pretty straightforward.

APE17.rst Outdated
<http://docs.astropy.org/en/stable/development/releasing.html>`_ as well as
`packages using the astropy package template
<http://docs.astropy.org/en/stable/development/astropy-package-template.html#releasing-a-python-package>`_
will need to be updated to reflect the use of setuptools_scm.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the template needs to be updated for quite a bit more than just setuptools_scm, right? That probably should be stated explicitly as a mandatory part of the process.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it's in the "timeline" section, although it's not clear exactly what makes this special, then?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is under the "Version Helpers" section, and is describing things which reference the old version stuff that would need adjusting for the new version stuff.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 7695c58

| submodule | |
+-------------------------------------+-------------------------------------+

We propose that a new package called extension-helpers be created starting from
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't quite understand how this would work as @pllim is proposing. Then wouldn't we have to push updates to all users of this stuff if e.g. we need to update the OpenMP stuff?

Impact for users
----------------

If done properly, these changes should have no noticeable impact for users.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed in the coordination meeting, the one thing it will do is make it so that releases no longer contain c files. I'm OK with that, but it should be noted here so we're sure we all understand.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is the right section for that. I wouldn't consider someone who cares if the tarball contains pre-generated or auto-generated C files our regular user. I am also pretty sure we mention it further down the document.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is elaborated upon in this section.

APE17.rst Outdated
Alternatives
------------

In the words of Stuart: *Do nothing, suffer submodules and maintaining the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's worth stating that pip will probably eventually break the helpers (if that's true?). That's a stronger "status quo won't work"/there are no alternatives argument.

will be encouraged to have `tox`_ installed if they want to easily run
tests or build documentation locally. However, this is an easy package to
install with `pip`_ and we could also add code in ``setup.py`` so that running
``python setup.py test`` or ``python setup.py build_docs`` gives a helpful
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it worth pointing out that we can potentially keep these commands, if they translate into tox or pytest commands?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a note to this effect in the "alternatives" section.

Copy link
Member

@hamogu hamogu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hope this is accepted soon as I'm really looking forward to remove sub-modules!

@kelle kelle self-requested a review December 12, 2019 16:24
Copy link
Member

@bsipocz bsipocz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My concerns about the test runner features got addressed.

@eteq
Copy link
Member

eteq commented Dec 12, 2019

Thanks for addressing all my last bits there, @Cadair. And thanks to @astrofrog and @Cadair for all their hard work on this.

Or as @Cadair would say: burn it all

@eteq
Copy link
Member

eteq commented Dec 12, 2019

This APE has been accepted following unanimous approval at the 2019 coordination meeting.

@eteq eteq merged commit d2c68ba into astropy:master Dec 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.