1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242
|
[build-system]
build-backend = "setuptools.build_meta"
requires = [
"setuptools>=61.0",
"cython>=0.29.24; platform_python_implementation == 'CPython'", # Skip cython when using pypy
]
[dependency-groups]
tests = [
"pytest>=7.0.0,<10",
"pytest-xdist",
]
coverage = ["pytest-cov"]
tests-greenlet = ["sqlalchemy[asyncio]"]
tests-sqlite = []
tests-sqlite-asyncio = [
{include-group = "tests-greenlet"},
{include-group = "tests-sqlite"},
"sqlalchemy[aiosqlite]"
]
tests-sqlite-file = [{include-group = "tests-sqlite"}]
tests-sqlite-file-asyncio = [{include-group = "tests-sqlite-asyncio"}]
tests-postgresql = [
"sqlalchemy[postgresql]",
"sqlalchemy[postgresql-psycopg]",
"sqlalchemy[postgresql-pg8000]",
]
tests-postgresql-asyncio = [
{include-group = "tests-greenlet"},
{include-group = "tests-postgresql"},
"sqlalchemy[postgresql-asyncpg]"
]
tests-mysql = [
"sqlalchemy[mysql]",
"sqlalchemy[pymysql]",
"sqlalchemy[mysql-connector]",
# originally to fix https://jira.mariadb.org/browse/CONPY-318,
# more recent versions still have attribute errors and other random
# problems
"mariadb>=1.0.1,!=1.1.2,!=1.1.5,!=1.1.10,<1.1.13",
]
tests-mysql-asyncio = [
{include-group = "tests-greenlet"},
{include-group = "tests-mysql"},
"sqlalchemy[aiomysql]",
"sqlalchemy[asyncmy]",
]
tests-oracle-asyncio = [
{include-group = "tests-greenlet"},
{include-group = "tests-oracle"},
]
tests-oracle = [
"sqlalchemy[oracle]",
"sqlalchemy[oracle-oracledb]",
]
tests-mssql = [
"sqlalchemy[mssql]",
"sqlalchemy[mssql-pymssql]",
]
tests-mssql-asyncio = [
{include-group = "tests-greenlet"},
{include-group = "tests-mssql"},
"aioodbc"
]
lint = [
{include-group = "tests-greenlet"},
"flake8>=7.3.0",
"flake8-pyproject",
"flake8-import-order>=0.19.2",
"flake8-import-single==0.1.5",
"flake8-builtins",
"flake8-future-annotations>=0.0.5",
"flake8-docstrings",
"flake8-unused-arguments",
"flake8-rst-docstrings",
"pydocstyle<4.0.0",
"pygments",
"black==25.11.0",
"slotscheck>=0.17.0",
"zimports>=0.7.0", # required by generate_tuple_map_overloads
]
mypy = [
{include-group = "tests-greenlet"},
"mypy>=1.19.0",
"nox", # because we check noxfile.py
"pytest>8,<10", # alembic/testing imports pytest
"types-greenlet",
]
[tool.black]
line-length = 79
target-version = ['py37']
[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\.(
testing
|ext\.mypy # see slotscheck/issues/178
)
'''
# disable isort, for IDEs that just default isort to be turned on, e.g. vscode.
# we use flake8-import-order for import sorting, using zimports to actually
# reformat code. isort is nicer in many ways but doesn't have our
# "import *" fixer and also is not 100% compatible with flake8-import-order.
[tool.isort]
skip_glob=['*']
[tool.pytest.ini_options]
addopts = "--tb native -v -r sfxX --maxfail=250 -p warnings -p logging --strict-markers"
norecursedirs = "examples build doc lib"
python_files = "test_*.py"
minversion = "6.2"
filterwarnings = [
# NOTE: additional SQLAlchemy specific filters in
# sqlalchemy/testing/warnings.py. SQLAlchemy modules cannot be named
# here as pytest loads them immediately, which breaks coverage as well
# as sys.path adjustments in conftest.py
"error::DeprecationWarning:test",
"error::DeprecationWarning:sqlalchemy",
# sqlite3 warnings due to test/dialect/test_sqlite.py->test_native_datetime,
# which is asserting that these deprecated-in-py312 handlers are functional
"ignore:The default (date)?(time)?(stamp)? (adapter|converter):DeprecationWarning",
# warning regarding using "fork" mode for multiprocessing when the parent
# has threads; using pytest-xdist introduces threads in the parent
# and we use multiprocessing in test/aaa_profiling/test_memusage.py where
# we require "fork" mode
# https://github.com/python/cpython/pull/100229#issuecomment-2704616288
"ignore:This process .* is multi-threaded:DeprecationWarning",
]
markers = [
"memory_intensive: memory / CPU intensive suite tests",
"mypy: mypy integration / plugin tests",
"timing_intensive: time-oriented tests that are sensitive to race conditions",
"backend: tests that should run on all backends; typically dialect-sensitive",
"sparse_backend: tests that should run on just one backend for each kind of db",
"sparse_driver_backend: tests that should run on just one kind of driver for each kind of db",
"gc_intensive: needs extremely predictable GC behavior",
]
[tool.pyright]
reportPrivateUsage = "none"
reportUnusedClass = "none"
reportUnusedFunction = "none"
reportTypedDictNotRequiredAccess = "warning"
[tool.mypy]
mypy_path = "./lib/"
show_error_codes = true
incremental = true
# would be nice to enable this but too many error are surfaceds
# enable_error_code = "ignore-without-code"
[[tool.mypy.overrides]]
module = [
"sqlalchemy.*"
]
warn_unused_ignores = true
strict = true
[tool.cibuildwheel]
test-requires = "pytest pytest-xdist"
# remove user site, otherwise the local checkout has precedence, disabling cyextensions
test-command = "python -s -m pytest -c {project}/pyproject.toml -n4 -q --nomemory --notimingintensive --nomypy {project}/test"
build = "*"
# python 3.6 is no longer supported by sqlalchemy
# pypy uses the universal wheel fallback, since it does not use any compiled extension
skip = "cp36-* pp*"
# TODO: remove this skip once action support arm macs
test-skip = "*-macosx_arm64"
[tool.cibuildwheel.macos]
archs = ["x86_64", "arm64"]
# On an Linux Intel runner with qemu installed, build Intel and ARM wheels
# NOTE: this is overriden in the pipeline using the CIBW_ARCHS_LINUX env variable to speed up the build
[tool.cibuildwheel.linux]
archs = ["x86_64", "aarch64"]
|