From: Mike Bayer Date: Wed, 7 May 2025 15:34:49 +0000 (-0400) Subject: use pep639 X-Git-Tag: rel_1_16_0~21^2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8f32eb95990cf9bad12f3b0cf5847e1a45926481;p=thirdparty%2Fsqlalchemy%2Falembic.git use pep639 The pyproject.toml configuration has been amended to use the updated :pep:`639` configuration for license, which eliminates loud deprecation warnings when building the package. Note this necessarily bumps setuptools build requirement to 77.0.3. Also bump black, flake8, see what's coming. this change is modeled after the same change made in dogpile.cache which has since been released. Fixes: #1637 Change-Id: I9a9e22ebaebe0d257f003f5ff5b81088df3c8901 --- diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7ee8e2b4..21a86580 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,7 +2,7 @@ # See https://pre-commit.com/hooks.html for more hooks repos: - repo: https://github.com/python/black - rev: 24.10.0 + rev: 25.1.0 hooks: - id: black @@ -14,7 +14,7 @@ repos: - --keep-unused-type-checking - repo: https://github.com/pycqa/flake8 - rev: 6.1.0 + rev: 7.2.0 hooks: - id: flake8 additional_dependencies: diff --git a/alembic/op.pyi b/alembic/op.pyi index 8292a724..548beb09 100644 --- a/alembic/op.pyi +++ b/alembic/op.pyi @@ -1276,7 +1276,7 @@ def invoke( BulkInsertOp, DropTableOp, ExecuteSQLOp, - ] + ], ) -> None: ... @overload def invoke(operation: MigrateOperation) -> Any: diff --git a/alembic/script/revision.py b/alembic/script/revision.py index c3108e98..587e9049 100644 --- a/alembic/script/revision.py +++ b/alembic/script/revision.py @@ -1708,7 +1708,7 @@ def tuple_rev_as_scalar(rev: None) -> None: ... @overload def tuple_rev_as_scalar( - rev: Union[Tuple[_T, ...], List[_T]] + rev: Union[Tuple[_T, ...], List[_T]], ) -> Union[_T, Tuple[_T, ...], List[_T]]: ... diff --git a/docs/build/unreleased/1637.rst b/docs/build/unreleased/1637.rst new file mode 100644 index 00000000..08ddf60b --- /dev/null +++ b/docs/build/unreleased/1637.rst @@ -0,0 +1,8 @@ +.. change:: + :tags: bug, general + :tickets: 1637 + + The pyproject.toml configuration has been amended to use the updated + :pep:`639` configuration for license, which eliminates loud deprecation + warnings when building the package. Note this necessarily bumps + setuptools build requirement to 77.0.3. diff --git a/pyproject.toml b/pyproject.toml index a62f7e89..389f95c9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,20 +1,18 @@ [build-system] build-backend = "setuptools.build_meta" -requires = [ - "setuptools>=61.2", -] +requires = ["setuptools>=77.0.3"] [project] name = "alembic" description = "A database migration tool for SQLAlchemy." authors = [{name = "Mike Bayer", email = "mike_mp@zzzcomputing.com"}] -license = {text = "MIT"} +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", @@ -56,7 +54,6 @@ alembic = "alembic.config:main" include-package-data = true zip-safe = false package-dir = {"" = "."} -license-files = ["LICENSE"] [tool.setuptools.package-data] "*" = ["*.pyi", "py.typed", "*.mako", "README"] diff --git a/tools/write_pyi.py b/tools/write_pyi.py index 1efe0ee7..cd11e2e9 100644 --- a/tools/write_pyi.py +++ b/tools/write_pyi.py @@ -13,11 +13,11 @@ import typing sys.path.append(str(Path(__file__).parent.parent)) -from alembic.autogenerate.api import AutogenContext -from alembic.ddl.impl import DefaultImpl -from alembic.runtime.migration import MigrationInfo if True: # avoid flake/zimports messing with the order + from alembic.autogenerate.api import AutogenContext + from alembic.ddl.impl import DefaultImpl + from alembic.runtime.migration import MigrationInfo from alembic.operations.base import BatchOperations from alembic.operations.base import Operations from alembic.runtime.environment import EnvironmentContext @@ -130,7 +130,7 @@ def generate_pyi_for_proxy( console_scripts( str(destination_path), - {"entrypoint": "black", "options": "-l79"}, + {"entrypoint": "black", "options": "-l79 --target-version py39"}, ignore_output=ignore_output, ) diff --git a/tox.ini b/tox.ini index c2f58da8..126bcb1d 100644 --- a/tox.ini +++ b/tox.ini @@ -3,6 +3,7 @@ envlist = py-sqlalchemy SQLA_REPO = {env:SQLA_REPO:git+https://github.com/sqlalchemy/sqlalchemy.git} +BLACK_VERSION = 25.1.0 [testenv] cov_args=--cov=alembic --cov-report term --cov-report xml @@ -22,7 +23,7 @@ deps=pytest>4.6,<8.4 mako tzdata zimports - black==24.10.0 + black=={[tox]BLACK_VERSION} greenlet>=1 @@ -92,7 +93,7 @@ deps= pydocstyle<4.0.0 # used by flake8-rst-docstrings pygments - black==24.10.0 + black=={[tox]BLACK_VERSION} commands = flake8 ./alembic/ ./tests/ setup.py docs/build/conf.py {posargs} black --check setup.py tests alembic @@ -103,5 +104,5 @@ deps= sqlalchemy>=2 mako zimports - black==24.10.0 + black=={[tox]BLACK_VERSION} commands = python tools/write_pyi.py