Skip to content

Commit fe2327b

Browse files
committed
chore: removes flake8, black, etc paths
1 parent 7b80e69 commit fe2327b

File tree

1 file changed

+16
-24
lines changed

1 file changed

+16
-24
lines changed

packages/google-cloud-spanner/noxfile.py

Lines changed: 16 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@
3131

3232
import nox
3333

34-
FLAKE8_VERSION = "flake8==6.1.0"
35-
BLACK_VERSION = "black[jupyter]==23.7.0"
36-
ISORT_VERSION = "isort==5.11.0"
3734
RUFF_VERSION = "ruff==0.14.14"
3835
LINT_PATHS = ["google", "tests", "noxfile.py", "setup.py"]
3936

@@ -117,40 +114,37 @@ def lint(session):
117114
Returns a failure if the linters find linting errors or sufficiently
118115
serious code quality issues.
119116
"""
120-
session.install(FLAKE8_VERSION, RUFF_VERSION)
121-
# Check formatting
117+
session.install("flake8", RUFF_VERSION)
118+
119+
# 2. Check formatting
122120
session.run(
123-
"ruff",
124-
"format",
121+
"ruff", "format",
125122
"--check",
126123
f"--target-version=py{ALL_PYTHON[0].replace('.', '')}",
127-
"--line-length=88",
124+
"--line-length=88",
128125
*LINT_PATHS,
129126
)
130127

131-
session.run("flake8", "google", "tests")
132-
133128

134129
# Use a python runtime which is available in the owlbot post processor here
135130
# https://github.com/googleapis/synthtool/blob/master/docker/owlbot/python/Dockerfile
136131
@nox.session(python=DEFAULT_PYTHON_VERSION)
137132
def blacken(session):
138133
"""(Deprecated) Legacy session. Please use 'nox -s format'."""
139-
session.log(
140-
"WARNING: The 'blacken' session is deprecated and will be removed in a future release. Please use 'nox -s format' in the future."
141-
)
134+
session.log("WARNING: The 'blacken' session is deprecated and will be removed in a future release. Please use 'nox -s format' in the future.")
135+
136+
# Just run the ruff formatter (keeping legacy behavior of only formatting, not sorting imports)
142137
session.install(RUFF_VERSION)
143138
session.run(
144-
"ruff",
145-
"format",
139+
"ruff", "format",
146140
f"--target-version=py{ALL_PYTHON[0].replace('.', '')}",
147141
"--line-length=88",
148142
*LINT_PATHS,
149143
)
150144

151145

152-
@nox.session
153-
def format(session: nox.sessions.Session) -> None:
146+
@nox.session(python=DEFAULT_PYTHON_VERSION)
147+
def format(session):
154148
"""
155149
Run ruff to sort imports and format code.
156150
"""
@@ -161,10 +155,8 @@ def format(session: nox.sessions.Session) -> None:
161155
# check --select I: Enables strict import sorting
162156
# --fix: Applies the changes automatically
163157
session.run(
164-
"ruff",
165-
"check",
166-
"--select",
167-
"I",
158+
"ruff", "check",
159+
"--select", "I",
168160
"--fix",
169161
f"--target-version=py{ALL_PYTHON[0].replace('.', '')}",
170162
"--line-length=88", # Standard Black line length
@@ -173,18 +165,18 @@ def format(session: nox.sessions.Session) -> None:
173165

174166
# 3. Run Ruff to format code
175167
session.run(
176-
"ruff",
177-
"format",
168+
"ruff", "format",
178169
f"--target-version=py{ALL_PYTHON[0].replace('.', '')}",
179170
"--line-length=88", # Standard Black line length
180171
*LINT_PATHS,
181172
)
182173

183174

175+
184176
@nox.session(python=DEFAULT_PYTHON_VERSION)
185177
def lint_setup_py(session):
186178
"""Verify that setup.py is valid (including RST check)."""
187-
session.install("docutils", "pygments", "setuptools>=79.0.1")
179+
session.install("setuptools", "docutils", "pygments")
188180
session.run("python", "setup.py", "check", "--restructuredtext", "--strict")
189181

190182

0 commit comments

Comments
 (0)