]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
Support PEP-621 and PEP-685
authorKOLANICH <kolan_n@mail.ru>
Thu, 16 Feb 2023 18:31:29 +0000 (21:31 +0300)
committerFederico Caselli <cfederico87@gmail.com>
Thu, 25 Jan 2024 18:24:51 +0000 (19:24 +0100)
Move the metadata for `setuptools` into `PEP 621`-compliant `pyproject.toml`.
Use PEP-685 extras, keeping the old names for backward compatibility.

Closes: #9324
Closes: #10481
Pull-request: https://github.com/sqlalchemy/sqlalchemy/pull/9324
Change-Id: I14170e33a4a7370257d941adea4f96a39e785911

.github/workflows/create-wheels.yaml
doc/build/changelog/unreleased_21/pep_621.rst [new file with mode: 0644]
pyproject.toml
setup.cfg

index 2b324541c1a2cc938cf7e038282f5688f37006a9..ea1ebffcc79feb5e2b3a66271063f83a030b4561 100644 (file)
@@ -51,18 +51,17 @@ jobs:
     steps:
       - uses: actions/checkout@v4
 
-      - name: Remove tag_build from setup.cfg
-        # sqlalchemy has `tag_build` set to `dev` in setup.cfg. We need to remove it before creating the weel
+      - name: Remove tag-build from pyproject.toml
+        # sqlalchemy has `tag-build` set to `dev` in pyproject.toml. It needs to be removed before creating the wheel
         # otherwise it gets tagged with `dev0`
         shell: pwsh
         # This is equivalent to the sed commands:
-        # `sed -i '/tag_build=dev/d' setup.cfg`
-        # `sed -i '/tag_build = dev/d' setup.cfg`
+        # `sed -i '/tag-build="dev"/d' pyproject.toml`
+        # `sed -i '/tag-build = "dev"/d' pyproject.toml`
 
         # `-replace` uses a regexp match
-        # alternative form: `(get-content setup.cfg) | foreach-object{$_ -replace "tag_build.=.dev",""} | set-content setup.cfg`
         run: |
-          (cat setup.cfg) | %{$_ -replace "tag_build.?=.?dev",""} | set-content setup.cfg
+          (get-content pyproject.toml) | %{$_ -replace 'tag-build.?=.?"dev"',""} | set-content pyproject.toml
 
       # See details at https://cibuildwheel.readthedocs.io/en/stable/faq/#emulation
       - name: Set up QEMU on linux
diff --git a/doc/build/changelog/unreleased_21/pep_621.rst b/doc/build/changelog/unreleased_21/pep_621.rst
new file mode 100644 (file)
index 0000000..473c17e
--- /dev/null
@@ -0,0 +1,7 @@
+.. change::
+    :tags: change, setup
+
+    Updated the setup manifest definition to use PEP 621-compliant
+    pyproject.toml.
+    Also updated the extra install dependency to comply with PEP-685.
+    Thanks for the help of Matt Oberle and KOLANICH on this change.
index 4f6d48eec9662ef87e9c1912656c40ecdde814a2..62d07d5fe08a25aa3247b5af14afb3c67ed2607f 100644 (file)
 [build-system]
     build-backend = "setuptools.build_meta"
     requires = [
-        "setuptools>=47",
+        "setuptools>=61.2",
         "cython>=0.29.24; python_implementation == 'CPython'", # Skip cython when using pypy
     ]
 
