We are stuck on flake8 because we rely on many plugins with
specific behaviors. The situation has calcified where:
1. the whole world uses ruff
2. nobody cares about import order linting or all the other stuff
we do, and/or similar but not quite the same things are embedded
deeply into ruff which would require us giving up a lot of our
standards (like isort)
3. flake8 is absolutely never going to support pyproject.
4. flake8-pyproject works for this
beyond that, for t string support we want to make it easy
to get onto py3.14, so here we update black to the latest which
appears to fix some missing symbols for py3.14 t strings.
we should also migrate the remaining sqlalchemy test config
from setup.cfg to pyproject.toml but that should likely be
2.1 only
Change-Id: I896a7c839148d0ef516728c73baddc8eddf5ee96
(cherry picked from commit
f6714c8e090b9dd84ac4256ed74eefc1fe9cbddc)
# See https://pre-commit.com/hooks.html for more hooks
repos:
- repo: https://github.com/python/black
- rev: 25.9.0
+ rev: 25.11.0
hooks:
- id: black
rev: 7.3.0
hooks:
- id: flake8
+ entry: python -m flake8p
additional_dependencies:
+ - flake8-pyproject
- flake8-import-order>=0.19.2
- flake8-import-single==0.1.5
- flake8-builtins
session.install(*nox.project.dependency_groups(pyproject, "lint"))
for cmd in [
- "flake8 ./lib/ ./test/ ./examples/ noxfile.py "
+ "flake8p ./lib/ ./test/ ./examples/ noxfile.py "
"setup.py doc/build/conf.py",
- "flake8 --extend-ignore='' ./lib/sqlalchemy/ext/asyncio "
+ # run "unused argument" lints on asyncio, as we have a lot of
+ # proxy methods here
+ "flake8p --ignore='' --select='U100,U101' "
+ "./lib/sqlalchemy/ext/asyncio "
"./lib/sqlalchemy/orm/scoping.py",
"black --check ./lib/ ./test/ ./examples/ setup.py doc/build/conf.py",
"slotscheck -m sqlalchemy",
lint = [
{include-group = "tests-greenlet"},
- "flake8>=7.2.0",
+ "flake8>=7.3.0",
+ "flake8-pyproject",
"flake8-import-order>=0.19.2",
"flake8-import-single==0.1.5",
"flake8-builtins",
"flake8-rst-docstrings",
"pydocstyle<4.0.0",
"pygments",
- "black==25.1.0",
+ "black==25.11.0",
"slotscheck>=0.17.0",
"zimports>=0.6.3", # required by generate_tuple_map_overloads
]
[tool.zimports]
black-line-length = 79
+
+[tool.flake8]
+show-source = false
+enable-extensions = "G"
+
+# E203 is due to https://github.com/PyCQA/pycodestyle/issues/373
+ignore = [
+ "A003","A005",
+ "D",
+ "E203","E305","E701","E704","E711","E712","E721","E722","E741",
+ "I300",
+ "N801","N802","N806",
+ "RST304","RST303","RST299","RST399",
+ "W503","W504","W601",
+ "U100","U101"
+]
+
+exclude = [".venv",".git",".tox","dist","doc","*egg","build"]
+import-order-style = "google"
+application-import-names = ["sqlalchemy","test"]
+per-file-ignores =[
+ "**/__init__.py:F401",
+ "test/*:FA100",
+ "test/typing/plain_files/*:F821,E501,FA100",
+ "test/ext/mypy/plugin_files/*:F821,E501,FA100",
+ "lib/sqlalchemy/events.py:F401",
+ "lib/sqlalchemy/schema.py:F401",
+ "lib/sqlalchemy/types.py:F401",
+ "lib/sqlalchemy/sql/expression.py:F401",
+ "lib/sqlalchemy/util/typing.py:F401"
+]
+
+unused-arguments-ignore-stub-functions=true
+unused-arguments-ignore-dunder=true
+
[tool.slotscheck]
exclude-modules = '''
^sqlalchemy\.(
sign = 1
identity = C4DAFEE1
-[flake8]
-show-source = false
-enable-extensions = G
-
-# E203 is due to https://github.com/PyCQA/pycodestyle/issues/373
-ignore =
- A003,A005
- D,
- E203,E305,E701,E704,E711,E712,E721,E722,E741,
- I300,
- N801,N802,N806,
- RST304,RST303,RST299,RST399,
- W503,W504,W601
-extend-ignore =
- # keep in extend ignore so that they can be enabled in a subset of files in the tox run
- U100,U101
-exclude = .venv,.git,.tox,dist,doc,*egg,build
-import-order-style = google
-application-import-names = sqlalchemy,test
-per-file-ignores =
- **/__init__.py:F401
- test/*:FA100
- test/typing/plain_files/*:F821,E501,FA100
- test/ext/mypy/plugin_files/*:F821,E501,FA100
- lib/sqlalchemy/events.py:F401
- lib/sqlalchemy/schema.py:F401
- lib/sqlalchemy/types.py:F401
- lib/sqlalchemy/sql/expression.py:F401
- lib/sqlalchemy/util/typing.py:F401
-
-unused-arguments-ignore-stub-functions=true
-unused-arguments-ignore-dunder=true
-
[sqla_testing]
requirement_cls = test.requirements:DefaultRequirements
profile_file = test/profiles.txt
{[greenletextras]extras}
deps=
+ flake8-pyproject
flake8>=7.3.0
flake8-import-order>=0.19.2
flake8-builtins
# in case it requires a version pin
pydocstyle
pygments
- black==25.9.0
+ black==25.11.0
slotscheck>=0.17.0
# required by generate_tuple_map_overloads
git
sh
commands =
- flake8 ./lib/ ./test/ ./examples/ setup.py doc/build/conf.py {posargs}
- # run flake8-unused-arguments only on some files / modules
- flake8 --extend-ignore='' ./lib/sqlalchemy/ext/asyncio ./lib/sqlalchemy/orm/scoping.py
+ flake8p ./lib/ ./test/ ./examples/ setup.py doc/build/conf.py {posargs}
+
+ # run "unused argument" lints on asyncio, as we have a lot of
+ # proxy methods here
+ flake8p --ignore='' --select='U100,U101' ./lib/sqlalchemy/ext/asyncio ./lib/sqlalchemy/orm/scoping.py
+
black --check ./lib/ ./test/ ./examples/ setup.py doc/build/conf.py
# test with cython and without cython exts running
slotscheck -m sqlalchemy