Skip to content

DEP: redefine dev[_all] extras as PEP 735 Dependency Groups - #18342

Merged
neutrinoceros merged 1 commit into
astropy:mainfrom
neutrinoceros:dep/pep735/define-groups
Apr 25, 2026
Merged

neutrinoceros merged 1 commit into
astropy:mainfrom
neutrinoceros:dep/pep735/define-groups

Conversation

@neutrinoceros

@neutrinoceros neutrinoceros commented Jun 25, 2025 •

Copy link
Copy Markdown
Contributor

Description

This is a first stab at #17623, implementing dependency groups to eventually (but not yet) replace our dev-only extra sets of optional dependencies, and use them internally where it makes sense.
This PR is 100% backwards compatible, since it doesn't remove any extras (which are user visible), and instead defines (user-invisible) dependency groups as mirrors.
Not every extra I'm mirrorin here is intended to be fully dropped in the future (for instance, we may still want to deliberatly expose astropy[test] as an install target), but I expect at least part of them would be uncontroversial (I don't know who needs astropy[docs] or astropy[typing] downstream).

  • By checking this box, the PR author has requested that maintainers do NOT use the "Squash and Merge" button. Maintainers should respect this when possible; however, the final decision is at the discretion of the maintainer that merges the PR.

@neutrinoceros neutrinoceros added this to the v7.2.0 milestone Jun 25, 2025
@neutrinoceros neutrinoceros added testing no-changelog-entry-needed dependencies Pull requests that update a dependency file labels Jun 25, 2025
@github-actions

Copy link
Copy Markdown
Contributor

Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.

  • Do the proposed changes actually accomplish desired goals?
  • Do the proposed changes follow the Astropy coding guidelines?
  • Are tests added/updated as required? If so, do they follow the Astropy testing guidelines?
  • Are docs added/updated as required? If so, do they follow the Astropy documentation guidelines?
  • Is rebase and/or squash necessary? If so, please provide the author with appropriate instructions. Also see instructions for rebase and squash.
  • Did the CI pass? If no, are the failures related? If you need to run daily and weekly cron jobs as part of the PR, please apply the "Extra CI" label. Codestyle issues can be fixed by the bot.
  • Is a change log needed? If yes, did the change log check pass? If no, add the "no-changelog-entry-needed" label. If this is a manual backport, use the "skip-changelog-checks" label unless special changelog handling is necessary.
  • Is this a big PR that makes a "What's new?" entry worthwhile and if so, is (1) a "what's new" entry included in this PR and (2) the "whatsnew-needed" label applied?
  • At the time of adding the milestone, if the milestone set requires a backport to release branch(es), apply the appropriate "backport-X.Y.x" label(s) before merge.

@github-actions

Copy link
Copy Markdown
Contributor

👋 Thank you for your draft pull request! Do you know that you can use [ci skip] or [skip ci] in your commit messages to skip running continuous integration tests until you are ready?

@neutrinoceros neutrinoceros added the Build all wheels Run all the wheel builds rather than just a selection label Jun 25, 2025
@neutrinoceros
neutrinoceros force-pushed the dep/pep735/define-groups branch from ccbdff5 to 249e0ac Compare June 25, 2025 10:59
Comment thread pyproject.toml Outdated
docs = [
"astropy[docs]",
]
# this is duplicated to avoid self-references in oldestdeps (astropy itself can't have a lower bound)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

discovered this limitation while working on this. It'd probably be labelled as an upstream bug so I'll take my chances and report it upstream later.

@astrofrog

Copy link
Copy Markdown
Member

Could you explain what the benefits are of using dependency groups here compared to extras?

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

providing a clearer separation between

  • optional dependencies for end-users and downstream packages (this is the purpose of extras)
  • dev-only dependencies that were never really meant to be consumed downstream (but were exposed anyway because extras was all we had in the standard)

@astrofrog

astrofrog commented Jun 25, 2025 •

Copy link
Copy Markdown
Member

Ah I see, so would you plan to deprecate astropy[test]?

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

