Skip to content

DEP: drop support for Python 3.11, require 3.12+ - #20223

Open
neutrinoceros wants to merge 2 commits into
astropy:mainfrom
neutrinoceros:dep/drop-cp311
Open

DEP: drop support for Python 3.11, require 3.12+#20223
neutrinoceros wants to merge 2 commits into
astropy:mainfrom
neutrinoceros:dep/drop-cp311

Conversation

@neutrinoceros

@neutrinoceros neutrinoceros commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

Description

As discussed in

close #18229
close #20184 (I think ?)

  • 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 v8.1.0 milestone Aug 8, 2026
@neutrinoceros neutrinoceros added Python 3.11 dependencies Pull requests that update a dependency file labels Aug 8, 2026
@github-actions

github-actions Bot commented Aug 8, 2026

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.

@neutrinoceros
neutrinoceros force-pushed the dep/drop-cp311 branch 4 times, most recently from 46db999 to fa7a591 Compare August 8, 2026 08:17
@neutrinoceros

neutrinoceros commented Aug 8, 2026

Copy link
Copy Markdown
Contributor Author

oldestdeps is failing with

ModuleNotFoundError: No module named 'six.moves'

(from cycler via matplotlib)
I don't understand it yet. six is actually installed there, as a declared dependency to cycler

edit: resolved by constraining six >= 0.16.0, which is the oldest version I cannot reproduce this error with.

@neutrinoceros
neutrinoceros force-pushed the dep/drop-cp311 branch 3 times, most recently from 2582b4c to b504b8f Compare August 8, 2026 11:09
@neutrinoceros

Copy link
Copy Markdown
Contributor Author

Still hitting this error, and still getting six==1.9.0 despite the constraint. I'm suspecting a cache invalidation issue with tox, tox-uv, or OpenAstronomy/github-actions-workflows, but nothing conclusive yet.

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

The cached .tox actually isn't the (only ?) problem. I'm able to reproduce the issue locally without a .tox, and installing with uv directly gives me yet another version of six (1.5.0). That is, despite the resolver's logs clearly seeing my constraint:

DEBUG Adding transitive dependency for python-dateutil==2.7.0: six>=1.5
DEBUG Adding transitive dependency for python-dateutil==2.7.0: six>=0.16.0

This looks like something is broken in uv's resolver itself, but there's an additional source of error in the tox/tox-uv layer. Let's see if I can at least work around it for now by adding a direct requirement on six.

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

Nevermind, my constraint just contained a typo. The fix was

diff --git a/pyproject.toml b/pyproject.toml
index 7436fe9f2d..c3bfa6efb6 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -829,7 +829,7 @@ required-environments = [
 constraint-dependencies = [
     "asdf>=2.15.1",
     "asdf-coordinates-schemas>=0.2.0",
-    "six>=0.16.0", # for Python 3.12+ compat
+    "six>=1.16.0", # for Python 3.12+ compat

     # via pytest
     # iniconfig 1.0.1 is the first version with proper wheels

@mhvk mhvk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks so much! I had been considering doing it myself and now realize how much I would've missed... Two comments, neither of which is essential.

Comment thread astropy/wcs/src/astropy_wcs.c Outdated
}

Py_INCREF(Py_None);
return Py_None;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Could replace (here and below) with Py_RETURN_NONE - which I like in that the reference counting is just hidden (i.e., one does not have to know Py_None is immortal).

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.

good call. I'll push out a separate commit just in case and will squash it if everything stays green.

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.

squashed


- name: Python 3.11 with oldest supported version of all dependencies
linux: py311-test-oldestdeps-alldeps-cov-clocale
- name: Python 3.12 with oldest supported version of all dependencies

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Would it make sense to bump all the python versions by 1? Perhaps best to do that when a new python release is made, but then it has to be clear which jobs need the minimum python version. Perhaps mark these? (here it is fairly obvious, but maybe below not).

@neutrinoceros neutrinoceros Aug 8, 2026

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.

We typically can't upgrade every job as soon as a new Python comes around without hitting some dependencies missing wheels for it, so I don't think we should wait for 3.15's release if we're going to do that. We could upgrade 3.13 jobs to 3.14 now, but it seems slightly orthogonal to this PR. Maybe @pllim would argue that we might just as well change all required env names in a single sweeping PR though. Until she weighs in, I'll just make sure that every job that needs the oldest supported version has a comment to explain it.

@neutrinoceros
neutrinoceros marked this pull request as ready for review August 8, 2026 18:55
@neutrinoceros

Copy link
Copy Markdown
Contributor Author

This is stable now and ready for formal reviews.
I squashed most of my commits into a single one, with one exception for a commit that turned out not to be entirely necessary but took disproportionate time to figure out and will be needed eventually, so I'm proposing to keep it attached. I could also move it to a separate PR if needed.
For context and posterity, this secondary commit is about adding constraints to indirect dependencies that used to require six but don't anymore. six<0.16 turned out to be incompatible with Python 3.12 which is why I hunted it down, but six is not completely gone from the graph either: html5lib and python-dateutil both still require it as of their latest versions. Furthermore, html5lib is now EOL so it'll just be in this state forever (#14316), and python-dateutil is in a difficult place right now with a huge chunk of the ecosystem relying on it but very little maintenance effort goes to it, so it's unclear wether that will be resolved in the forseeable future:

@mhvk mhvk left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for chasing all those loose ends down! Looks all OK to me.

@github-project-automation github-project-automation Bot moved this from Triage to Reviewer approved in Cosmology, the Expansion Aug 8, 2026
@neutrinoceros

Copy link
Copy Markdown
Contributor Author

whoops, I'm only just now seeing an error on double-tests jobs, which I don't immediately get off-hand. Re-drafting for now. Hopefully I'll figure it out tomorrow.

@neutrinoceros
neutrinoceros marked this pull request as draft August 8, 2026 20:01
@mhvk

mhvk commented Aug 8, 2026

Copy link
Copy Markdown
Contributor

That double-test error surely is due to #20090...
...
...
yes, I confirmed it. I just do not understand how it was possible the tests passed before!

Anyway, the fix is obviously to not cache string to unit parse results if there was a warning; see #20226.

@neutrinoceros

Copy link
Copy Markdown
Contributor Author

Thanks. No reason to keep this drafted then !

@neutrinoceros
neutrinoceros marked this pull request as ready for review August 9, 2026 04:59
@neutrinoceros
neutrinoceros force-pushed the dep/drop-cp311 branch 2 times, most recently from 142d66a to dab8f97 Compare August 9, 2026 05:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Reviewer approved

Development

Successfully merging this pull request may close these issues.

Drop python 3.11? numpy 2.0? RFC: reminder to remove PyINCREF(Py_None) when support for Python 3.11 is dropped

2 participants