From 1f521836fe7458fd1b964fd0537f8e153b8c7302 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Swe=C3=B1a?= Date: Thu, 12 Nov 2026 17:13:57 +0000 Subject: [PATCH] chore(bigquery): sync bigquery ruff with the global config --- packages/bigquery-magics/noxfile.py | 16 +++++++++---- packages/bigquery-magics/pyproject.toml | 23 ++++++++++++++++++ packages/db-dtypes/noxfile.py | 17 ++++++++----- packages/db-dtypes/pyproject.toml | 23 ++++++++++++++++++ packages/google-cloud-bigquery/pyproject.toml | 6 +++++ packages/pandas-gbq/noxfile.py | 24 ++++++++++++------- packages/pandas-gbq/pyproject.toml | 23 ++++++++++++++++++ packages/sqlalchemy-bigquery/noxfile.py | 17 +++++++------ packages/sqlalchemy-bigquery/pyproject.toml | 6 +++++ 9 files changed, 128 insertions(+), 27 deletions(-) create mode 100644 packages/bigquery-magics/pyproject.toml create mode 100644 packages/db-dtypes/pyproject.toml create mode 100644 packages/pandas-gbq/pyproject.toml diff --git a/packages/bigquery-magics/noxfile.py b/packages/bigquery-magics/noxfile.py index 19f9bc94a935..e9d5e6e3e754 100644 --- a/packages/bigquery-magics/noxfile.py +++ b/packages/bigquery-magics/noxfile.py @@ -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" @@ -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, ) diff --git a/packages/bigquery-magics/pyproject.toml b/packages/bigquery-magics/pyproject.toml new file mode 100644 index 000000000000..47be2f24b39b --- /dev/null +++ b/packages/bigquery-magics/pyproject.toml @@ -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"] diff --git a/packages/db-dtypes/noxfile.py b/packages/db-dtypes/noxfile.py index fca37e128fea..46b2dd14175d 100644 --- a/packages/db-dtypes/noxfile.py +++ b/packages/db-dtypes/noxfile.py @@ -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 @@ -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, ) diff --git a/packages/db-dtypes/pyproject.toml b/packages/db-dtypes/pyproject.toml new file mode 100644 index 000000000000..47be2f24b39b --- /dev/null +++ b/packages/db-dtypes/pyproject.toml @@ -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"] diff --git a/packages/google-cloud-bigquery/pyproject.toml b/packages/google-cloud-bigquery/pyproject.toml index b0936b70c72b..786627dfbde1 100644 --- a/packages/google-cloud-bigquery/pyproject.toml +++ b/packages/google-cloud-bigquery/pyproject.toml @@ -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"] diff --git a/packages/pandas-gbq/noxfile.py b/packages/pandas-gbq/noxfile.py index cb3264e31406..79a084d4faee 100644 --- a/packages/pandas-gbq/noxfile.py +++ b/packages/pandas-gbq/noxfile.py @@ -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"] @@ -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, ) @@ -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, ) @@ -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, ) @@ -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, ) @@ -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, ) diff --git a/packages/pandas-gbq/pyproject.toml b/packages/pandas-gbq/pyproject.toml new file mode 100644 index 000000000000..47be2f24b39b --- /dev/null +++ b/packages/pandas-gbq/pyproject.toml @@ -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"] diff --git a/packages/sqlalchemy-bigquery/noxfile.py b/packages/sqlalchemy-bigquery/noxfile.py index ccc59a494b32..a1ac5824103f 100644 --- a/packages/sqlalchemy-bigquery/noxfile.py +++ b/packages/sqlalchemy-bigquery/noxfile.py @@ -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", @@ -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, ) diff --git a/packages/sqlalchemy-bigquery/pyproject.toml b/packages/sqlalchemy-bigquery/pyproject.toml index 0a21fc9ce7f6..285feb7c02e1 100644 --- a/packages/sqlalchemy-bigquery/pyproject.toml +++ b/packages/sqlalchemy-bigquery/pyproject.toml @@ -3,3 +3,9 @@ [build-system] requires = ["setuptools"] build-backend = "setuptools.build_meta" + +[tool.ruff] +line-length = 88 + +[tool.ruff.lint] +select = ["I"]