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

Consider dropping Python 2 support #435

Closed
JustAnotherArchivist opened this issue Sep 18, 2021 · 9 comments · Fixed by #467
Closed

Consider dropping Python 2 support #435

JustAnotherArchivist opened this issue Sep 18, 2021 · 9 comments · Fixed by #467

Comments

@JustAnotherArchivist
Copy link
Contributor

It's been almost two years since Python 2 has reached end-of-life. Some things already broke, and this will only get worse over time. Also, the code is significantly more complex (everything involving six; see also my struggles on #405).

I suggest dropping Python 2 support and removing the accompanying code cruft.

@jjjake has previously said in #405 that he 'would like to support [Python 2] as long as we're able to'. As such, I don't expect this to be acted on immediately. But I think it is inevitable as dependencies have begun to drop Py2 support, slowly making it harder to keep the support here.

Relevant issues so far (in no particular order):

As of right now, the contextlib2 development breaks new ia installations entirely on Python 2 unless you manually install an older version of that package. It could be pinned, but that's just delaying the inevitable.

Further things to look forward to:

@maxz
Copy link
Contributor

maxz commented Oct 16, 2021

Since many of the libraries that we rely on will soon be dropping their Python 2 support, I'm generally in favour of also dropping the Python 2 support for internetarchive.

In the past I've had to deal with environments where I could only easily run Python 2, since running Python 3 would have required that I cross compile it myself and somehow get it to permanently reside in the memory of those rather special systems, so there are certain use cases I see for which it would be good to keep Python 2 support.

But the only realistic option to keep the Python 2 support would be to pin the latest Python 2 supporting versions of all our dependencies, which is pretty bad from a security point of view.
Backporting the newer versions of all our dependencies to Python 2 is just not a realistic option.

Therefore it is most likely the best option to just drop the Python 2 support.

I don't see any reason to do so right away, but as soon as the first major dependency drops the support, we pretty much also have to do so. Maybe we should prepare for that time by stating in all important places, that the Python 2 support will be dropped to give the users time to prepare (and try to find out the rough time when this will take place).

@JustAnotherArchivist
Copy link
Contributor Author

urllib3, upstream dependency of requests, has dropped Python 2 support, though this isn't released yet: urllib3/urllib3#2044

@maxz
Copy link
Contributor

maxz commented Oct 18, 2021

They additionally dropped the Python 3.5 support in that pull request, which we should also watch.

@cclauss
Copy link
Contributor

cclauss commented Nov 24, 2021

👍 Next week it is 700 days since Python 2 went EOL. Let's cut a final release that supports legacy Python and then move forward.

@jjjake
Copy link
Owner

jjjake commented Nov 24, 2021

Ok. Thanks to everyone for pushing on this, and thanks for your patience. It's been a long time coming! I think it's time, let's start talking about what a final PY2 release would look like (any outstanding bugs in PY2 we should try and deal with before shipping the last PY2 version, etc.), and go from there. Thanks again!

@JustAnotherArchivist
Copy link
Contributor Author

Some thoughts in no particular order:

So overall, I can't really think of any particular significant things that should be fixed for a final Py2-compatible release. However, I also never used ia on Py2 myself, so I may be missing something.

@JustAnotherArchivist
Copy link
Contributor Author

Considering the above and the recent release of version 2.3.0, can we drop Py2 yet? :-)

@jjjake
Copy link
Owner

jjjake commented Jan 27, 2022

@JustAnotherArchivist Yeah, I think we should move ahead with dropping PY2 support! Thanks for taking the time to consider all of the above, and following up on it.

@JustAnotherArchivist
Copy link
Contributor Author

Yay! I'll work on a PR to remove the cruft.

JustAnotherArchivist added a commit to JustAnotherArchivist/internetarchive that referenced this issue Jan 28, 2022
In addition to the obvious changes, this also includes the following noteworthy ones:

- `ia list` had a bug on Python 3, introduced by f52ff26, where it behaved differently for list-like file metadata on Py2 than Py3. This ports the Py2 behaviour to Py3.
- `internetarchive.utils.map2x` is gone. This was unused since 4f05beb, only needed for Py2 compatibility, and never part of the public API.
- The `pex-requirements.txt` file didn't match the dependencies in `setup.py` anymore; synchronised those again.

Closes jjjake#435
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
4 participants