apache / apache/cloudstack

Add pre-commit hook `pyupgrade` to auto upgrade Python syntax

Open
#10,977 1 comment 0 reactions 0 assignees View on GitHub
long-term-plan
Dominant language
Java
Stars
3.1k
Forks
1.4k
Avg merge
6d 19h
Merged PRs (30d)
32

Description

"A tool (and pre-commit hook) to automatically upgrade syntax for newer versions of the language."

https://github.com/asottile/pyupgrade

https://github.com/asottile/pyupgrade?tab=readme-ov-file#python2-and-old-python3x-blocks

Example `.pre-commit-config.yaml` entry:

```
- repo: https://github.com/asottile/pyupgrade
rev: v3.19.1
hooks:
- id: pyupgrade
args: [--py37-plus]
```

Availability:

- --py36-plus will remove Python <= 3.5 only blocks
- --py37-plus will remove Python <= 3.6 only blocks
so on and so forth

Contributor guide

Open the contributing guide

Research direction

Inspect the repository's existing .pre-commit-config.yaml and identify the Python version policy used by the project. Add the pyupgrade hook with the appropriate --py37-plus-style argument from the issue, then verify that the pre-commit configuration accepts it.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Feature
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.