20
20
21
21
import nox
22
22
23
- BLACK_VERSION = "black==24.10.0"
24
- ISORT_VERSION = "isort==5.13.2"
25
-
26
23
LINT_PATHS = ["google" , "tests" , "noxfile.py" ]
27
24
28
25
TEST_PYTHON_VERSIONS = ["3.9" , "3.10" , "3.11" , "3.12" , "3.13" ]
@@ -36,32 +33,16 @@ def lint(session):
36
33
"""
37
34
session .install ("-r" , "requirements.txt" )
38
35
session .install (
39
- "flake8" ,
40
- "flake8-annotations" ,
36
+ "ruff" ,
41
37
"mypy" ,
42
- BLACK_VERSION ,
43
- ISORT_VERSION ,
44
38
"twine" ,
45
39
"build" ,
46
40
"importlib_metadata==7.2.1" ,
47
41
)
48
42
session .run (
49
- "isort" ,
50
- "--fss" ,
51
- "--check-only" ,
52
- "--diff" ,
53
- "--profile=black" ,
54
- "--force-single-line-imports" ,
55
- "--dont-order-by-type" ,
56
- "--single-line-exclusions=typing" ,
57
- "-w=88" ,
58
- * LINT_PATHS ,
59
- )
60
- session .run ("black" , "--check" , "--diff" , * LINT_PATHS )
61
- session .run (
62
- "flake8" ,
63
- "google" ,
64
- "tests" ,
43
+ "ruff" ,
44
+ "check" ,
45
+ * LINT_PATHS ,
65
46
)
66
47
session .run (
67
48
"mypy" ,
@@ -75,28 +56,16 @@ def lint(session):
75
56
session .run ("python" , "-m" , "build" , "--sdist" )
76
57
session .run ("twine" , "check" , "--strict" , "dist/*" )
77
58
78
-
79
59
@nox .session ()
80
60
def format (session ):
81
61
"""
82
- Run isort to sort imports. Then run black
83
- to format code to uniform standard.
62
+ Run Ruff to automatically format code.
84
63
"""
85
- session .install (BLACK_VERSION , ISORT_VERSION )
86
- # Use the --fss option to sort imports using strict alphabetical order.
87
- # See https://pycqa.github.io/isort/docs/configuration/options.html#force-sort-within-sectionss
88
- session .run (
89
- "isort" ,
90
- "--fss" ,
91
- "--profile=black" ,
92
- "--force-single-line-imports" ,
93
- "--dont-order-by-type" ,
94
- "--single-line-exclusions=typing" ,
95
- "-w=88" ,
96
- * LINT_PATHS ,
97
- )
64
+ session .install ("ruff" )
98
65
session .run (
99
- "black" ,
66
+ "ruff" ,
67
+ "check" ,
68
+ "--fix" ,
100
69
* LINT_PATHS ,
101
70
)
102
71
0 commit comments