Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions packages/bigquery-magics/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
import nox

FLAKE8_VERSION = "flake8==6.1.0"
BLACK_VERSION = "black[jupyter]==23.7.0"
RUFF_VERSION = "ruff==0.14.14"
ISORT_VERSION = "isort==5.11.0"
LINT_PATHS = ["docs", "bigquery_magics", "tests", "noxfile.py", "setup.py"]

DEFAULT_PYTHON_VERSION = "3.14"
Expand Down Expand Up @@ -176,10 +174,18 @@ def lint(session):

@nox.session(python=DEFAULT_PYTHON_VERSION)
def blacken(session):
"""Run black. Format code to uniform standard."""
session.install(BLACK_VERSION)
"""(Deprecated) Legacy session. Please use 'nox -s format'."""
session.log(
"WARNING: The 'blacken' session is deprecated and will be removed in a future release. Please use 'nox -s format' in the future."
)

# Just run the ruff formatter (keeping legacy behavior of only formatting, not sorting imports)
session.install(RUFF_VERSION)
session.run(
"black",
"ruff",
"format",
f"--target-version=py{UNIT_TEST_PYTHON_VERSIONS[0].replace('.', '')}",
"--line-length=88",
*LINT_PATHS,
)
Comment on lines 184 to 190

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Since line-length = 88 is already configured in pyproject.toml, and target-version can also be configured there (e.g., target-version = "py38"), passing these options as command-line arguments in noxfile.py is redundant. Relying on pyproject.toml simplifies the noxfile.py configuration and avoids package-specific variable name discrepancies (such as UNIT_TEST_PYTHON_VERSIONS vs ALL_PYTHON).

    session.run(
        "ruff",
        "format",
        *LINT_PATHS,
    )


Expand Down
23 changes: 23 additions & 0 deletions packages/bigquery-magics/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.ruff]
line-length = 88
Comment on lines +19 to +20

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Configuring target-version directly in pyproject.toml is a best practice for Ruff. It ensures that IDEs, pre-commit hooks, and manual CLI runs all use the correct target Python version consistently without needing to pass it as a command-line argument. This also allows simplifying the noxfile.py configurations across all packages.

Suggested change
[tool.ruff]
line-length = 88
[tool.ruff]
line-length = 88
target-version = "py38"


[tool.ruff.lint]
select = ["I"]
17 changes: 11 additions & 6 deletions packages/db-dtypes/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
import nox

FLAKE8_VERSION = "flake8==6.1.0"
BLACK_VERSION = "black[jupyter]==23.7.0"
RUFF_VERSION = "ruff==0.14.14"
ISORT_VERSION = "isort==5.11.0"
# Temporarily pin pytest<9.2 because pytest 9.2.0 applies filterwarnings=error
# before pytest_configure hooks run, turning pytest-asyncio's unset
# asyncio_default_fixture_loop_scope warning into an error. Remove once
Expand Down Expand Up @@ -141,11 +139,18 @@ def lint(session):

@nox.session(python=DEFAULT_PYTHON_VERSION)
def blacken(session):
"""Run black. Format code to uniform standard."""
session.install(BLACK_VERSION)
session.run("python", "-m", "pip", "freeze")
"""(Deprecated) Legacy session. Please use 'nox -s format'."""
session.log(
"WARNING: The 'blacken' session is deprecated and will be removed in a future release. Please use 'nox -s format' in the future."
)

# Just run the ruff formatter (keeping legacy behavior of only formatting, not sorting imports)
session.install(RUFF_VERSION)
session.run(
"black",
"ruff",
"format",
f"--target-version=py{UNIT_TEST_PYTHON_VERSIONS[0].replace('.', '')}",
"--line-length=88",
*LINT_PATHS,
)

Expand Down
23 changes: 23 additions & 0 deletions packages/db-dtypes/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.ruff]
line-length = 88

[tool.ruff.lint]
select = ["I"]
6 changes: 6 additions & 0 deletions packages/google-cloud-bigquery/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,9 @@ version = { attr = "google.cloud.bigquery.version.__version__" }
# Only include packages under the 'google' namespace. Do not include tests,
# benchmarks, etc.
include = ["google*"]

[tool.ruff]
line-length = 88

[tool.ruff.lint]
select = ["I"]
24 changes: 15 additions & 9 deletions packages/pandas-gbq/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@

import nox

