Skip to content

Commit

Permalink
feat: add python 3.12 support
Browse files Browse the repository at this point in the history
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 <josh@jpellis.me>
  • Loading branch information
JP-Ellis committed Oct 24, 2023
1 parent ab02630 commit 1c90b64
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 13 deletions.
2 changes: 2 additions & 0 deletions .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,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:
Expand All @@ -35,6 +36,7 @@ macosx_arm64_task:
- PYTHON: "3.9"
- PYTHON: "3.10"
- PYTHON: "3.11"
- PYTHON: "3.12"
install_script:
- brew update
- brew install pyenv
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ concurrency:
cancel-in-progress: true

env:
STABLE_PYTHON_VERSION: "3.11"
STABLE_PYTHON_VERSION: "3.12"
CIBW_BUILD_FRONTEND: build
CIBW_TEST_COMMAND: >
python -c
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand Down
31 changes: 22 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ 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",
]
Expand Down Expand Up @@ -62,7 +63,7 @@ types = [
"types-requests ~= 2.0",
]
test = [
"aiohttp[speedups] ~= 3.0",
"aiohttp[speedups] ~= 3.9b",
"coverage[toml] ~= 7.0",
"flask[async] ~= 3.0",
"httpx ~= 0.0",
Expand All @@ -85,14 +86,20 @@ 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]
path = "pact/__version__.py"

[tool.hatch.build]
include = ["pact/**/*.py", "*.md", "LICENSE"]
include = ["pact/**/*.py", "*.md", "LICENSE"]

[tool.hatch.build.targets.wheel]
# Ignore the data files in the wheel as their contents are already included
Expand All @@ -108,8 +115,14 @@ artifacts = ["pact/bin/*", "pact/lib/*"]
# 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:.}"]
Expand All @@ -123,7 +136,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/}"
Expand Down Expand Up @@ -155,9 +168,9 @@ filterwarnings = [
[tool.coverage.report]
exclude_lines = [
"if __name__ == .__main__.:", # Ignore non-runnable code
"if TYPE_CHECKING:", # Ignore typing
"raise NotImplementedError", # Ignore defensive assertions
"@(abc\\.)?abstractmethod", # Ignore abstract methods
"if TYPE_CHECKING:", # Ignore typing
"raise NotImplementedError", # Ignore defensive assertions
"@(abc\\.)?abstractmethod", # Ignore abstract methods
]

################################################################################
Expand Down

0 comments on commit 1c90b64

Please sign in to comment.