2020
2121import nox
2222
23- BLACK_VERSION = "black==24.10.0"
24- ISORT_VERSION = "isort==5.13.2"
25-
2623LINT_PATHS = ["google" , "tests" , "noxfile.py" ]
2724
2825TEST_PYTHON_VERSIONS = ["3.9" , "3.10" , "3.11" , "3.12" , "3.13" ]
@@ -36,32 +33,16 @@ def lint(session):
3633 """
3734 session .install ("-r" , "requirements.txt" )
3835 session .install (
39- "flake8" ,
40- "flake8-annotations" ,
36+ "ruff" ,
4137 "mypy" ,
42- BLACK_VERSION ,
43- ISORT_VERSION ,
4438 "twine" ,
4539 "build" ,
4640 "importlib_metadata==7.2.1" ,
4741 )
4842 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 ,
6546 )
6647 session .run (
6748 "mypy" ,
@@ -75,28 +56,16 @@ def lint(session):
7556 session .run ("python" , "-m" , "build" , "--sdist" )
7657 session .run ("twine" , "check" , "--strict" , "dist/*" )
7758
78-
7959@nox .session ()
8060def format (session ):
8161 """
82- Run isort to sort imports. Then run black
83- to format code to uniform standard.
62+ Run Ruff to automatically format code.
8463 """
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" )
9865 session .run (
99- "black" ,
66+ "ruff" ,
67+ "check" ,
68+ "--fix" ,
10069 * LINT_PATHS ,
10170 )
10271
0 commit comments