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
--- /dev/null
+.. change::
+ :tags: changed, general
+
+ Installation has been converted to use :pep:`621`, e.g. ``pyproject.toml``.
[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"
-[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
-from setuptools import __version__
from setuptools import setup
-if not int(__version__.partition(".")[0]) >= 47:
- raise RuntimeError(f"Setuptools >= 47 required. Found {__version__}")
-
setup()
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,
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_(
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_(
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)
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_(
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)
]
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")])