+
+[project]
+name = "SQLAlchemy"
+description = "Database Abstraction Library"
+readme = "README.rst"
+authors = [{name = "Mike Bayer", email = "mike_mp@zzzcomputing.com"}]
+license = {text = "MIT"}
+classifiers = [
+    "Development Status :: 5 - Production/Stable",
+    "Intended Audience :: Developers",
+    "License :: OSI Approved :: MIT License",
+    "Operating System :: OS Independent",
+    "Programming Language :: Python",
+    "Programming Language :: Python :: 3",
+    "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 :: Implementation :: CPython",
+    "Programming Language :: Python :: Implementation :: PyPy",
+    "Topic :: Database :: Front-Ends",
+]
+requires-python = ">=3.8"
+dependencies = [
+    "typing-extensions >= 4.6.0",
+]
+dynamic = ["version"]
+
+[project.urls]
+Homepage = "https://www.sqlalchemy.org"
+Documentation = "https://docs.sqlalchemy.org"
+Changelog = "https://docs.sqlalchemy.org/latest/changelog/index.html"
+"Source Code" = "https://github.com/sqlalchemy/sqlalchemy"
+"Issue Tracker" = "https://github.com/sqlalchemy/sqlalchemy/issues"
+Discussions = "https://github.com/sqlalchemy/sqlalchemy/discussions"
+
+[project.optional-dependencies]
+asyncio = ["greenlet!=0.4.17"]
+mypy = [
+    "mypy >= 1.7",
+    "types-greenlet >= 2"
+]
+mssql = ["pyodbc"]
+mssql-pymssql = ["pymssql"]
+mssql-pyodbc = ["pyodbc"]
+mysql = ["mysqlclient>=1.4.0"]
+mysql-connector = ["mysql-connector-python"]
+mariadb-connector = ["mariadb>=1.0.1,!=1.1.2,!=1.1.5"]
+oracle = ["cx_oracle>=8"]
+oracle-oracledb = ["oracledb>=1.0.1"]
+postgresql = ["psycopg2>=2.7"]
+postgresql-pg8000 = ["pg8000>=1.29.3"]
+postgresql-asyncpg = [
+    "sqlalchemy[asyncio]",
+    "asyncpg",
+]
+postgresql-psycopg2binary = ["psycopg2-binary"]
+postgresql-psycopg2cffi = ["psycopg2cffi"]
+postgresql-psycopg = ["psycopg>=3.0.7,!=3.1.15"]
+postgresql-psycopgbinary = ["psycopg[binary]>=3.0.7,!=3.1.15"]
+pymysql = ["pymysql"]
+aiomysql = [
+    "sqlalchemy[asyncio]",
+    "aiomysql",
+]
+aioodbc = [
+    "sqlalchemy[asyncio]",
+    "aioodbc",
+]
+asyncmy = [
+    "sqlalchemy[asyncio]",
+    "asyncmy>=0.2.3,!=0.2.4,!=0.2.6",
+]
+aiosqlite = [
+    "sqlalchemy[asyncio]",
+    "aiosqlite",
+]
+sqlcipher = ["sqlcipher3_binary"]
+
+# legacy pre-pep-685 names. These are ignored by pip >= 23.3.0
+mssql_pymssql = ["sqlalchemy[mssql-pymssql]"]
+mssql_pyodbc = ["sqlalchemy[mssql-pyodbc]"]
+mysql_connector = ["sqlalchemy[mysql-connector]"]
+mariadb_connector = ["sqlalchemy[mariadb-connector]"]
+oracle_oracledb = ["sqlalchemy[oracle-oracledb]"]
+postgresql_pg8000 = ["sqlalchemy[postgresql-pg8000]"]
+postgresql_asyncpg = ["sqlalchemy[postgresql-asyncpg]"]
+postgresql_psycopg2binary = ["sqlalchemy[postgresql-psycopg2binary]"]
+postgresql_psycopg2cffi = ["sqlalchemy[postgresql-psycopg2cffi]"]
+postgresql_psycopg = ["sqlalchemy[postgresql-psycopg]"]
+postgresql_psycopgbinary = ["sqlalchemy[postgresql-psycopgbinary]"]
+
+[tool.setuptools]
+include-package-data = true
+license-files = ["LICENSE"]
+
+[tool.setuptools.packages.find]
+where = ["lib"]
+namespaces = false
+
+[tool.setuptools.dynamic]
+version = {attr = "sqlalchemy.__version__"}
+
+
+[tool.distutils.egg_info]
+# ref https://github.com/pypa/setuptools/discussions/3348#discussioncomment-6556887
+tag-build = "dev"
+
+
 [tool.black]
 line-length = 79
 target-version = ['py38']
 
