Skip to content
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

Add Python 3.12 support #2516

Merged
merged 3 commits into from
Oct 31, 2023
Merged

Conversation

SnoopJ
Copy link
Contributor

@SnoopJ SnoopJ commented Oct 5, 2023

Description

This changeset adds Python 3.12 support to Sopel, which mostly means some chore updating of version lists. The most notable change is the adjustment of the pinned version of setuptools to avoid a known incompatibility with 3.12.

At one point it looked like aiohttp would be a blocker for this support (as they still have no issued a new release with a compat bugfix 😬), but the problem disappeared between the last check of a Python 3.12 RC against Sopel and the official release. 🤷 Edit: nope, aiohttp is indeed a problem (failure in CI associated with the known upstream bug), so we will be waiting for them to do a new release after all. We can workaround the build failure by AIOHTTP_NO_EXTENSIONS=1 in the environment, but there isn't a compelling reason to do this in CI, we can just wait on upstream to do a release. See related issue, hopefully that will happen in the next week or so.

Edit: since the closure of #2523, the above no longer blocks this PR. Users who want both Python 3.12 and sopel-iplookup will be stuck waiting on aiohttp, but they can add --pre to their install command or set the above environment variable to get around it.

Closes #2457

Checklist

  • I have read CONTRIBUTING.md
  • I can and do license this contribution under the EFLv2
  • No issues are reported by make qa (runs make lint and make test)
    • 1323 passed, 8 xfailed, 591 warnings in 57.03s
  • I have tested the functionality of the things this change touches

Supplemental checklist (from #2457)

  • Check Sopel tests against 3.12
  • Update CI to run with 3.12
  • Update classifiers list in pyproject.toml
  • [ ] Check on 3.12 support concerns for official non-core plugins NAK, not this PR's problem — @dgw

@SnoopJ SnoopJ added Medium Priority Build Housekeeping Code cleanup, removal of deprecated stuff, etc. labels Oct 5, 2023
@SnoopJ SnoopJ added this to the 8.0.0 milestone Oct 5, 2023
pyproject.toml Show resolved Hide resolved
@SnoopJ SnoopJ mentioned this pull request Oct 5, 2023
3 tasks
@SnoopJ
Copy link
Contributor Author

SnoopJ commented Oct 9, 2023

aiohttp has a pre-release version out that includes the fix for Python 3.12 support, installing Sopel with this changeset using the --pre option to pip succeeds. Looks like they are moving more slowly than usual between the pre-release and the full release to allow their users to test, keeping an eye on the relevant issue for now.

@dgw
Copy link
Member

dgw commented Oct 13, 2023

Rebasing this to fix the merge conflict from #2520 will be the perfect excuse to make GHA retest after aiohttp gets its Python 3.12 ducks lined up. Which should be any day now… right? (Lots of recent activity on aio-libs/aiohttp#7675 about some shutdown-timeout bug that seems to be holding back a stable release.)

@SnoopJ SnoopJ mentioned this pull request Oct 14, 2023
40 tasks
@SnoopJ
Copy link
Contributor Author

SnoopJ commented Oct 14, 2023

It does look like aiohttp is going to be in pre-release for a while longer. @Exirel mentioned on IRC that we could move the ip plugin (which gives us that dependency via geoip2) to an external package, which would soften how blocked we are viz. this PR. See #2523 for that changeset.

@SnoopJ
Copy link
Contributor Author

SnoopJ commented Oct 27, 2023

The story upstream in aiohttp seems to be getting more complicated, so I think our best way forward is to get #2523 merged. Users who want 3.12 and the sopel-iplookup plugin will need to use --pre for the time being when installing the plugin, but everything else here is ready once that PR is merged.

@dgw
Copy link
Member

dgw commented Oct 30, 2023

In the interest of helping this along, I chose #2523 as one of today's merges. Based on local testing yesterday, installing and running on Python 3.12 appeared to be fine with that branch merged into this one. We're left with a bunch of deprecation warnings emitted in pytest itself—about 46,700 of them—that were resolved for me by upgrading pytest from 7.1.3 to 7.4.3.

While I didn't test the pytest upgrade against everything Python <3.12, a cursory check showed that pytest 7.4.3 is installable all the way back to Python 3.8, and the test suite passed on py3.8.* Passing on 3.8 and 3.12 presumably means all the intermediate Python versions will work, too; we can probably just raise the requirement from pytest~=7.1.0 🡒 pytest~=7.4.0 and be fine.

* — Passed with my manually-upgraded urllib3 2.0.7. As mentioned in IRC chatter yesterday, I have a solution in mind for working around that problem as part of #2519. That'll get pushed once I steel myself for a potential unexpected ❌ from CI. 😅

@Exirel
Copy link
Contributor

Exirel commented Oct 30, 2023

Nothing more to say than "yes, good!" to your last comment @dgw:

  • Pytest to 7.4 => yes, good!
  • urllib3 thing => yes, also good!

Versions of setuptools before 66.1 used deprecated portions of `pkgutil`
that were removed in Python 3.12. More information:

pypa/setuptools#3631
https://setuptools.pypa.io/en/latest/history.html#v66-1-0
This bump to `pytest` is primarily to eliminate some deprecation
warnings from inside of `pytest` itself, but note that this relaxes our
dependency to 2 release fields instead of 3, meaning that we will
automatically get 'minor' upgrades to `pytest` (up to 8.0 exclusive)

As of `pytest` 7.2.0, `py` is no longer in our dependency graph, so we
should not refer to this older and sorta-deprecated library, especially
when invoking `pytest`.
@SnoopJ
Copy link
Contributor Author

SnoopJ commented Oct 30, 2023

With closure of #2523, this PR is now as final as I forsee it being. The only outstanding issue is checking on plugins external to core, but I think even if there are issues there, those will be issues with those plugins and won't affect the contents of this PR.

Copy link
Member

@dgw dgw left a comment

Choose a reason for hiding this comment

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

Looks like you even caught all of the py.test references everywhere. Well done!

@ghost
Copy link

ghost commented Oct 30, 2023

Can confirm Sopel installs (pip install -e .) and runs with this PR on py3.12.0. 😎

@dgw dgw merged commit 9023957 into sopel-irc:master Oct 31, 2023
15 checks passed
@dgw
Copy link
Member

dgw commented Oct 31, 2023

It's official, y'all:
image

@SnoopJ SnoopJ deleted the feature/python3.12-support branch November 5, 2023 20:17
@SnoopJ SnoopJ mentioned this pull request Oct 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Build Housekeeping Code cleanup, removal of deprecated stuff, etc. Medium Priority
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Official support for Python 3.12
3 participants