From 38e113840e4ca5d27ed147f1262ba32173beb1d3 Mon Sep 17 00:00:00 2001 From: JP-Ellis Date: Fri, 13 Oct 2023 11:06:23 +1100 Subject: [PATCH 1/3] feat: add python 3.12 support Update the build scripts to test and target Python 3.12 released on 2 October 2023. As the dependency on distutils has been removed already, there are no other changes required. Signed-off-by: JP-Ellis --- .cirrus.yml | 2 ++ .github/workflows/build.yml | 2 +- .github/workflows/test.yml | 6 +++--- pyproject.toml | 23 ++++++++++++++++++----- 4 files changed, 24 insertions(+), 9 deletions(-) diff --git a/.cirrus.yml b/.cirrus.yml index f6ba0c61e..7ad9e9082 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -17,6 +17,7 @@ linux_arm64_task: - IMAGE: "python:3.9-slim" - IMAGE: "python:3.10-slim" - IMAGE: "python:3.11-slim" + - IMAGE: "python:3.12-slim" arm_container: image: $IMAGE install_script: @@ -37,6 +38,7 @@ macosx_arm64_task: - PYTHON: "3.9" - PYTHON: "3.10" - PYTHON: "3.11" + - PYTHON: "3.12" install_script: - brew update - brew install pyenv diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index f2d5cd65d..40a20f578 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ concurrency: cancel-in-progress: true env: - STABLE_PYTHON_VERSION: "3.11" + STABLE_PYTHON_VERSION: "3.12" CIBW_BUILD_FRONTEND: build jobs: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index e63ff5e85..8ed5e29b1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ concurrency: cancel-in-progress: true env: - STABLE_PYTHON_VERSION: "3.11" + STABLE_PYTHON_VERSION: "3.12" PYTEST_ADDOPTS: --color=yes jobs: @@ -28,12 +28,12 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] experimental: [false] include: - # Run tests against the next Python version, but no need for the full list of OSes. os: ubuntu-latest - python-version: "3.12-dev" + python-version: "3.13.0-alpha.0 - 3.13" experimental: true steps: diff --git a/pyproject.toml b/pyproject.toml index e026884fe..44bc2ed97 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -22,11 +22,12 @@ classifiers = [ "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3 :: Only", "Topic :: Software Development :: Testing", ] -requires-python = ">=3.8, <3.12" +requires-python = ">=3.8" # Dependencies of Pact Python should be specified using the broadest range # compatible version unless: @@ -87,7 +88,13 @@ dev = [ ################################################################################ [build-system] -requires = ["hatchling", "packaging", "requests", "cffi"] +requires = [ + "hatchling", + "packaging", + "requests", + "cffi", + "setuptools ; python_version >= '3.12'", +] build-backend = "hatchling.build" [tool.hatch.version] @@ -110,8 +117,14 @@ artifacts = ["pact/bin/*", "pact/lib/*", "pact/v3/_ffi.*"] # Install dev dependencies in the default environment to simplify the developer # workflow. [tool.hatch.envs.default] -features = ["dev"] -extra-dependencies = ["hatchling", "packaging", "requests", "cffi"] +features = ["dev"] +extra-dependencies = [ + "hatchling", + "packaging", + "requests", + "cffi", + "setuptools ; python_version >= '3.12'", +] [tool.hatch.envs.default.scripts] lint = ["black --check --diff {args:.}", "ruff {args:.}", "mypy {args:.}"] @@ -125,7 +138,7 @@ all = ["lint", "test", "example"] features = ["test"] [[tool.hatch.envs.test.matrix]] -python = ["3.8", "3.9", "3.10", "3.11"] +python = ["3.8", "3.9", "3.10", "3.11", "3.12"] [tool.hatch.envs.test.scripts] test = "pytest {args:tests/}" From b579655710ea756709a7b15c6b4a1ed6ee7411ac Mon Sep 17 00:00:00 2001 From: JP-Ellis Date: Wed, 22 Nov 2023 13:33:32 +1100 Subject: [PATCH 2/3] chore(ci): set hatch to be verbose This will help with debugging any errors that might occur during the venv setup. Signed-off-by: JP-Ellis --- .cirrus.yml | 1 + .github/workflows/build.yml | 1 + .github/workflows/test.yml | 1 + 3 files changed, 3 insertions(+) diff --git a/.cirrus.yml b/.cirrus.yml index 7ad9e9082..cbd26fdc3 100644 --- a/.cirrus.yml +++ b/.cirrus.yml @@ -12,6 +12,7 @@ linux_arm64_task: env: PATH: ${HOME}/.local/bin:${PATH} CIRRUS_CLONE_SUBMODULES: "true" + HATCH_VERBOSE: 1 matrix: - IMAGE: "python:3.8-slim" - IMAGE: "python:3.9-slim" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 40a20f578..284125bab 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,6 +16,7 @@ concurrency: env: STABLE_PYTHON_VERSION: "3.12" + HATCH_VERBOSE: 1 CIBW_BUILD_FRONTEND: build jobs: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 8ed5e29b1..91f6a3508 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,6 +15,7 @@ concurrency: env: STABLE_PYTHON_VERSION: "3.12" PYTEST_ADDOPTS: --color=yes + HATCH_VERBOSE: 1 jobs: test: From 75542d9d3100261233131ce6f3f07e43357ffe68 Mon Sep 17 00:00:00 2001 From: JP-Ellis Date: Wed, 22 Nov 2023 13:42:28 +1100 Subject: [PATCH 3/3] chore(ci): add test conclusion step We require the test matrix to succeed before a PR can be merged. Unfortunately, the rule is rather complex as it has to test that each element of the test matrix completed successfully. By adding another step which runs only of the matrix succeeded, we can check that this ran, as opposed to each element of the matrix. Signed-off-by: JP-Ellis --- .github/workflows/test.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 91f6a3508..838cde4a7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -60,6 +60,16 @@ jobs: with: token: ${{ secrets.CODECOV_TOKEN }} + test-conlusion: + name: Test matrix complete + + runs-on: ubuntu-latest + needs: + - test + + steps: + - run: echo "Test matrix completed successfully." + example: name: Example