You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+27-5Lines changed: 27 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Python typing update
2
2
3
-
Small tool to update Python typing syntax.
3
+
Tool to update Python typing syntax.
4
4
It uses token analysis and
5
5
-[python-reorder-imports][pri]
6
6
-[pyupgrade][pyu]
@@ -33,7 +33,7 @@ and revert all changes to the file. This can be overwritten by using `--force`.
33
33
unused. If not, revert changes with `git restore`.
34
34
4. Remove unused imports with [autoflake][autoflake].
35
35
5. Run [isort][isort] to try to restore the previous formatting.
36
-
6. Optional: Run [black][black]
36
+
6. Optional: Run [black][black]. (Requires `black` to be added as `additional_dependency`)
37
37
7. Check `git diff` for modified comments.
38
38
If one is detected, revert changes and print file name.
39
39
Can be overwritten with `--force`.
@@ -74,8 +74,24 @@ Use additional options from [python-reorder-imports][pri] to rewrite
74
74
-`--py38-plus` (default): Imports from `mypy_extensions` and `typing_extensions` when possible.
75
75
-`--py39-plus`: Rewrite [PEP 585][PEP585] typing imports. Additionally `typing.Hashable` and `typing.Sized` will also be replace by their `collections.abc` equivalents.
76
76
77
+
**`--keep-updates`**
78
+
Keep updates even if no import was removed. Use with caution, might result in more errors.
79
+
77
80
**`--black`**
78
-
Run `black` formatting after updates.
81
+
Run `black` formatting after updates.
82
+
To use it, add `black` as `additional_dependency` in your `.pre-commit-config.yaml`.
83
+
84
+
```yaml
85
+
additional_dependencies:
86
+
- black==<insert current version here!>
87
+
```
88
+
89
+
**`--disable-committed-check`**
90
+
Don't abort with uncommitted changes. **Don't use it in production!**
91
+
Risk of losing uncommitted changes.
92
+
93
+
94
+
### Different mode options
79
95
80
96
**`--check`**
81
97
Check if files would be modified. Return with exitcode `1` or `0` if not. Useful for CI runs.
@@ -88,11 +104,17 @@ Check `git diff` before committing!
88
104
Only update files which are likely to require extra work.
89
105
Check `git diff` before committing!
90
106
107
+
108
+
### Python version options
109
+
110
+
**`--py38-plus`**
111
+
Set the minimum Python syntax version to **3.8**. This is the default.
112
+
91
113
**`--py39-plus`**
92
-
Set the minimum Python syntax to **3.9**. (Default: **3.8**)
114
+
Set the minimum Python syntax version to **3.9**. (Default: **3.8**)
93
115
94
116
**`--py310-plus`**
95
-
Set the minimum Python syntax to **3.10**. (Default: **3.10**)
117
+
Set the minimum Python syntax version to **3.10**. (Default: **3.8**)
0 commit comments