Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

- Add support for Python 3.12, 3.13. - Drop support for Python 3.7. #83

Open
wants to merge 36 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 15 commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
4c56177
Drop support for Python 3.7.
icemac Jul 18, 2024
b475167
Drop support for Python {3.7,3.8,3.9,3.10,3.11}-sqlalchemy{14,20}.
icemac Jul 18, 2024
c9a1fcf
Drop support for Python {3.7,3.8,3.9,3.10}-sqlalchemy{12,13.}.
icemac Jul 18, 2024
011d370
Drop support for Python {3.7,3.8,3.9}-sqlalchemy11.
icemac Jul 18, 2024
403f89a
Add support for Python 3.12.
icemac Jul 18, 2024
57bf133
Configuring for zope-product
icemac Jul 18, 2024
62698ff
Update Python version support.
icemac Jul 18, 2024
b9839b6
Trigger GHA.
icemac Sep 18, 2024
7f082fa
Merge branch 'master' into config-with-zope-product-template-6e808865
icemac Sep 20, 2024
4790583
Drop support for Python {3.8,3.9,3.10,3.11,3.12}-sqlalchemy{14,20}.
icemac Sep 20, 2024
be6d62c
Drop support for Python {3.8,3.9,3.10}-sqlalchemy{12,13.}.
icemac Sep 20, 2024
ded31bf
Drop support for Python {3.8,3.9}-sqlalchemy11.
icemac Sep 20, 2024
f77cd05
Add support for Python 3.13.
icemac Sep 20, 2024
3403508
Configuring for zope-product
icemac Sep 20, 2024
0836c89
Update Python version support.
icemac Sep 20, 2024
470d4d1
Use Python 3.13 compatible function.
icemac Sep 20, 2024
c25ccd0
Improve SQLAlchemy version requirements readability.
icemac Sep 23, 2024
3ab57e2
2.0.31 does not run on Python 3.12.
icemac Nov 5, 2024
43e8815
2.0.36 also runs into a deadlock.
icemac Nov 6, 2024
777e043
Exclude another non Py 3.12 version.
icemac Nov 11, 2024
9ce6dd2
2.0.29 does not work with Python 3.12.
icemac Nov 12, 2024
15d1341
Blacklist 2.0.28.
icemac Nov 20, 2024
48ca41a
Blacklist 2.0.27
icemac Nov 21, 2024
2c7317d
Blacklist 2.0.26.
icemac Nov 22, 2024
51d1b83
Blacklist 2.0.25.
icemac Nov 27, 2024
d808b44
Blacklist 2.0.24.
icemac Nov 29, 2024
a8944e8
Blacklist 2.0.23.
icemac Dec 3, 2024
96352fa
Blacklist: 2.0.22
icemac Dec 6, 2024
a81f7f0
Blacklist: 2.0.21
icemac Dec 9, 2024
4c781c1
Blacklist 2.0.20.
icemac Dec 20, 2024
0268dee
Blacklist 2.0.19.
icemac Jan 15, 2025
10efda0
Try if PostgreSQL 15 still exists.
icemac Jan 17, 2025
0037105
Show existing postgres versions.
icemac Jan 17, 2025
3b6bf2f
Try to install postgres before using it.
icemac Jan 17, 2025
d93ea47
2nd attempt
icemac Jan 17, 2025
767ea67
It installed version 16.
icemac Jan 17, 2025
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
33 changes: 33 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/zope-product
name: pre-commit

on:
pull_request:
push:
branches:
- master
# Allow to run this workflow manually from the Actions tab
workflow_dispatch:

env:
FORCE_COLOR: 1

jobs:
pre-commit:
name: linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: 3.x
- uses: pre-commit/[email protected]
with:
extra_args: --all-files --show-diff-on-failure
env:
PRE_COMMIT_COLOR: always
- uses: pre-commit-ci/[email protected]
if: always()
with:
msg: Apply pre-commit code formatting
28 changes: 17 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@ jobs:
fail-fast: false
matrix:
os:
- ["ubuntu", "ubuntu-20.04"]
- ["ubuntu", "ubuntu-latest"]
config:
# [Python version, tox env]
- ["3.9", "lint"]
- ["3.7", "py37"]
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["3.11", "py311"]
- ["3.9", "coverage"]
- ["3.11", "release-check"]
- ["3.8", "py38"]
- ["3.9", "py39"]
- ["3.10", "py310"]
- ["3.11", "py311"]
- ["3.12", "py312"]
- ["3.13", "py313"]
- ["3.11", "coverage"]