This one I don't think so, but astropy[dev], yes

@astrofrog

Copy link
Copy Markdown
Member

Ok cool, if we don't plan to deprecate test, maybe we should avoid redefining it since anyway for now it requires repeating everything?

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

I'll touch base with uv folks first. It shouldn't be necessary to duplicate metadata

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

Actually, I tried to reproduce the problem with self-referential groups + --resolution=lowest-direct in uv and got no problem, as long as I include the following bit in pyproject.toml (and which uv helpfully writes automatically if you use uv add to declare dependencies)

[tool.uv.sources]
astropy = { workspace = true }

Now I'm thinking the problem might be with tox or tox-uv loosing track of pyproject.toml at some point, so I'll need to report there.

@astrofrog astrofrog left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I have to say I'm not really sold on using dependency groups - they are the shiny new thing, but I think here more than ever, 'if it ain't broke, don't fix it'. I don't think it really makes sense to have extras and dependency groups living in parallel, and I would oppose removing extras like test and docs. I spend a lot of my time typing e.g.:

pip install .[test]

and

pip install .[docs]

in packages including astropy core and the dependency group command looks like it will be a pain to type. This is just my opinion though, but just wanted it to be on the record 😅

Comment thread .devcontainer/welcome-message.txt Outdated

pip install -e .[all,test_all,docs]
pip install -U pip
pip install -e . --group test_all --group docs

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think that is a net negative from a developer point of view - I use pip install .[...] all the time and now there is going to be more to type

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

Any extras you would not oppose to removing ?

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

In hindsight I agree there's not much point to have both a test extra and a test group if we're not going to deprecate/remove the extra later. I would still like to move some dependency away from user-facing extras if possible, the question is, are there any extras that are not controversial to deprecate or remove ?

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

regarding the amount of typing required, and as a purely informative note: if you don't mind pulling in all dependencies, there's uv sync --all-groups (also uv sync --all-extras)

@pllim

pllim commented Jul 2, 2025

Copy link
Copy Markdown
Member

are there any extras that are not controversial to deprecate or remove ?

There were all added for a reason, so probably not, at least not without a lot of opinions involved...

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

For dev-only extras, I'm assuming the reason was that no equally convenient way existed to define them without exposing them. In other words, I think they were probably exposed as a side effect rather than intentionally. Maybe I'm wrong about it. And even if I'm not, it could be argued that it's too late to put the genie back in the bottle, but I'm not there yet.

@pllim

pllim commented Jul 3, 2025

Copy link
Copy Markdown
Member

dev-only extras

dev and dev_all were added by @nstarman in #16340 . Maybe he remembers why. I never use those.

@nstarman

nstarman commented Jul 3, 2025 •

Copy link
Copy Markdown
Member

For dev-only extras, I'm assuming the reason was that no equally convenient way existed to define them without exposing them

Yes.
IMO fine to move.

@neutrinoceros
neutrinoceros force-pushed the dep/pep735/define-groups branch from 2819a6a to 849db46 Compare July 9, 2025 13:48
@neutrinoceros neutrinoceros changed the title DEP: re-define historical 'extras' as PEP 735 dependency groups (backward compatible) DEP: redefine dev[_all] extras as PEP 723 Dependency Groups Jul 9, 2025
@neutrinoceros

Copy link
Copy Markdown
Contributor Author

Ok, reduced the scope of this PR to dev and dev_all extras, which hopefully is much less controversial. This should now be ready for review. Further discussions on whether more extras should be moved or not should happen on #17623

@neutrinoceros
neutrinoceros marked this pull request as ready for review July 9, 2025 13:49
@pllim

pllim commented Jan 7, 2026

Copy link
Copy Markdown
Member

Please rebase. Thanks!

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

I already did this very morning. Is it still needed ?

@pllim

pllim commented Jan 7, 2026

Copy link
Copy Markdown
Member

Says outdated again and one job failing, so might as well?

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

Let's try re-running first.

@pllim