BLACK_VERSION = "black==23.7.0"
ISORT_VERSION = "isort==5.10.1"
RUFF_VERSION = "ruff==0.14.14"
LINT_PATHS = ["docs", "pandas_gbq", "tests", "noxfile.py", "setup.py"]

Expand Down Expand Up @@ -151,7 +149,7 @@ def lint(session):
"check",
"--select",
"I",
f"--target-version=py{UNIT_TEST_PYTHON_VERSIONS[0].replace('.', '')}",
f"--target-version=py{ALL_PYTHON[0].replace('.', '')}",
"--line-length=88",
*LINT_PATHS,
)
Expand All @@ -160,7 +158,7 @@ def lint(session):
"ruff",
"format",
"--check",
f"--target-version=py{UNIT_TEST_PYTHON_VERSIONS[0].replace('.', '')}",
f"--target-version=py{ALL_PYTHON[0].replace('.', '')}",
"--line-length=88",
*LINT_PATHS,
)
Expand All @@ -170,10 +168,18 @@ def lint(session):
@nox.session(python=DEFAULT_PYTHON_VERSION)
@_calculate_duration
def blacken(session):
"""Run black. Format code to uniform standard."""
session.install(BLACK_VERSION)
"""(Deprecated) Legacy session. Please use 'nox -s format'."""
session.log(
"WARNING: The 'blacken' session is deprecated and will be removed in a future release. Please use 'nox -s format' in the future."
)

# Just run the ruff formatter (keeping legacy behavior of only formatting, not sorting imports)
session.install(RUFF_VERSION)
session.run(
"black",
"ruff",
"format",
f"--target-version=py{ALL_PYTHON[0].replace('.', '')}",
"--line-length=88",
*LINT_PATHS,
)
Comment on lines 178 to 184

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Since line-length = 88 is already configured in pyproject.toml, and target-version can also be configured there (e.g., target-version = "py38"), passing these options as command-line arguments in noxfile.py is redundant. Relying on pyproject.toml simplifies the noxfile.py configuration and avoids package-specific variable name discrepancies (such as UNIT_TEST_PYTHON_VERSIONS vs ALL_PYTHON).

    session.run(
        "ruff",
        "format",
        *LINT_PATHS,
    )


Expand All @@ -194,7 +200,7 @@ def format(session):
"--select",
"I",
"--fix",
f"--target-version=py{UNIT_TEST_PYTHON_VERSIONS[0].replace('.', '')}",
f"--target-version=py{ALL_PYTHON[0].replace('.', '')}",
"--line-length=88",
*LINT_PATHS,
)
Expand All @@ -203,7 +209,7 @@ def format(session):
session.run(
"ruff",
"format",
f"--target-version=py{UNIT_TEST_PYTHON_VERSIONS[0].replace('.', '')}",
f"--target-version=py{ALL_PYTHON[0].replace('.', '')}",
"--line-length=88",
*LINT_PATHS,
)
Expand Down
23 changes: 23 additions & 0 deletions packages/pandas-gbq/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Copyright 2026 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.ruff]
line-length = 88

[tool.ruff.lint]
select = ["I"]
17 changes: 10 additions & 7 deletions packages/sqlalchemy-bigquery/noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@
import nox

FLAKE8_VERSION = "flake8==6.1.0"
BLACK_VERSION = "black[jupyter]==23.7.0"
RUFF_VERSION = "ruff==0.14.14"
ISORT_VERSION = "isort==5.11.0"
LINT_PATHS = [
"third_party",
"docs",
Expand Down Expand Up @@ -213,13 +211,18 @@ def lint(session):
@nox.session(python=DEFAULT_PYTHON_VERSION)
@_calculate_duration
def blacken(session):
"""Run black. Format code to uniform standard."""
session.install(BLACK_VERSION)

session.run("python", "-m", "pip", "freeze")
"""(Deprecated) Legacy session. Please use 'nox -s format'."""
session.log(
"WARNING: The 'blacken' session is deprecated and will be removed in a future release. Please use 'nox -s format' in the future."
)

# Just run the ruff formatter (keeping legacy behavior of only formatting, not sorting imports)
session.install(RUFF_VERSION)
session.run(
"black",
"ruff",
"format",
f"--target-version=py{UNIT_TEST_PYTHON_VERSIONS[0].replace('.', '')}",
"--line-length=88",
*LINT_PATHS,
)

Expand Down
6 changes: 6 additions & 0 deletions packages/sqlalchemy-bigquery/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,9 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.ruff]
line-length = 88

[tool.ruff.lint]
select = ["I"]
Loading