Skip to content

Conversation

bitsgalore
Copy link
Contributor

@bitsgalore bitsgalore commented Sep 24, 2025

Description

This PR adds support for Python 3.12.

Motivation and Context

Pywb currently fails to install under Python 3.12, see this issue. I fixed this with the following changes (following @ldko's suggestions in the issue response):

With these changes I was able to successfully install Pywb under Python 3.12 (I'm running Linux Mint 22.1 Xia).

A few things to watch out for:

  • I'm not entirely sure that these changes won't break things for older Python versions.
  • Perhaps python_requires could be relaxed even further to include 3.13 (<3.14), but I have no idea really!
  • See also Future dependency upgrades: drop Python 3.7, add Python 3.12 #890, and in particular the comments by @tw4l, and @aquatix who mentions that Debian 13 already comes with Python 3.13 by default.
  • I tested this by installating Pywb with my changes locally with pipx. This installs everything (including the dependencies) in a virtual environment. However, to run the the unit tests these dependencies must be available system wide (at least by default). For various reasons I don't want to do this global install right now, and I don't know how to use the virtualenv for this. This didn't used to be a problem in older Python versions, but it seems handling of packages changed quite a bit around Python 3.11/3.12, and I'm not entirely sure how this currently works.

Anyway, feel free to ignore if you don't want to merge these changes because of all this. But hopefully this is of some use.

Screenshots (if appropriate):

Types of changes

  • Replay fix (fixes a replay specific issue)
  • [ x] Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added or updated tests to cover my changes.
  • All new and existing tests passed.

@tw4l
Copy link
Member

tw4l commented Sep 24, 2025

Thanks @bitsgalore ! Really appreciate this PR. The first blocker I see to merging this (and the main thing that had kept us from upgrading previously) is the httpbin dependencies of greenlet<3.0; python_version < "3.12". As many of the tests rely on httpbin, we will likely need to either fork that project from https://github.com/psf/httpbin or find a suitable replacement/alternative in the tests so that we don't end up losing a fair amount of test coverage.

One option could be to spin up https://github.com/mccutchen/go-httpbin in a container to test against, at the cost of making the test setup more complicated.

@bitsgalore
Copy link
Contributor Author

@tw4l Yes, I already suspected something like this, only briefly after I submitted the PR I saw a previous rejected PR on this subject by someone else. The dependencies situation makes it pretty difficult to fix this without breaking stuff.

Completely agree on the costs of containerizing things. Apart from making things more complicated, it also introduces an additional burden of maintaining the containerization itself.

@tw4l
Copy link
Member

tw4l commented Sep 30, 2025

Closing in favor of #958, which resolved the httpbin dependencies and adds support for 3.12. Thanks again for the push to get this done!

@tw4l tw4l closed this Sep 30, 2025
@bitsgalore
Copy link
Contributor Author

@tw4l Thanks for the heads up, great to see this fixed!

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.

2 participants