matrix:
# emulated wheels on linux take too much time, split wheels into multiple runs
python:
- - "cp37-* cp38-*"
+ - "cp38-*"
- "cp39-* cp310-*"
- "cp311-* cp312-*"
wheel_mode:
- "windows-latest"
- "macos-latest"
python-version:
- - "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- - "pypy-3.9"
+ - "pypy-3.10"
build-type:
- "cext"
- "nocext"
include:
# autocommit tests fail on the ci for some reason
- - python-version: "pypy-3.9"
+ - python-version: "pypy-3.10"
pytest-args: "-k 'not test_autocommit_on and not test_turn_autocommit_off_via_default_iso_level and not test_autocommit_isolation_level'"
- os: "ubuntu-latest"
pytest-args: "--dbdriver pysqlite --dbdriver aiosqlite"
- os: "macos-latest"
architecture: x86
# pypy does not have cext or x86
- - python-version: "pypy-3.9"
+ - python-version: "pypy-3.10"
build-type: "cext"
- os: "windows-latest"
- python-version: "pypy-3.9"
+ python-version: "pypy-3.10"
architecture: x86
fail-fast: false
- name: Run tests
run: tox -e github-${{ matrix.build-type }} -- -q --nomemory --notimingintensive ${{ matrix.pytest-args }}
- continue-on-error: ${{ matrix.python-version == 'pypy-3.9' }}
+ continue-on-error: ${{ matrix.python-version == 'pypy-3.10' }}
run-test-arm64:
name: test-arm64-${{ matrix.python-version }}-${{ matrix.build-type }}-${{ matrix.os }}
strategy:
matrix:
python-version:
- - cp37-cp37m
- cp38-cp38
- cp39-cp39
- cp310-cp310
- cp311-cp311
+ - cp312-cp312
build-type:
- "cext"
- "nocext"
For more elaborate CI-style test running, the tox script provided will
run against various Python / database targets. For a basic run against
-Python 3.8 using an in-memory SQLite database::
+Python 3.11 using an in-memory SQLite database::
- tox -e py38-sqlite
+ tox -e py311-sqlite
The tox runner contains a series of target combinations that can run
against various combinations of databases. The test suite can be
run against SQLite with "backend" tests also running against a PostgreSQL
database::
- tox -e py38-sqlite-postgresql
+ tox -e py311-sqlite-postgresql
Or to run just "backend" tests against a MySQL database::
- tox -e py38-mysql-backendonly
+ tox -e py311-mysql-backendonly
Running against backends other than SQLite requires that a database of that
vendor be available at a specific URL. See "Setting Up Databases" below
[db]
postgresql=postgresql+psycopg2://username:pass@hostname/dbname
-Now when we run ``tox -e py38-postgresql``, it will use our custom URL instead
+Now when we run ``tox -e py311-postgresql``, it will use our custom URL instead
of the fixed one in setup.cfg.
Database Configuration
child_id: Mapped[int] = mapped_column(primary_key=True)
parent_id: Mapped[int] = mapped_column(ForeignKey("parent.id"))
-.. note:: If using Python 3.7 or 3.8, annotations for collections need
+.. note:: If using Python 3.8, annotations for collections need
to use ``typing.List`` or ``typing.Set``, e.g. ``Mapped[List["Child"]]`` or
``Mapped[Set["Child"]]``; the ``list`` and ``set`` Python built-ins
don't yet support generic annotation in these Python versions, such as::
return None
return re.search(a, b) is not None
- if util.py38 and self._get_server_version_info(None) >= (3, 9):
+ if self._get_server_version_info(None) >= (3, 9):
# sqlite must be greater than 3.8.3 for deterministic=True
# https://docs.python.org/3/library/sqlite3.html#sqlite3.Connection.create_function
# the check is more conservative since there were still issues
from typing import Union
from .util import py311
-from .util import py38
from .util.typing import Literal
-if py38:
- STACKLEVEL = True
- # needed as of py3.11.0b1
- # #8019
- STACKLEVEL_OFFSET = 2 if py311 else 1
-else:
- STACKLEVEL = False
- STACKLEVEL_OFFSET = 0
+STACKLEVEL = True
+# needed as of py3.11.0b1
+# #8019
+STACKLEVEL_OFFSET = 2 if py311 else 1
_IT = TypeVar("_IT", bound="Identified")
2. For each class, yield the attributes in the order in which they
appear in ``__dict__``, with the exception of those in step
- 3 below. In Python 3.6 and above this ordering will be the
+ 3 below. The order will be the
same as that of the class' construction, with the exception
of attributes that were added after the fact by the application
or the mapper.
return exclusions.skip_if(check)
- @property
- def python38(self):
- return exclusions.only_if(
- lambda: util.py38, "Python 3.8 or above required"
- )
-
@property
def python39(self):
return exclusions.only_if(
from .compat import py310 as py310
from .compat import py311 as py311
from .compat import py312 as py312
-from .compat import py38 as py38
from .compat import py39 as py39
from .compat import pypy as pypy
from .compat import win32 as win32
import base64
import dataclasses
import hashlib
+from importlib import metadata as importlib_metadata
import inspect
import operator
import platform
from typing import Type
from typing import TypeVar
-
py312 = sys.version_info >= (3, 12)
py311 = sys.version_info >= (3, 11)
py310 = sys.version_info >= (3, 10)
py39 = sys.version_info >= (3, 9)
-py38 = sys.version_info >= (3, 8)
pypy = platform.python_implementation() == "PyPy"
cpython = platform.python_implementation() == "CPython"
return hashlib.md5()
-if typing.TYPE_CHECKING or py38:
- from importlib import metadata as importlib_metadata
-else:
- import importlib_metadata # noqa
-
-
if typing.TYPE_CHECKING or py39:
# pep 584 dict union
dict_union = operator.or_ # noqa
def get_annotations(obj: Any) -> Mapping[str, Any]:
# it's been observed that cls.__annotations__ can be non present.
- # it's not clear what causes this, running under tox py37/38 it
+ # it's not clear what causes this, running under tox py38 it
# happens, running straight pytest it doesnt
# https://docs.python.org/3/howto/annotations.html#annotations-howto
[tool.black]
line-length = 79
-target-version = ['py37']
+target-version = ['py38']
[tool.zimports]
black-line-length = 79
test-command = "python -s -m pytest -c {project}/pyproject.toml -n2 -q --nomemory --notimingintensive --nomypy {project}/test"
build = "*"
-# python 3.6 is no longer supported by sqlalchemy
+# python 3.6, 3.7 are no longer supported by sqlalchemy
# pypy uses the universal wheel fallback, since it does not use any compiled extension
-skip = "cp36-* pp*"
+skip = "cp36-* cp37-* pp*"
# TODO: remove this skip once action support arm macs
test-skip = "*-macosx_arm64"
"setup_asyncpg_jsonb_codec",
argnames="methname",
)
- @testing.requires.python38
@async_test
async def test_codec_registration(
self, metadata, async_testing_engine, methname
"mytable", column("myid", Integer), column("name", String)
)
- def _only_on_py38_w_sqlite_39():
- """in python 3.9 and above you can actually do::
-
- @(testing.requires.python38 + testing.only_on("sqlite > 3.9"))
- def test_determinsitic_parameter(self):
- ...
-
- that'll be cool. until then...
-
- """
- return testing.requires.python38 + testing.only_on("sqlite >= 3.9")
-
- @_only_on_py38_w_sqlite_39()
+ @testing.only_on("sqlite >= 3.9")
def test_determinsitic_parameter(self):
"""for #9379, make sure that "deterministic=True" is used when we are
on python 3.8 with modern SQLite version.
]
)
- @testing.requires.python38
def test_log_messages_have_correct_metadata_plain(
self, plain_logging_engine
):
"""test #7612"""
self._test_log_messages_have_correct_metadata(plain_logging_engine)
- @testing.requires.python38
def test_log_messages_have_correct_metadata_echo(self, logging_engine):
"""test #7612"""
self._test_log_messages_have_correct_metadata(logging_engine)
-# PYTHON_VERSION>=3.7
-
from __future__ import annotations
from dataclasses import dataclass
-import collections
import collections.abc as collections_abc
from contextlib import contextmanager
import csv
row = result.first()
dict_row = row._asdict()
- # dictionaries aren't ordered in Python 3 until 3.7
- odict_row = collections.OrderedDict(
- [("user_id", 1), ("user_name", "foo")]
- )
+ odict_row = dict([("user_id", 1), ("user_name", "foo")])
eq_(dict_row, odict_row)
mapping_row = row._mapping
mysql: EXTRA_MYSQL_DRIVERS={env:EXTRA_MYSQL_DRIVERS:--dbdriver mysqldb --dbdriver pymysql --dbdriver asyncmy --dbdriver aiomysql --dbdriver mariadbconnector}
mssql: MSSQL={env:TOX_MSSQL:--db mssql}
- py{3,37,38,39,310,311}-mssql: EXTRA_MSSQL_DRIVERS={env:EXTRA_MSSQL_DRIVERS:--dbdriver pyodbc --dbdriver aioodbc --dbdriver pymssql}
+ py{3,38,39,310,311}-mssql: EXTRA_MSSQL_DRIVERS={env:EXTRA_MSSQL_DRIVERS:--dbdriver pyodbc --dbdriver aioodbc --dbdriver pymssql}
py312-mssql: EXTRA_MSSQL_DRIVERS={env:EXTRA_MSSQL_DRIVERS:--dbdriver pyodbc --dbdriver aioodbc}
oracle,mssql,sqlite_file: IDENTS=--write-idents db_idents.txt
[testenv:pep484]
deps=
greenlet != 0.4.17
- importlib_metadata; python_version < '3.8'
mypy >= 1.6.0
commands =
mypy {env:MYPY_COLOR} ./lib/sqlalchemy
pytest>=7.0.0rc1,<8
pytest-xdist
greenlet != 0.4.17
- importlib_metadata; python_version < '3.8'
mypy >= 1.2.0
patch==1.*