From d7e58bb8990b4f9bba31380097eca2bd0c3201fc Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Sun, 6 Oct 2024 21:51:23 +0400 Subject: [PATCH 1/4] Support Python 3.13, drop 3.8 and PyPy 3.9 --- .github/workflows/ci.yml | 71 +++++++++------------------------------- setup.py | 4 +-- 2 files changed, 17 insertions(+), 58 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c19fb66..fefccd4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,81 +7,40 @@ on: pull_request: jobs: - Windows: - name: 'Windows (${{ matrix.python }})' - timeout-minutes: 20 - runs-on: 'windows-latest' + test: strategy: fail-fast: false matrix: - python: ['3.8', '3.9', '3.10', '3.11', '3.12-dev'] + python-version: ['3.9', '3.10', '3.11', '3.12', '3.13'] + os: + - macos-latest + - windows-latest + - ubuntu-latest + include: + - python-version: pypy3.10 + os: ubuntu-latest + name: ${{ fromJson('{"macos-latest":"macOS","windows-latest":"Windows","ubuntu-latest":"Ubuntu"}')[matrix.os] }} (${{ matrix.python-version }}) + timeout-minutes: 20 + runs-on: ${{ matrix.os }} steps: - name: Checkout uses: actions/checkout@v4 - name: Setup python uses: actions/setup-python@v5 with: - python-version: '${{ matrix.python }}' + python-version: '${{ matrix.python-version }}' + allow-prereleases: true - name: Run tests run: ./ci.sh shell: bash - name: "Upload coverage data" uses: "actions/upload-artifact@v4" with: - name: coverage-data-windows-${{ matrix.python }} + name: coverage-data-${{ matrix.os }}-${{ matrix.python-version }} path: .coverage.* include-hidden-files: true if-no-files-found: ignore - Ubuntu: - name: 'Ubuntu (${{ matrix.python }})' - timeout-minutes: 10 - runs-on: 'ubuntu-latest' - strategy: - fail-fast: false - matrix: - python: ['3.8', '3.9', '3.10', '3.11', '3.12-dev', 'pypy3.9', 'pypy-3.10'] - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup python - uses: actions/setup-python@v5 - with: - python-version: '${{ matrix.python }}' - - name: Run tests - run: ./ci.sh - - name: "Upload coverage data" - uses: "actions/upload-artifact@v4" - with: - name: coverage-data-ubuntu-${{ matrix.python }} - path: .coverage.* - include-hidden-files: true - if-no-files-found: ignore - - macOS: - name: 'macOS (${{ matrix.python }})' - timeout-minutes: 10 - runs-on: 'macos-latest' - strategy: - fail-fast: false - matrix: - python: ['3.8', '3.9', '3.10', '3.11', '3.12-dev'] - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Setup python - uses: actions/setup-python@v5 - with: - python-version: '${{ matrix.python }}' - - name: Run tests - run: ./ci.sh - - name: "Upload coverage data" - uses: "actions/upload-artifact@v4" - with: - name: coverage-data-macos-${{ matrix.python }} - path: .coverage.* - include-hidden-files: true - if-no-files-found: ignore coverage: name: Combine & check coverage diff --git a/setup.py b/setup.py index 6da15ce..872cc3a 100644 --- a/setup.py +++ b/setup.py @@ -18,7 +18,7 @@ }, package_dir={'': 'src'}, url="https://github.com/python-trio/trustme", - python_requires=">=3.8", + python_requires=">=3.9", install_requires=[ "cryptography>=3.1", "idna>=2.0", @@ -32,11 +32,11 @@ "Programming Language :: Python :: Implementation :: PyPy", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3 :: Only", - "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 :: 3.13", "Topic :: System :: Networking", "Topic :: Security :: Cryptography", "Topic :: Software Development :: Testing", From acdfbfbf16e3642b0cee91fdc9d6cdf2b4875c50 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Sun, 6 Oct 2024 21:55:43 +0400 Subject: [PATCH 2/4] Fix coverage needs --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fefccd4..c342d4d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,7 +46,7 @@ jobs: name: Combine & check coverage if: always() runs-on: "ubuntu-latest" - needs: ["Windows", "Ubuntu", "macOS"] + needs: test steps: - uses: actions/checkout@v4 From da1bf379e30e4ca20b7ecd6ca618f9dc349bde1d Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Fri, 4 Oct 2024 14:03:38 +0400 Subject: [PATCH 3/4] Switch from setup.py to pyproject.toml --- pyproject.toml | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ setup.py | 43 ------------------------------------- 2 files changed, 58 insertions(+), 43 deletions(-) delete mode 100644 setup.py 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", - ]) From 865f11318824019f29b4cef52f2808c54e524651 Mon Sep 17 00:00:00 2001 From: Quentin Pradet Date: Sun, 6 Oct 2024 22:07:03 +0400 Subject: [PATCH 4/4] Fix lint.sh and ci.sh scripts --- ci.sh | 6 +++--- lint.sh | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) 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