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

Preliminary Python 3.13 compatibility #513

Merged
merged 2 commits into from
Nov 28, 2024
Merged

Conversation

liushuyu
Copy link
Contributor

This pull request adds preliminary Python 3.13 compatibility. A new CI job for Python 3.13 is also added.

@kislyuk
Copy link
Owner

kislyuk commented Nov 28, 2024

Thanks, I think this works!

@kislyuk kislyuk merged commit bdf34f3 into kislyuk:develop Nov 28, 2024
26 checks passed
@kislyuk
Copy link
Owner

kislyuk commented Nov 28, 2024

Reverting as this is not actually necessary for tests to pass on Python 3.13.

Did you have a specific issue with Python 3.13 that this is intended to solve and is not caught by the test suite, or were you talking about Python 3.14?

@liushuyu
Copy link
Contributor Author

Reverting as this is not actually necessary for tests to pass on Python 3.13.

Did you have a specific issue with Python 3.13 that this is intended to solve and is not caught by the test suite, or were you talking about Python 3.14?

I am actually one of the Ubuntu maintainers, and our automated testing shows that this project does not work under Python 3.13: https://autopkgtest.ubuntu.com/results/autopkgtest-plucky/plucky/amd64/p/python-argcomplete/20241120_101446_98775@/log.gz. From the issue you linked (#515), it looks like we have the exact same symptoms on Python 3.13 as well.

@liushuyu
Copy link
Contributor Author

From the looks of it, this also fixes #514

@paparodeo
Copy link

this patch fixes failures of downstream consumers https://cache.nixos.org/log/qzijsl88q4awdsk4w96b91zf9qmvykns-python3.12-traitlets-5.14.3.drv

@kislyuk
Copy link
Owner

kislyuk commented Dec 5, 2024

@liushuyu I am unable to reproduce the test failures on Python 3.13 that you are referencing. Issue #515 is about Python 3.14, which is not released yet. Can you give me an exact set of commands that I can use to reproduce on Python 3.13?

@paparodeo this package does not support running tests using pytest; please try again while using unittest.

@liushuyu
Copy link
Contributor Author

liushuyu commented Dec 5, 2024

@liushuyu I am unable to reproduce the test failures on Python 3.13 that you are referencing. Issue #515 is about Python 3.14, which is not released yet. Can you give me an exact set of commands that I can use to reproduce on Python 3.13?

Because Debian and Ubuntu usually cherry-pick updates from the Python release branch. However, you will be able to reproduce this issue using Python 3.12.8 and Python 3.13.1 (released 2 days ago) very soon.

@paparodeo this package does not support running tests using pytest; please try again while using unittest.

@kislyuk
Copy link
Owner

kislyuk commented Dec 5, 2024

That's great, thanks. Once I'm able to repro with 3.12.8/3.13.1 I will dig in and figure out what's going on, and will merge a variation of your fix.

@liushuyu
Copy link
Contributor Author

liushuyu commented Dec 5, 2024

That's great, thanks. Once I'm able to repro with 3.12.8/3.13.1 I will dig in and figure out what's going on, and will merge a variation of your fix.

I have already did some initial investigations when submitting this pull request, the root cause is this: python/cpython@1fe63b1

@kislyuk
Copy link
Owner

kislyuk commented Dec 5, 2024

@liushuyu thanks for linking that.

argcomplete follows a particular philosophy when patching argparse. The patched class overrides as few functions as possible. Within those functions, it retains as much original code as possible, and clearly marks all code that was modified and the version of CPython standard library the code was copied from.

The task now is for me to verify that the approach you are taking in your patch (overload _parse_known_args2()) is in line with that philosophy, and to change it so that it retains as much original code as possible and is annotated.

@paparodeo
Copy link

paparodeo commented Dec 5, 2024

@paparodeo this package does not support running tests using pytest; please try again while using unittest.

the errors were caused by running the tests of the traitlets module which broke when python was updated to 3.12.8 I believe. https://github.com/ipython/traitlets/tree/main/tests. I don't have any affiliation with that module, just noticed the build started to fail. https://hydra.nixos.org/build/281237249. when this patch is applied the traitlets tests succeed.

@kislyuk
Copy link
Owner

kislyuk commented Dec 6, 2024

Thanks for your work on this @liushuyu. I pursued a slightly different and simpler approach, and released it in argcomplete v3.5.2 which should restore compatibility.

@liushuyu
Copy link
Contributor Author

liushuyu commented Dec 6, 2024

Thanks for your work on this @liushuyu. I pursued a slightly different and simpler approach, and released it in argcomplete v3.5.2 which should restore compatibility.

Thank you for the fix!

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.

3 participants