From 7abaec62383c89f720969a0faa5106335ed726d3 Mon Sep 17 00:00:00 2001 From: Richard Schwab Date: Mon, 14 Mar 2022 23:29:31 +0100 Subject: [PATCH] Migrate to PEP 517 build system - all remaining setuptools configuration is moved from setup.py to setup.cfg - description is now checked with twine rather than `setup.py check` Split from #734, including suggestions from @webknjaz Co-authored-by: Sviatoslav Sydorenko --- .github/workflows/ci.yml | 12 ++++++++---- CHANGES.txt | 1 + pyproject.toml | 6 ++++++ setup.cfg | 10 ++++++++++ setup.py | 25 ------------------------- 5 files changed, 25 insertions(+), 29 deletions(-) create mode 100644 pyproject.toml delete mode 100755 setup.py diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cb29608d..f1c73562 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -83,13 +83,17 @@ jobs: run: | python -m pip install --upgrade --requirement requirements-dev.txt - - name: Install aiomysql + - name: Build distribution packages run: | - python -m pip install . + python -m build + + - name: Check package description + run: | + python -m twine check --strict dist/* - - name: Check rst + - name: Install aiomysql run: | - python setup.py check --restructuredtext + python -m pip install . # this ensures our database is ready. typically by the time the preparations have completed its first start logic. # unfortunately we need this hacky workaround as GitHub Actions service containers can't reference data from our repo. diff --git a/CHANGES.txt b/CHANGES.txt index 61187929..6aaec769 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -23,6 +23,7 @@ To be included in 1.0.0 (unreleased) * Fix error packet handling for SSCursor #428 * Required python version is now properly documented in python_requires instead of failing on setup.py execution #731 * Add rsa extras_require depending on PyMySQL[rsa] #557 +* Migrate to PEP 517 build system #746 0.0.22 (2021-11-14) diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 00000000..05e4daa9 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,6 @@ +[build-system] +requires = [ + # Essentials + "setuptools >= 42", +] +build-backend = "setuptools.build_meta" diff --git a/setup.cfg b/setup.cfg index 6a527450..5b8c7d34 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,6 @@ [metadata] name = aiomysql +version = attr: aiomysql.__version__ url = https://github.com/aio-libs/aiomysql download_url = https://pypi.python.org/pypi/aiomysql project_urls = @@ -9,6 +10,8 @@ project_urls = GitHub: issues = https://github.com/aio-libs/aiomysql/issues GitHub: discussions = https://github.com/aio-libs/aiomysql/discussions description = MySQL driver for asyncio. +long_description = file: README.rst, CHANGES.txt +long_description_content_type = text/x-rst author = Nikolay Novik author_email = nickolainovik@gmail.com classifiers = @@ -38,6 +41,8 @@ platforms = python_requires = >=3.7 include_package_data = True +packages = find: + # runtime requirements install_requires = PyMySQL>=1.0 @@ -47,3 +52,8 @@ sa = sqlalchemy>=1.0,<1.4 rsa = PyMySQL[rsa]>=1.0 + +[options.packages.find] +exclude = + tests + tests.* diff --git a/setup.py b/setup.py deleted file mode 100755 index c46a2c8f..00000000 --- a/setup.py +++ /dev/null @@ -1,25 +0,0 @@ -import os -import re -from setuptools import setup, find_packages - - -def read(f): - return open(os.path.join(os.path.dirname(__file__), f)).read().strip() - - -def read_version(): - regexp = re.compile(r"^__version__\W*=\W*'([\d.abrc]+)'") - init_py = os.path.join(os.path.dirname(__file__), - 'aiomysql', '__init__.py') - with open(init_py) as f: - for line in f: - match = regexp.match(line) - if match is not None: - return match.group(1) - else: - raise RuntimeError('Cannot find version in aiomysql/__init__.py') - - -setup(version=read_version(), - long_description='\n\n'.join((read('README.rst'), read('CHANGES.txt'))), - packages=find_packages(exclude=['tests', 'tests.*']))