Skip to content

Commit 4ecf4ad

Browse files
committedFeb 14, 2025·
use pep 621
Installation has been converted to use :pep:`621`, e.g. ``pyproject.toml``. note that the introduction of pyproject with min python version of 3.9 is also consumed by Black which now wants to format a few test files differently, so that is included as well. Change-Id: I7f61abded37fd3f1d7bf32e3228fe97902029d19
1 parent a30a908 commit 4ecf4ad

9 files changed

+134
-116
lines changed
 

‎docs/build/unreleased/pyproject.rst

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
.. change::
2+
:tags: changed, general
3+
4+
Installation has been converted to use :pep:`621`, e.g. ``pyproject.toml``.

‎pyproject.toml

+88-1
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,98 @@
11
[build-system]
22
build-backend = "setuptools.build_meta"
33
requires = [
4-
"setuptools>=61.0",
4+
"setuptools>=61.2",
55
]
66

7+
8+
[project]
9+
name = "alembic"
10+
description = "A database migration tool for SQLAlchemy."
11+
authors = [{name = "Mike Bayer", email = "mike_mp@zzzcomputing.com"}]
12+
license = {text = "MIT"}
13+
classifiers = [
14+
"Development Status :: 5 - Production/Stable",
15+
"Intended Audience :: Developers",
16+
"Environment :: Console",
17+
"License :: OSI Approved :: MIT License",
18+
"Operating System :: OS Independent",
19+
"Programming Language :: Python",
20+
"Programming Language :: Python :: 3",
21+
"Programming Language :: Python :: 3.9",
22+
"Programming Language :: Python :: 3.10",
23+
"Programming Language :: Python :: 3.11",
24+
"Programming Language :: Python :: 3.12",
25+
"Programming Language :: Python :: 3.13",
26+
"Programming Language :: Python :: Implementation :: CPython",
27+
"Programming Language :: Python :: Implementation :: PyPy",
28+
"Topic :: Database :: Front-Ends",
29+
]
30+
requires-python = ">=3.9"
31+
dependencies = [
32+
"SQLAlchemy>=1.4.0",
33+
"Mako",
34+
"typing-extensions>=4.12",
35+
]
36+
dynamic = ["version"]
37+
38+
[project.readme]
39+
file = "README.rst"
40+
content-type = "text/x-rst"
41+
42+
[project.urls]
43+
Homepage = "https://alembic.sqlalchemy.org"
44+
Documentation = "https://alembic.sqlalchemy.org/en/latest/"
45+
Changelog = "https://alembic.sqlalchemy.org/en/latest/changelog.html"
46+
Source = "https://github.com/sqlalchemy/alembic/"
47+
"Issue Tracker" = "https://github.com/sqlalchemy/alembic/issues/"
48+
49+
[project.optional-dependencies]
50+
tz = ["tzdata"]
51+
52+
[project.scripts]
53+
alembic = "alembic.config:main"
54+
55+
[tool.setuptools]
56+
include-package-data = true
57+
zip-safe = false
58+
package-dir = {"" = "."}
59+
license-files = ["LICENSE"]
60+
61+
[tool.setuptools.package-data]
62+
alembic = ["*.pyi", "py.typed"]
63+
64+
[tool.setuptools.exclude-package-data]
65+
alembic = ["test*"]
66+
67+
[tool.setuptools.packages.find]
68+
include = ["alembic*"]
69+
exclude = [
70+
"test*",
71+
"examples*",
72+
]
73+
namespaces = true
74+
75+
76+
[tool.setuptools.dynamic]
77+
version = {attr = "alembic.__version__"}
78+
79+
[tool.distutils.egg_info]
80+
tag-build = "dev"
81+
82+
[tool.distutils.upload_docs]
83+
upload-dir = "docs/build/output/html"
84+
85+
[tool.distutils.upload]
86+
sign = 1
87+
identity = "C4DAFEE1"
88+
89+
90+
91+
92+
793
[tool.black]
894
line-length = 79
95+
target-version = ['py39']
996

1097
[tool.pytest.ini_options]
1198
addopts = "--tb native -v -r sfxX -p no:warnings -p no:logging --maxfail=100"

‎setup.cfg