runs-on: ${{ matrix.os[1] }}
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
Expand All @@ -42,13 +43,14 @@ jobs:
sudo su - postgres -c '/usr/lib/postgresql/14/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start'
sudo su - postgres -c '/usr/lib/postgresql/14/bin/createdb zope_sqlalchemy_tests'
sudo su - postgres -c '/usr/lib/postgresql/14/bin/psql -l'
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.config[0] }}
allow-prereleases: true
- name: Pip cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ matrix.config[0] }}-${{ hashFiles('setup.*', 'tox.ini') }}
Expand All @@ -60,8 +62,12 @@ jobs:
python -m pip install --upgrade pip
pip install tox
- name: Test
if: ${{ !startsWith(runner.os, 'Mac') }}
run: |
tox -f ${{ matrix.config[1] }}
- name: Test (macOS)
if: ${{ startsWith(runner.os, 'Mac') }}
run: tox -e ${{ matrix.config[1] }}-universal2
- name: Coverage
if: matrix.config[1] == 'coverage'
run: |
Expand Down
9 changes: 5 additions & 4 deletions .meta.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,24 @@
# https://github.com/zopefoundation/meta/tree/master/config/zope-product
[meta]
template = "zope-product"
commit-id = "1dc6b9e7"
commit-id = "85622de1"

[python]
with-pypy = false
with-sphinx-doctests = false
with-windows = false
with-future-python = false
with-macos = false
with-docs = false

[coverage]
fail-under = 65