pllim commented Jan 7, 2026

Copy link
Copy Markdown
Member

@taldcroft , do you want to re-review?

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

This was on today's agenda but I think we somehow forgot to go over it...

@taldcroft

Copy link
Copy Markdown
Member

Overall I don't want to stand in the way of progress. But I'll note one more thing, which is that pip seems to treat a missing extras dependency as a warning not an error. So when people continue to run pip install -e ".[dev-all]" after this is merged, the command appears to run to completion but there is a warning embedded:

WARNING: astropy 8.0.0.dev233+g8ec2d1840 does not provide the extra 'dev-all'

This could be easy to miss, but even if it is spotted this will cause confusion for anyone not following this PR.

ACTION: when this is merged, we need to send notice to the astropy-dev email group and astropy slack (probably #general) with information about the change. We need to do this right away since this applies immediately, not with a release.

@taldcroft
taldcroft self-requested a review January 10, 2026 10:57
@neutrinoceros
neutrinoceros force-pushed the dep/pep735/define-groups branch from e34fc8e to 5fce251 Compare February 3, 2026 21:25
@pllim

pllim commented Feb 3, 2026

Copy link
Copy Markdown
Member

@neutrinoceros
neutrinoceros force-pushed the dep/pep735/define-groups branch from 5fce251 to 2a00f6e Compare February 4, 2026 11:11
@neutrinoceros

Copy link
Copy Markdown
Contributor Author

Thanks for reminding me, I lost track of this PR's state so it seems. I think I've addressed any lingering comments now !

@pllim

pllim commented Feb 4, 2026

Copy link
Copy Markdown
Member

@taldcroft are you able to do a final review to ensure your remaining concern is truly addressed to your liking?

Thanks, all!

@neutrinoceros
neutrinoceros force-pushed the dep/pep735/define-groups branch from 2a00f6e to e03618e Compare March 14, 2026 18:29
@neutrinoceros

Copy link
Copy Markdown
Contributor Author

@pllim @taldcroft I just rebased this to resolve merge conflicts. The diff is now mostly from the indirect changes in the resolved lowest tree, but this might bitrot more quickly as a result.

@neutrinoceros
neutrinoceros marked this pull request as draft March 14, 2026 18:33
@neutrinoceros
neutrinoceros force-pushed the dep/pep735/define-groups branch from e03618e to 24f5fc2 Compare March 14, 2026 18:38
@neutrinoceros

Copy link
Copy Markdown
Contributor Author

failures are unrelated, and also seen on main. I'll inquire there (probably not earlier than tomorrow though), but this can be undrafted in the mean time.

@neutrinoceros
neutrinoceros marked this pull request as ready for review March 14, 2026 19:04
@neutrinoceros
neutrinoceros force-pushed the dep/pep735/define-groups branch from 24f5fc2 to 3f756bb Compare April 25, 2026 07:21
@neutrinoceros

Copy link
Copy Markdown
Contributor Author

@astrofrog this has one approval already, and would be much better as part of a major release. Can we merge this for 8.0.0 ?

@astrofrog astrofrog left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I’m ok with this though as @taldcroft pointed out we should advertise on astropy-dev. We should also add a what's new entry for 8.0, could you add this here? (But I don't need to rereview)

@neutrinoceros
neutrinoceros force-pushed the dep/pep735/define-groups branch from 3f756bb to 2f95023 Compare April 25, 2026 09:23
@neutrinoceros
neutrinoceros enabled auto-merge April 25, 2026 09:24
@neutrinoceros

Copy link
Copy Markdown
Contributor Author

changelog added, auto-merge enabled, and email sent. Thanks !

@neutrinoceros
neutrinoceros merged commit cf925ce into astropy:main Apr 25, 2026
45 of 46 checks passed
@neutrinoceros
neutrinoceros deleted the dep/pep735/define-groups branch April 25, 2026 10:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Build all wheels Run all the wheel builds rather than just a selection dependencies Pull requests that update a dependency file installation Release testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants