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

Make pycln run with Python 3.12 (#221) #224

Merged
merged 6 commits into from
Nov 14, 2023

Conversation

perfa
Copy link
Contributor

@perfa perfa commented Oct 26, 2023

Changes were made to pathlib with the release of 3.12 the details of which can be read here. Updated the code to reflect that you no longer need to directly refer to _posix_flaour nor _windows_flavour when inheriting from Path. The __init__ function of Path does take args now. Finally, references to disututils were changed to asyncio (available from 3.4) as the distutils module has been removed in Python 3.12 breaking some tests.

Tests pass and pycln successfully run on local codebase with Python 3.12.0 and 3.10.13.

Fixes: #223, #221, #219

@johanneswilm
Copy link

Any chance this could be merged any time soon @hadialqattan ?

@hadialqattan
Copy link
Owner

Any chance this could be merged any time soon @hadialqattan ?

Sure bro but please give me some time as im reaaaally busy these days 🙏🏻.

Thank you all for the support ❤️.

Comment on lines 23 to 26
if sys.version_info >= (3, 12):
from pathlib import Path
_flavour = os.path
else:
from pathlib import Path, _posix_flavour, _windows_flavour # type: ignore
_flavour = _windows_flavour if ISWIN else _posix_flavour

Choose a reason for hiding this comment

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

I think the if should be reversed. Versions prior to 3.12 are an exception, not the other way around.

Copy link

codecov bot commented Nov 13, 2023

Codecov Report

Merging #224 (a8f88f3) into master (6770dd0) will not change coverage.
The diff coverage is 100.00%.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##            master      #224   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           28        28           
  Lines         2895      2902    +7     
=========================================
+ Hits          2895      2902    +7     
Files Coverage Δ
pycln/utils/pathu.py 100.00% <ø> (ø)
pycln/utils/refactor.py 100.00% <100.00%> (ø)
pycln/utils/scan.py 100.00% <ø> (ø)
tests/test_pathu.py 100.00% <ø> (ø)

Copy link

codeclimate bot commented Nov 14, 2023

Code Climate has analyzed commit a8f88f3 and detected 0 issues on this pull request.

View more on Code Climate.

@hadialqattan
Copy link
Owner

@perfa thanks for the awesome work!

Also thanks to @GriceTurrble for his contribution.

+ I'm really sorry for the delay.

@hadialqattan hadialqattan merged commit 56d1e8b into hadialqattan:master Nov 14, 2023
20 checks passed
@hadialqattan
Copy link
Owner

@GriceTurrble @johanneswilm @perfa
Please checkout v2.4.0

@GriceTurrble
Copy link

Tested locally after a pre-commit clean, update, and running the check. All seems to be working fine now.

Thank you @hadialqattan !

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.

[FEATURE] Python 3.12 types support
4 participants