-80
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,3 @@
1-
[metadata]
2-
3-
name = alembic
4-
version = attr: alembic.__version__
5-
description = A database migration tool for SQLAlchemy.
6-
long_description = file: README.rst
7-
long_description_content_type = text/x-rst
8-
url=https://alembic.sqlalchemy.org
9-
author = Mike Bayer
10-
author_email = mike_mp@zzzcomputing.com
11-
license = MIT
12-
license_files = LICENSE
13-
14-
15-
classifiers =
16-
Development Status :: 5 - Production/Stable
17-
Intended Audience :: Developers
18-
Environment :: Console
19-
License :: OSI Approved :: MIT License
20-
Operating System :: OS Independent
21-
Programming Language :: Python
22-
Programming Language :: Python :: 3
23-
Programming Language :: Python :: 3.9
24-
Programming Language :: Python :: 3.10
25-
Programming Language :: Python :: 3.11
26-
Programming Language :: Python :: 3.12
27-
Programming Language :: Python :: 3.13
28-
Programming Language :: Python :: Implementation :: CPython
29-
Programming Language :: Python :: Implementation :: PyPy
30-
Topic :: Database :: Front-Ends
31-
project_urls =
32-
Documentation = https://alembic.sqlalchemy.org/en/latest/
33-
Changelog = https://alembic.sqlalchemy.org/en/latest/changelog.html
34-
Source = https://github.com/sqlalchemy/alembic/
35-
Issue Tracker = https://github.com/sqlalchemy/alembic/issues/
36-
[options]
37-
packages = find_namespace:
38-
include_package_data = true
39-
zip_safe = false
40-
python_requires = >=3.9
41-
42-
install_requires =
43-
SQLAlchemy>=1.4.0
44-
Mako
45-
typing-extensions>=4.12
46-
47-
[options.extras_require]
48-
tz =
49-
tzdata
50-
51-
[options.package_data]
52-
alembic = *.pyi, py.typed
53-
54-
[options.packages.find]
55-
include=alembic*
56-
exclude =
57-
test*
58-
examples*
59-
60-
[options.exclude_package_data]
61-
'' = test*
62-
63-
[options.entry_points]
64-
console_scripts =
65-
alembic = alembic.config:main
66-
67-
[egg_info]
68-
tag_build=dev
69-
70-
[upload_docs]
71-
upload_dir = docs/build/output/html
72-
73-
[upload]
74-
sign = 1
75-
identity = C4DAFEE1
76-
77-
[nosetests]
78-
with-sqla_testing = true
79-
where = tests
80-
811
[flake8]
822
enable-extensions = G
833
# E203 is due to https://github.com/PyCQA/pycodestyle/issues/373

‎setup.py

-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
1-
from setuptools import __version__
21
from setuptools import setup
32

4-
if not int(__version__.partition(".")[0]) >= 47:
5-
raise RuntimeError(f"Setuptools >= 47 required. Found {__version__}")
6-
73
setup()

‎tests/test_command.py

+15-13
Original file line numberDiff line numberDiff line change
@@ -1227,9 +1227,12 @@ def test_help_text(self):
12271227
assert not commands, "Commands without help text: %s" % commands
12281228

