From 83ffe5138cc8a97137635e9e73f47a6efda78aa0 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Mon, 7 Oct 2024 11:09:19 +0400 Subject: [PATCH] Switch from setup.py to pyproject.toml (#665) --- ci.sh | 6 +++--- lint.sh | 2 +- pyproject.toml | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 43 ------------------------------------- 4 files changed, 62 insertions(+), 47 deletions(-) delete mode 100644 setup.py diff --git a/ci.sh b/ci.sh index 17c2cc4..f167c8d 100755 --- a/ci.sh +++ b/ci.sh @@ -4,11 +4,11 @@ set -exu -o pipefail python -c "import sys, struct, ssl; print('#' * 70); print('python:', sys.version); print('version_info:', sys.version_info); print('bits:', struct.calcsize('P') * 8); print('openssl:', ssl.OPENSSL_VERSION, ssl.OPENSSL_VERSION_INFO); print('#' * 70)" -python -m pip install -U pip setuptools wheel +python -m pip install -U pip build python -m pip --version -python setup.py sdist --formats=zip -python -m pip install dist/*.zip +python -m build --sdist +python -m pip install dist/*.tar.gz # Actual tests diff --git a/lint.sh b/lint.sh index 2b7f6a0..90162c8 100755 --- a/lint.sh +++ b/lint.sh @@ -4,7 +4,7 @@ set -exu -o pipefail python -c "import sys, struct, ssl; print('#' * 70); print('python:', sys.version); print('version_info:', sys.version_info); print('bits:', struct.calcsize('P') * 8); print('openssl:', ssl.OPENSSL_VERSION, ssl.OPENSSL_VERSION_INFO); print('#' * 70)" -python -m pip install -U pip setuptools wheel +python -m pip install -U pip python -m pip --version # Dependencies diff --git a/pyproject.toml b/pyproject.toml index 5bc78c9..68c806a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,61 @@ +[build-system] +requires = ["hatchling"] +build-backend = "hatchling.build" + +[project] +name = "trustme" +dynamic = ["version"] +description = "#1 quality TLS certs while you wait, for the discerning tester" +readme = "README.rst" +license = {text = "MIT OR Apache-2.0"} +requires-python = ">=3.9" +authors = [ + { name = "Nathaniel J. Smith", email = "njs@pobox.com" }, +] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "License :: OSI Approved :: MIT License", + "Programming Language :: Python :: Implementation :: CPython", + "Programming Language :: Python :: Implementation :: PyPy", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "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", + "Topic :: Security :: Cryptography", + "Topic :: Software Development :: Testing", + "Topic :: System :: Networking", +] +dependencies = [ + "cryptography>=3.1", + "idna>=2.0", +] + +[project.urls] +Homepage = "https://github.com/python-trio/trustme" + +[tool.hatch.version] +path = "src/trustme/_version.py" + + +[tool.hatch.build.targets.sdist] +include = [ + "/docs", + "/src", + "/tests", + "/test-requirements.txt", + "/README.rst", + "/LICENSE", + "/LICENSE.APACHE2", + "/LICENSE.MIT", +] + + + [tool.towncrier] # Usage: # - PRs should drop a file like "issuenumber.feature" in newsfragments diff --git a/setup.py b/setup.py deleted file mode 100644 index 872cc3a..0000000 --- a/setup.py +++ /dev/null @@ -1,43 +0,0 @@ -from setuptools import setup, find_packages - -# defines __version__ -exec(open("src/trustme/_version.py").read()) - -setup( - name="trustme", - version=__version__, - description= - "#1 quality TLS certs while you wait, for the discerning tester", - long_description=open("README.rst").read(), - author="Nathaniel J. Smith", - author_email="njs@pobox.com", - license="MIT OR Apache-2.0", - packages=find_packages(where="src"), - package_data={ - 'trustme': ['py.typed'], - }, - package_dir={'': 'src'}, - url="https://github.com/python-trio/trustme", - python_requires=">=3.9", - install_requires=[ - "cryptography>=3.1", - "idna>=2.0", - ], - classifiers=[ - "Development Status :: 4 - Beta", - "Intended Audience :: Developers", - "License :: OSI Approved :: MIT License", - "License :: OSI Approved :: Apache Software License", - "Programming Language :: Python :: Implementation :: CPython", - "Programming Language :: Python :: Implementation :: PyPy", - "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3 :: Only", - "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", - "Topic :: System :: Networking", - "Topic :: Security :: Cryptography", - "Topic :: Software Development :: Testing", - ])