-
Notifications
You must be signed in to change notification settings - Fork 827
Migrate from Python 2.7 to Python 3.12 #330
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
base: master
Are you sure you want to change the base?
Migrate from Python 2.7 to Python 3.12 #330
Conversation
via "prefers-color-scheme". Fixes idank#236
…milar Signed-off-by: Страхиња Радић <contact@strahinja.org>
86fa289 to
29a20e6
Compare
|
I also merged #237 by @rugk, #248 by @apoorvlathey and #293 by @Strahinja into this PR as the original PRs are apparently no longer active. Based on #232 by @wesinator I updated the references to use manpages of Ubuntu noble (24.04 LTS). Due to the high number of merge conflicts I decided to apply the changes without merging. |
|
Thanks for this work! I suggest to keep this PR focused on the python
migration and not pull in unrelated stuff like updating the man pages.
…On Sat, Sep 21, 2024, 13:51 Henning Weller ***@***.***> wrote:
I also merged #237 <#237> by
@rugk <https://github.com/rugk>, #248
<#248> by @apoorvlathey
<https://github.com/apoorvlathey> and #293
<#293> by @Strahinja
<https://github.com/Strahinja> into this PR as the original PRs are
apparently no longer active.
Based on #232 <#232> by
@wesinator <https://github.com/wesinator> I updated the references to use
manpages of Ubuntu noble (24.04 LTS). Due to the high number of merge
conflicts I decided to apply the changes without merging.
—
Reply to this email directly, view it on GitHub
<#330 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJX5RCJB7K2V7NGZTHM7IDZXVFU3AVCNFSM6AAAAABOTOTIV6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNRVGE2DEMJTG4>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
… - Python 3.12 migration
|
Why is this not merged in the master branch yet? I get this when I try to run This branch works fine tho. |
|
After not touching the code for years, a PR this size (even though organized quite well) is extremely difficult to review. I want to do it though. |
|
Awesome to hear back and take your time! One tip if I may tell you though: You can also review and merge the other PRs (like mine apparently) that were merged into here, first – and then merge them. This should decrease the effort as the diff decreases, theoretically. |
- Fix iterator protocol: def next() → def __next__() in Peekable class - Fix iterator calls: it.next() → next(it) throughout codebase - Fix map() iterator: yield map() → yield list(map()) in group_continuous - Fix dictionary methods: .iteritems() → .items() in doctests - Fix function names in doctests to match actual definitions - Migrate testing framework: nose → pytest (Python 3.12 compatible) - Update requirements.txt with pytest 8.3.3 and pytest-cov 6.0.0 - Update Makefile to use pytest --doctest-modules These fixes complete the Python 3.12 migration on top of PR idank#330. All 12 tests now passing (100% success rate). Test results: - explainshell/algo/features.py: 1 passed - explainshell/fixer.py: 1 passed - explainshell/manpage.py: 3 passed - explainshell/options.py: 3 passed - explainshell/util.py: 3 passed - explainshell/web/views.py: 1 passed Total: 12 passed in 0.37s Database integration verified with 72,349 documents. Full functionality tested with ls, grep, and tar commands.
- Fix iterator protocol: def next() → def __next__() in Peekable class - Fix iterator calls: it.next() → next(it) throughout codebase - Fix map() iterator: yield map() → yield list(map()) in group_continuous - Fix dictionary methods: .iteritems() → .items() in doctests - Fix function names in doctests to match actual definitions - Migrate testing framework: nose → pytest (Python 3.12 compatible) - Update requirements.txt with pytest 8.3.3 and pytest-cov 6.0.0 - Update Makefile to use pytest --doctest-modules These fixes complete the Python 3.12 migration on top of PR idank#330. All 12 tests now passing (100% success rate). Test results: - explainshell/algo/features.py: 1 passed - explainshell/fixer.py: 1 passed - explainshell/manpage.py: 3 passed - explainshell/options.py: 3 passed - explainshell/util.py: 3 passed - explainshell/web/views.py: 1 passed Total: 12 passed in 0.37s Database integration verified with 72,349 documents. Full functionality tested with ls, grep, and tar commands.
- Fix iterator protocol: def next() → def __next__() in Peekable class - Fix iterator calls: it.next() → next(it) throughout codebase - Fix map() iterator: yield map() → yield list(map()) in group_continuous - Fix dictionary methods: .iteritems() → .items() in doctests - Fix function names in doctests to match actual definitions - Migrate testing framework: nose → pytest (Python 3.12 compatible) - Update requirements.txt with pytest 8.3.3 and pytest-cov 6.0.0 - Update Makefile to use pytest --doctest-modules These fixes complete the Python 3.12 migration on top of PR idank#330. All 12 tests now passing (100% success rate). Test results: - explainshell/algo/features.py: 1 passed - explainshell/fixer.py: 1 passed - explainshell/manpage.py: 3 passed - explainshell/options.py: 3 passed - explainshell/util.py: 3 passed - explainshell/web/views.py: 1 passed Total: 12 passed in 0.37s Database integration verified with 72,349 documents. Full functionality tested with ls, grep, and tar commands.
Additional Python 2→3 Compatibility Fixes NeededI tested PR #330 extensively and found it needs a few additional fixes to achieve 100% Python 3.12 compatibility. Here are the required changes: Changes Needed (5 files, 20 insertions, 19 deletions)
Test ResultsWith these fixes applied: Testing Done✅ Full database integration (72,349 documents restored) The fixes are available in branch Happy to provide a patch file or PR to your fork if that would be helpful! 🙂 RelatedBuilds upon #330 by @mundanevision20 SummaryThese additional Python 2→3 compatibility fixes are needed on top of PR #330 to achieve 100% test passing rate. ChangesOnly 5 files modified with 20 insertions and 19 deletions:
Why These Fixes Are Needed
TestingAll 12 tests now passing (100% success rate): Tested with full database integration (72,349 documents) and verified with commands like Files Changed
|
- Fix iterator protocol: def next() → def __next__() in Peekable class - Fix iterator calls: it.next() → next(it) throughout codebase - Fix map() iterator: yield map() → yield list(map()) in group_continuous - Fix dictionary methods: .iteritems() → .items() in doctests - Fix function names in doctests to match actual definitions - Migrate testing framework: nose → pytest (Python 3.12 compatible) - Update requirements.txt with pytest 8.3.3 and pytest-cov 6.0.0 - Update Makefile to use pytest --doctest-modules These fixes complete the Python 3.12 migration on top of PR idank#330. All 12 tests now passing (100% success rate). Test results: - explainshell/algo/features.py: 1 passed - explainshell/fixer.py: 1 passed - explainshell/manpage.py: 3 passed - explainshell/options.py: 3 passed - explainshell/util.py: 3 passed - explainshell/web/views.py: 1 passed Total: 12 passed in 0.37s Database integration verified with 72,349 documents. Full functionality tested with ls, grep, and tar commands.
|
Update: I've created a cleaner PR that combines PR #330 with the additional compatibility fixes. Please see the new PR which includes everything needed for 100% Python 3.12 compatibility with all tests passing. The new PR shows the complete solution in one place, making it easier to review and merge. 🙂 |
|
You probably meant #345 (also IMHO it's best to disclose if you use AI for coding here, so people can be aware of that when reviewing it. The result may be fine, but just FYI.) |
|
Does this project even still work? |
I agree. I'll work on showing that more clearly the next time. Furthermore, I will check the current PR #345 over the next day, of course, together with AI for coding to fix failed checks in the CI/CD workflows, and reply on the PR #345 with a commit that resolves the build issues. |
While I mainly adapted the Python code to work with Python 3.12 I also enhanced the formatting and logging to ease future maintenance.