12291229
def test_init_file_exists_and_is_not_empty(self):
1230-
with mock.patch(
1231-
"alembic.command.os.listdir", return_value=["file1", "file2"]
1232-
), mock.patch("alembic.command.os.access", return_value=True):
1230+
with (
1231+
mock.patch(
1232+
"alembic.command.os.listdir", return_value=["file1", "file2"]
1233+
),
1234+
mock.patch("alembic.command.os.access", return_value=True),
1235+
):
12331236
directory = "alembic"
12341237
assert_raises_message(
12351238
util.CommandError,
@@ -1286,12 +1289,11 @@ def listdir_(path):
12861289
else:
12871290
return ["file1", "file2", "alembic.ini.mako"]
12881291

1289-
with mock.patch(
1290-
"alembic.command.os.access", side_effect=access_
1291-
), mock.patch("alembic.command.os.makedirs") as makedirs, mock.patch(
1292-
"alembic.command.os.listdir", side_effect=listdir_
1293-
), mock.patch(
1294-
"alembic.command.ScriptDirectory"
1292+
with (
1293+
mock.patch("alembic.command.os.access", side_effect=access_),
1294+
mock.patch("alembic.command.os.makedirs") as makedirs,
1295+
mock.patch("alembic.command.os.listdir", side_effect=listdir_),
1296+
mock.patch("alembic.command.ScriptDirectory"),
12951297
):
12961298
command.init(self.cfg, directory="foobar")
12971299
eq_(
@@ -1306,10 +1308,10 @@ def access_(path, mode):
13061308
else:
13071309
return False
13081310

1309-
with mock.patch(
1310-
"alembic.command.os.access", side_effect=access_
1311-
), mock.patch("alembic.command.os.makedirs") as makedirs, mock.patch(
1312-
"alembic.command.ScriptDirectory"
1311+
with (
1312+
mock.patch("alembic.command.os.access", side_effect=access_),
1313+
mock.patch("alembic.command.os.makedirs") as makedirs,
1314+
mock.patch("alembic.command.ScriptDirectory"),
13131315
):
13141316
command.init(self.cfg, directory="foobar")
13151317
eq_(

‎tests/test_editor.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@
1010

1111
class TestHelpers(TestBase):
1212
def common(self, cb, is_posix=True):
13-
with patch("alembic.util.editor.check_call") as check_call, patch(
14-
"alembic.util.editor.exists"
15-
) as exists, patch(
16-
"alembic.util.editor.is_posix",
17-
new=is_posix,
18-
), patch(
19-
"os.pathsep", new=":" if is_posix else ";"
13+
with (
14+
patch("alembic.util.editor.check_call") as check_call,
15+
patch("alembic.util.editor.exists") as exists,
16+
patch(
17+
"alembic.util.editor.is_posix",
18+
new=is_posix,
19+
),
20+
patch("os.pathsep", new=":" if is_posix else ";"),
2021
):
2122
cb(check_call, exists)
2223

‎tests/test_messaging.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,9 @@
1010
class MessagingTest(TestBase):
1111
def test_msg_wraps(self):
1212
buf = StringIO()
13-
with mock.patch("sys.stdout", buf), mock.patch(
14-
"alembic.util.messaging.TERMWIDTH", 10
13+
with (
14+
mock.patch("sys.stdout", buf),
15+
mock.patch("alembic.util.messaging.TERMWIDTH", 10),
1516
):
1617
msg("AAAAAAAAAAAAAAAAA")
1718
eq_(

‎tests/test_op.py

+7-3
Original file line numberDiff line numberDiff line change
@@ -1287,9 +1287,13 @@ def test_run_async_ok(self):
12871287
conn = op.get_bind()
12881288
mock_conn = MagicMock()
12891289
mock_fn = MagicMock()
1290-
with patch.object(conn.dialect, "is_async", True), patch.object(
1291-
AsyncConnection, "_retrieve_proxy_for_target", mock_conn
1292-
), patch("sqlalchemy.util.await_only") as mock_await:
1290+
with (
1291+
patch.object(conn.dialect, "is_async", True),
1292+
patch.object(
1293+
AsyncConnection, "_retrieve_proxy_for_target", mock_conn
1294+
),
1295+
patch("sqlalchemy.util.await_only") as mock_await,
1296+
):
12931297
res = op.run_async(mock_fn, 99, foo=42)
12941298

12951299
eq_(res, mock_await.return_value)

‎tests/test_post_write.py

+9-6
Original file line numberDiff line numberDiff line change
@@ -148,12 +148,15 @@ def _run_black_with_config(
148148
]
149149

150150
importlib_metadata_get = mock.Mock(return_value=retVal)
151-
with mock.patch(
152-
"alembic.util.compat.importlib_metadata_get",
153-
importlib_metadata_get,
154-
), mock.patch(
155-
"alembic.script.write_hooks.subprocess"
156-
) as mock_subprocess:
151+
with (
152+
mock.patch(
153+
"alembic.util.compat.importlib_metadata_get",
154+
importlib_metadata_get,
155+
),
156+
mock.patch(
157+
"alembic.script.write_hooks.subprocess"
158+
) as mock_subprocess,
159+
):
157160
rev = command.revision(self.cfg, message="x")
158161

159162
eq_(importlib_metadata_get.mock_calls, [mock.call("console_scripts")])

0 commit comments

Comments
 (0)
Please sign in to comment.