]> git.ipfire.org Git - thirdparty/sqlalchemy/alembic.git/commitdiff
use pep 621
authorMike Bayer <mike_mp@zzzcomputing.com>
Thu, 13 Feb 2025 16:53:25 +0000 (11:53 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Fri, 14 Feb 2025 20:35:57 +0000 (15:35 -0500)
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

docs/build/unreleased/pyproject.rst [new file with mode: 0644]
pyproject.toml
setup.cfg
setup.py
tests/test_command.py
tests/test_editor.py
tests/test_messaging.py
tests/test_op.py
tests/test_post_write.py

diff --git a/docs/build/unreleased/pyproject.rst b/docs/build/unreleased/pyproject.rst
new file mode 100644 (file)
index 0000000..32f4ff3
--- /dev/null
@@ -0,0 +1,4 @@
+.. change::
+    :tags: changed, general
+
+    Installation has been converted to use :pep:`621`, e.g. ``pyproject.toml``.
index eedcd3278ea6b9a7ed0bf2384e655596f16d0006..8034dd0c640899631c7a81296131fa7056b11070 100644 (file)
@@ -1,11 +1,98 @@
 [build-system]
 build-backend = "setuptools.build_meta"
 requires = [
-    "setuptools>=61.0",
+    "setuptools>=61.2",
 ]
 
+
+[project]
+name = "alembic"
+description = "A database migration tool for SQLAlchemy."
+authors = [{name = "Mike Bayer", email = "mike_mp@zzzcomputing.com"}]
+license = {text = "MIT"}
+classifiers = [
+    "Development Status :: 5 - Production/Stable",
+    "Intended Audience :: Developers",
+    "Environment :: Console",
+    "License :: OSI Approved :: MIT License",
+    "Operating System :: OS Independent",
+    "Programming Language :: Python",
+    "Programming Language :: Python :: 3",
+    "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",
+    "Programming Language :: Python :: Implementation :: PyPy",
+    "Topic :: Database :: Front-Ends",
+]
+requires-python = ">=3.9"
+dependencies = [
+    "SQLAlchemy>=1.4.0",
+    "Mako",
+    "typing-extensions>=4.12",
+]
+dynamic = ["version"]
+
+[project.readme]
+file = "README.rst"
+content-type = "text/x-rst"
+
+[project.urls]
+Homepage = "https://alembic.sqlalchemy.org"
+Documentation = "https://alembic.sqlalchemy.org/en/latest/"
+Changelog = "https://alembic.sqlalchemy.org/en/latest/changelog.html"
+Source = "https://github.com/sqlalchemy/alembic/"
+"Issue Tracker" = "https://github.com/sqlalchemy/alembic/issues/"
+
+[project.optional-dependencies]
+tz = ["tzdata"]
+
+[project.scripts]
+alembic = "alembic.config:main"
+
+[tool.setuptools]
+include-package-data = true
+zip-safe = false
+package-dir = {"" = "."}
+license-files = ["LICENSE"]
+
+[tool.setuptools.package-data]
+alembic = ["*.pyi", "py.typed"]
+
+[tool.setuptools.exclude-package-data]
+alembic = ["test*"]
+
+[tool.setuptools.packages.find]
+include = ["alembic*"]
+exclude = [
+    "test*",
+    "examples*",
+]
+namespaces = true
+
+
+[tool.setuptools.dynamic]
+version = {attr = "alembic.__version__"}
+
+[tool.distutils.egg_info]
+tag-build = "dev"
+
+[tool.distutils.upload_docs]
+upload-dir = "docs/build/output/html"
+
+[tool.distutils.upload]
+sign = 1
+identity = "C4DAFEE1"
+
+
+
+
+
 [tool.black]
 line-length = 79
+target-version = ['py39']
 
 [tool.pytest.ini_options]
 addopts = "--tb native -v -r sfxX -p no:warnings -p no:logging --maxfail=100"
index c6dbc109ae47e640d2ef16eb506888c92cfb9399..f3aaa9aaf0f6e0932a7a96d570a0594b066c9a56 100644 (file)
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,83 +1,3 @@
-[metadata]
-
-name = alembic
-version = attr: alembic.__version__
-description = A database migration tool for SQLAlchemy.
-long_description = file: README.rst
-long_description_content_type = text/x-rst
-url=https://alembic.sqlalchemy.org
-author = Mike Bayer
-author_email = mike_mp@zzzcomputing.com
-license = MIT
-license_files = LICENSE
-
-
-classifiers =
-    Development Status :: 5 - Production/Stable
-    Intended Audience :: Developers
-    Environment :: Console
-    License :: OSI Approved :: MIT License
-    Operating System :: OS Independent
-    Programming Language :: Python
-    Programming Language :: Python :: 3
-    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
-    Programming Language :: Python :: Implementation :: PyPy
-    Topic :: Database :: Front-Ends
-project_urls =
-    Documentation = https://alembic.sqlalchemy.org/en/latest/
-    Changelog = https://alembic.sqlalchemy.org/en/latest/changelog.html
-    Source = https://github.com/sqlalchemy/alembic/
-    Issue Tracker = https://github.com/sqlalchemy/alembic/issues/
-[options]
-packages = find_namespace:
-include_package_data = true
-zip_safe = false
-python_requires = >=3.9
-
-install_requires =
-    SQLAlchemy>=1.4.0
-    Mako
-    typing-extensions>=4.12
-
-[options.extras_require]
-tz =
-    tzdata
-
-[options.package_data]
-alembic = *.pyi, py.typed
-
-[options.packages.find]
-include=alembic*
-exclude =
-    test*
-    examples*
-
-[options.exclude_package_data]
-'' = test*
-
-[options.entry_points]
-console_scripts =
-    alembic = alembic.config:main
-
-[egg_info]
-tag_build=dev
-
-[upload_docs]
-upload_dir = docs/build/output/html
-
-[upload]
-sign = 1
-identity = C4DAFEE1
-
-[nosetests]
-with-sqla_testing = true
-where = tests
-
 [flake8]
 enable-extensions = G
 # E203 is due to https://github.com/PyCQA/pycodestyle/issues/373
index 1a4f69a8c0cc456cfe831517adad46568b4cbeb1..606849326a4002007fd42060b51e69a19c18675c 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -1,7 +1,3 @@
-from setuptools import __version__
 from setuptools import setup
 
-if not int(__version__.partition(".")[0]) >= 47:
-    raise RuntimeError(f"Setuptools >= 47 required. Found {__version__}")
-
 setup()
index 1b41af6d96050d7d048ab7c2563ed32d673611a8..89398c2409563cc2f3d0f16acee3cff68bc1b59f 100644 (file)
@@ -1227,9 +1227,12 @@ class CommandLineTest(TestBase):
         assert not commands, "Commands without help text: %s" % commands
 
     def test_init_file_exists_and_is_not_empty(self):
-        with mock.patch(
-            "alembic.command.os.listdir", return_value=["file1", "file2"]
-        ), mock.patch("alembic.command.os.access", return_value=True):
+        with (
+            mock.patch(
+                "alembic.command.os.listdir", return_value=["file1", "file2"]
+            ),
+            mock.patch("alembic.command.os.access", return_value=True),
+        ):
             directory = "alembic"
             assert_raises_message(
                 util.CommandError,
@@ -1286,12 +1289,11 @@ class CommandLineTest(TestBase):
             else:
                 return ["file1", "file2", "alembic.ini.mako"]
 
-        with mock.patch(
-            "alembic.command.os.access", side_effect=access_
-        ), mock.patch("alembic.command.os.makedirs") as makedirs, mock.patch(
-            "alembic.command.os.listdir", side_effect=listdir_
-        ), mock.patch(
-            "alembic.command.ScriptDirectory"
+        with (
+            mock.patch("alembic.command.os.access", side_effect=access_),
+            mock.patch("alembic.command.os.makedirs") as makedirs,
+            mock.patch("alembic.command.os.listdir", side_effect=listdir_),
+            mock.patch("alembic.command.ScriptDirectory"),
         ):
             command.init(self.cfg, directory="foobar")
             eq_(
@@ -1306,10 +1308,10 @@ class CommandLineTest(TestBase):
             else:
                 return False
 
-        with mock.patch(
-            "alembic.command.os.access", side_effect=access_
-        ), mock.patch("alembic.command.os.makedirs") as makedirs, mock.patch(
-            "alembic.command.ScriptDirectory"
+        with (
+            mock.patch("alembic.command.os.access", side_effect=access_),
+            mock.patch("alembic.command.os.makedirs") as makedirs,
+            mock.patch("alembic.command.ScriptDirectory"),
         ):
             command.init(self.cfg, directory="foobar")
             eq_(
index 0ec6f5f43f43523739b477959207631184c284f6..c5fdc8db0c59cc166be96864bd1d0a0a268d7b2c 100644 (file)
@@ -10,13 +10,14 @@ from alembic.testing.fixtures import TestBase
 
 class TestHelpers(TestBase):
     def common(self, cb, is_posix=True):
-        with patch("alembic.util.editor.check_call") as check_call, patch(
-            "alembic.util.editor.exists"
-        ) as exists, patch(
-            "alembic.util.editor.is_posix",
-            new=is_posix,
-        ), patch(
-            "os.pathsep", new=":" if is_posix else ";"
+        with (
+            patch("alembic.util.editor.check_call") as check_call,
+            patch("alembic.util.editor.exists") as exists,
+            patch(
+                "alembic.util.editor.is_posix",
+                new=is_posix,
+            ),
+            patch("os.pathsep", new=":" if is_posix else ";"),
         ):
             cb(check_call, exists)
 
index cfd450a22153ae0dbadf196a831a8dc5da589d31..0b23a63a091e364478864bc2ecb33ee3755d0ee5 100644 (file)
@@ -10,8 +10,9 @@ from alembic.util.messaging import obfuscate_url_pw
 class MessagingTest(TestBase):
     def test_msg_wraps(self):
         buf = StringIO()
-        with mock.patch("sys.stdout", buf), mock.patch(
-            "alembic.util.messaging.TERMWIDTH", 10
+        with (
+            mock.patch("sys.stdout", buf),
+            mock.patch("alembic.util.messaging.TERMWIDTH", 10),
         ):
             msg("AAAAAAAAAAAAAAAAA")
         eq_(
index 789203cb5a5b9bcbf203740039f895c0da0853cf..d9e65091fa5d62fd8131d88da73e8c2dbd10585c 100644 (file)
@@ -1287,9 +1287,13 @@ class OpTest(TestBase):
         conn = op.get_bind()
         mock_conn = MagicMock()
         mock_fn = MagicMock()
-        with patch.object(conn.dialect, "is_async", True), patch.object(
-            AsyncConnection, "_retrieve_proxy_for_target", mock_conn
-        ), patch("sqlalchemy.util.await_only") as mock_await:
+        with (
+            patch.object(conn.dialect, "is_async", True),
+            patch.object(
+                AsyncConnection, "_retrieve_proxy_for_target", mock_conn
+            ),
+            patch("sqlalchemy.util.await_only") as mock_await,
+        ):
             res = op.run_async(mock_fn, 99, foo=42)
 
             eq_(res, mock_await.return_value)
index 2027ab9ab51308f78b92056040bb5f54275be821..f728f0bb7bac1a35ae963a7d302bfa7dd2ecb792 100644 (file)
@@ -148,12 +148,15 @@ class RunHookTest(TestBase):
         ]
 
         importlib_metadata_get = mock.Mock(return_value=retVal)
-        with mock.patch(
-            "alembic.util.compat.importlib_metadata_get",
-            importlib_metadata_get,
-        ), mock.patch(
-            "alembic.script.write_hooks.subprocess"
-        ) as mock_subprocess:
+        with (
+            mock.patch(
+                "alembic.util.compat.importlib_metadata_get",
+                importlib_metadata_get,
+            ),
+            mock.patch(
+                "alembic.script.write_hooks.subprocess"
+            ) as mock_subprocess,
+        ):
             rev = command.revision(self.cfg, message="x")
 
         eq_(importlib_metadata_get.mock_calls, [mock.call("console_scripts")])