Skip to content

style: pre-commit additions, remove <3.7 code#432

Merged
agronholm merged 2 commits into
pypa:mainfrom
henryiii:henryiii/style/cleanup
Dec 30, 2021
Merged

style: pre-commit additions, remove <3.7 code#432
agronholm merged 2 commits into
pypa:mainfrom
henryiii:henryiii/style/cleanup

Conversation

@henryiii

@henryiii henryiii commented Dec 30, 2021

Copy link
Copy Markdown
Contributor

This adds some pre-commit checks, flake8-bugbear, and most importantly, pyupgrade. I've also run isort's from __future__ import annotations injection to allow pyupgrade to further clean up annotations. I've also normalized the indentation of the pre-commit yaml file, it was different for each check.

@codecov

codecov Bot commented Dec 30, 2021

Copy link
Copy Markdown

Codecov Report

Merging #432 (5bfe3d9) into main (64009ed) will increase coverage by 0.14%.
The diff coverage is 88.88%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #432      +/-   ##
==========================================
+ Coverage   66.88%   67.03%   +0.14%     
==========================================
  Files          11       11              
  Lines         897      904       +7     
==========================================
+ Hits          600      606       +6     
- Misses        297      298       +1     
Impacted Files Coverage Δ
src/wheel/__main__.py 0.00% <0.00%> (ø)
src/wheel/__init__.py 100.00% <100.00%> (ø)
src/wheel/bdist_wheel.py 49.63% <100.00%> (+0.18%) ⬆️
src/wheel/cli/__init__.py 26.78% <100.00%> (+1.33%) ⬆️
src/wheel/cli/convert.py 39.10% <100.00%> (+0.39%) ⬆️
src/wheel/macosx_libfile.py 94.51% <100.00%> (+0.03%) ⬆️
src/wheel/metadata.py 98.38% <100.00%> (ø)
src/wheel/wheelfile.py 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 64009ed...5bfe3d9. Read the comment docs.

@agronholm

Copy link
Copy Markdown
Contributor

Just one question: is there a pre-commit check now in place that automatically injects from __future__ import annotations to the top of new modules?

@henryiii

henryiii commented Dec 30, 2021

Copy link
Copy Markdown
Contributor Author

No, that's still manual. Once it's in, pyupgrade will make sure the annotations are modern.

Honestly, it probably can be done with second isort hook + args, I've never tried that. I'll test it quickly.

@henryiii henryiii force-pushed the henryiii/style/cleanup branch from d47e583 to 5bfe3d9 Compare December 30, 2021 16:40
@henryiii

Copy link
Copy Markdown
Contributor Author

Okay, now isort enforces from __future__ import annotations on all files in pre-commit.

@agronholm agronholm merged commit ad29512 into pypa:main Dec 30, 2021
@agronholm

Copy link
Copy Markdown
Contributor

Thanks!

@henryiii henryiii deleted the henryiii/style/cleanup branch December 30, 2021 20:01
@xkszltl

xkszltl commented Oct 25, 2022

Copy link
Copy Markdown

This would break builds on python 3.6, which is still widely used on CentOS 7 and Ubuntu 18.04

xkszltl added a commit to xkszltl/Roaster that referenced this pull request Oct 25, 2022
@henryiii

Copy link
Copy Markdown
Contributor Author

That's the point of python_requires = >=3.7, on 3.6 you will automatically get an old version of wheel. This is also true with Pip, setuptools, packaging, and most of the rest of the ecosystem. If you're stuck on an old ecosystem, you're stuck on old software. In fact, this is usually for the best, if everybody drop things about the same time, you have the highest chance of being left in a working state. Then maybe especially to this case, as wheel is only supported as used by directly by setuptools, which dropped support on time as well.

abravalheri pushed a commit to abravalheri/setuptools that referenced this pull request Apr 28, 2025
Added pyupgrade and flake8-bugbear to pre-commit configuration. Converted all code to py37+ syntax. Reformatted the pre-commit configuration file.
abravalheri pushed a commit to abravalheri/setuptools that referenced this pull request Apr 30, 2025
Added pyupgrade and flake8-bugbear to pre-commit configuration. Converted all code to py37+ syntax. Reformatted the pre-commit configuration file.
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