Skip to content

Enforce modern Python code using pre-commit running pyupgrade --py39-plus #1329

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rominf
Copy link

@rominf rominf commented Apr 18, 2025

Closes #1326.

Update pyupgrade in pre-commit to --py39-plus to enforce PEP 585. Also add autoflake to pre-commit to remove unused imports after switching to PEP 585.

An alternative solution would be replace most pre-commit rules with ruff (https://docs.astral.sh/ruff/), however I wanted to move gradually. I am open opening a PR with introducing ruff.

Also add `autoflake` to remove unused imports after switching to PEP 585.
@rominf rominf force-pushed the rominf-pyupgrade branch from 104fe16 to 0bc019e Compare April 19, 2025 19:35
@rominf rominf changed the title Enforce modern Python code using pre-commit, pyupgrade --py39-plus, and GitHub Actions Enforce modern Python code using pre-commit running pyupgrade --py39-plus Apr 19, 2025
@dlqqq
Copy link
Member

dlqqq commented May 5, 2025

@rominf Wow, thank you for working on this! I had no idea that this was possible with our existing linter tools. This is awesome, and should slightly improve the server performance.

It may take a while for this PR to get merged. It would be easiest to merge the other open PRs first to minimize the number of merge conflicts we need to fix manually. Thank you for your patience in the meantime!

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.

Remove imports from deprecated typing modules
2 participants