Skip to content

Commit

Permalink
Merge "Support PEP-621 and PEP-685" into main
Browse files Browse the repository at this point in the history
  • Loading branch information
zzzeek authored and Gerrit Code Review committed Jan 30, 2024
2 parents 47716f5 + 765ac5f commit a8dbf87
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 105 deletions.
11 changes: 5 additions & 6 deletions .github/workflows/create-wheels.yaml
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions doc/build/changelog/unreleased_21/pep_621.rst
@@ -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.
116 changes: 115 additions & 1 deletion pyproject.toml
@@ -1,17 +1,129 @@
[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\.(
Expand Down Expand Up @@ -54,13 +166,15 @@ markers = [
"sparse_backend: tests that should run on multiple backends, not necessarily all",
]


[tool.pyright]

reportPrivateUsage = "none"
reportUnusedClass = "none"
reportUnusedFunction = "none"
reportTypedDictNotRequiredAccess = "warning"


[tool.mypy]
mypy_path = "./lib/"
show_error_codes = true
Expand Down
98 changes: 0 additions & 98 deletions 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
Expand Down

0 comments on commit a8dbf87

Please sign in to comment.