+
 [tool.zimports]
 black-line-length = 79
 
+
 [tool.slotscheck]
 exclude-modules = '''
 ^sqlalchemy\.(
@@ -54,6 +166,7 @@ markers = [
     "sparse_backend: tests that should run on multiple backends, not necessarily all",
 ]
 
+
 [tool.pyright]
 
 reportPrivateUsage = "none"
@@ -61,6 +174,7 @@ reportUnusedClass = "none"
 reportUnusedFunction = "none"
 reportTypedDictNotRequiredAccess = "warning"
 
+
 [tool.mypy]
 mypy_path = "./lib/"
 show_error_codes = true
index 2ff94822c6465f9139fd5cb81777d98c7d7ce363..c6fe0b2823e0eb302189082ac0ec4866cc8189bd 100644 (file)
--- a/setup.cfg
+++ b/setup.cfg
@@ -1,101 +1,3 @@
-[metadata]
-name = SQLAlchemy
-version = attr: sqlalchemy.__version__
-description = Database Abstraction Library
-long_description = file: README.rst
-long_description_content_type = text/x-rst
-url = https://www.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
-    License :: OSI Approved :: MIT License
-    Operating System :: OS Independent
-    Programming Language :: Python
-    Programming Language :: Python :: 3
-    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 :: Implementation :: CPython
-    Programming Language :: Python :: Implementation :: PyPy
-    Topic :: Database :: Front-Ends
-project_urls =
-    Documentation=https://docs.sqlalchemy.org
-    Issue Tracker=https://github.com/sqlalchemy/sqlalchemy/
-
-[options]
-packages = find:
-include_package_data = True
-python_requires = >=3.8
-package_dir =
-    =lib
-
-install_requires =
-    typing-extensions >= 4.6.0
-
-[options.extras_require]
-asyncio =
-    greenlet!=0.4.17
-mypy =
-    mypy >= 0.910
-    types-greenlet >= 2
-mssql = pyodbc
-mssql_pymssql = pymssql
-mssql_pyodbc = pyodbc
-mysql =
-    mysqlclient>=1.4.0
-mysql_connector =
-    mysql-connector-python
-mariadb_connector =
-    mariadb>=1.0.1,!=1.1.2,!=1.1.5
-oracle =
-    cx_oracle>=8
-oracle_oracledb =
-    oracledb>=1.0.1
-postgresql = psycopg2>=2.7
-postgresql_pg8000 = pg8000>=1.29.1
-postgresql_asyncpg =
-    %(asyncio)s
-    asyncpg
-postgresql_psycopg2binary = psycopg2-binary
-postgresql_psycopg2cffi = psycopg2cffi
-postgresql_psycopg = psycopg>=3.0.7,!=3.1.15
-postgresql_psycopgbinary = psycopg[binary]>=3.0.7,!=3.1.15
-pymysql =
-    pymysql
-aiomysql =
-    %(asyncio)s
-    aiomysql>=0.2.0
-aioodbc =
-    %(asyncio)s
-    aioodbc
-asyncmy =
-    %(asyncio)s
-    asyncmy>=0.2.3,!=0.2.4,!=0.2.6
-aiosqlite =
-    %(asyncio)s
-    aiosqlite
-sqlcipher =
-    sqlcipher3_binary
-
-[egg_info]
-tag_build = dev
-
-[options.packages.find]
-where = lib
-
-# [tool:pytest]
-# pytest settings moved to pyproject.toml
-
-[upload]
-sign = 1
-identity = C4DAFEE1
-
 [flake8]
 show-source = false
 enable-extensions = G