[tox]
additional-envlist = [
"py{37,38,39}-sqlalchemy11",
"py{37,38,39,310}-sqlalchemy{12,13}",
"py{37,38,39,310,311}-sqlalchemy{14,20}",
"py{38,39}-sqlalchemy11",
"py{38,39,310}-sqlalchemy{12,13}",
"py{38,39,310,311,312,313}-sqlalchemy{14,20}",
]
testenv-deps = [
"sqlalchemy11: SQLAlchemy==1.1.*",
Expand Down
28 changes: 28 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/zope-product
minimum_pre_commit_version: '3.6'
repos:
- repo: https://github.com/pycqa/isort
rev: "5.13.2"
hooks:
- id: isort
- repo: https://github.com/hhatto/autopep8
rev: "v2.3.1"
hooks:
- id: autopep8
args: [--in-place, --aggressive, --aggressive]
- repo: https://github.com/asottile/pyupgrade
rev: v3.17.0
hooks:
- id: pyupgrade
args: [--py38-plus]
- repo: https://github.com/isidentical/teyit
rev: 0.4.3
hooks:
- id: teyit
- repo: https://github.com/PyCQA/flake8
rev: "7.1.1"
hooks:
- id: flake8
additional_dependencies:
- flake8-debugger == 4.1.2
4 changes: 4 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ Changes
3.2 (unreleased)
dataflake marked this conversation as resolved.
Show resolved Hide resolved
----------------

- Add support for Python 3.12, 3.13.

- Drop support for Python 3.7.

- SQLAlchemy's versions 2.0.32 up to 2.0.35 run into dead locks when running
the tests on Python 3.11+, so excluding them from the list of supported
versions.
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ include *.rst
include *.txt
include buildout.cfg
include tox.ini
include .pre-commit-config.yaml

recursive-include src *.py
include github_actions.cfg
Expand Down
22 changes: 22 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/zope-product

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

[tool.coverage]
[tool.coverage.run]
branch = true
source = ["zope.sqlalchemy"]

[tool.coverage.report]
fail_under = 65
precision = 2
ignore_errors = true
show_missing = true
exclude_lines = ["pragma: no cover", "pragma: nocover", "except ImportError:", "raise NotImplementedError", "if __name__ == '__main__':", "self.fail", "raise AssertionError", "raise unittest.Skip"]

[tool.coverage.html]
directory = "parts/htmlcov"
4 changes: 1 addition & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
# Generated from:
# https://github.com/zopefoundation/meta/tree/master/config/zope-product
[bdist_wheel]
universal = 0

[flake8]
doctests = 1
Expand All @@ -17,7 +15,7 @@ ignore =
force_single_line = True
combine_as_imports = True
sections = FUTURE,STDLIB,THIRDPARTY,ZOPE,FIRSTPARTY,LOCALFOLDER
known_third_party = six, docutils, pkg_resources, pytz
known_third_party = docutils, pkg_resources, pytz
known_zope =
known_first_party =
default_section = ZOPE
Expand Down
9 changes: 4 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,12 @@
namespace_packages=['zope'],
test_suite='zope.sqlalchemy.tests.test_suite',
author='Laurence Rowe',

author_email='[email protected]',
url='https://github.com/zopefoundation/zope.sqlalchemy',
description="Minimal Zope/SQLAlchemy transaction integration",
long_description=(
open(os.path.join('src', 'zope', 'sqlalchemy', 'README.rst')).read() +
"\n\n" +
open('CHANGES.rst').read()),
"\n\n" + open('CHANGES.rst').read()),
license='ZPL 2.1',
keywords='zope zope3 sqlalchemy',
classifiers=[
Expand All @@ -35,16 +33,17 @@
"License :: OSI Approved :: Zope Public License",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: Implementation :: CPython",
"Topic :: Database",
"Topic :: Software Development :: Libraries :: Python Modules",
],
python_requires='>=3.7',
python_requires='>=3.8',
install_requires=[
'packaging',
'setuptools',
Expand Down
47 changes: 32 additions & 15 deletions src/zope/sqlalchemy/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ def testMarkUnknownSession(self):
DummyDataManager(key="dummy.first")
session = Session()
mark_changed(session)
self.assertTrue(session in zope.sqlalchemy.datamanager._SESSION_STATE)
self.assertIn(session, zope.sqlalchemy.datamanager._SESSION_STATE)

def testAbortBeforeCommit(self):
# Simulate what happens in a conflict error
Expand Down Expand Up @@ -399,18 +399,27 @@ def testSavepoint(self):
s1 = t.savepoint()
session.add(User(id=1, firstname="udo", lastname="juergens"))
session.flush()
self.assertTrue(len(query.all()) == 1,
"Users table should have one row")
self.assertEqual(
len(query.all()),
1,
"Users table should have one row"
)

s2 = t.savepoint()
session.add(User(id=2, firstname="heino", lastname="n/a"))
session.flush()
self.assertTrue(len(query.all()) == 2,
"Users table should have two rows")
self.assertEqual(
len(query.all()),
2,
"Users table should have two rows"
)

s2.rollback()
self.assertTrue(len(query.all()) == 1,
"Users table should have one row")
self.assertEqual(
len(query.all()),
1,
"Users table should have one row"
)

s1.rollback()
self.assertFalse(query.all(), "Users table should be empty")
Expand Down Expand Up @@ -771,12 +780,16 @@ def testRetry(self):
tm1, tm2, s1, s2 = self.tm1, self.tm2, self.s1, self.s2
# make sure we actually start a session.
tm1.begin()
self.assertTrue(
len(s1.query(User).all()) == 1, "Users table should have one row"
self.assertEqual(
len(s1.query(User).all()),
1,
"Users table should have one row"
)
tm2.begin()
self.assertTrue(
len(s2.query(User).all()) == 1, "Users table should have one row"
self.assertEqual(
len(s2.query(User).all()),
1,
"Users table should have one row"
)
s1.query(User).delete()
if SA_GE_20:
Expand All @@ -800,15 +813,19 @@ def testRetryThread(self):
tm1, tm2, s1, s2 = self.tm1, self.tm2, self.s1, self.s2
# make sure we actually start a session.
tm1.begin()
self.assertTrue(
len(s1.query(User).all()) == 1, "Users table should have one row"
self.assertEqual(
len(s1.query(User).all()),
1,
"Users table should have one row"
)
tm2.begin()
s2.connection().execute(sql.text(
"SET TRANSACTION ISOLATION LEVEL SERIALIZABLE"
))
self.assertTrue(
len(s2.query(User).all()) == 1, "Users table should have one row"
self.assertEqual(
len(s2.query(User).all()),
1,
"Users table should have one row"
)
s1.query(User).delete()
raised = False
Expand Down
Loading
Loading