Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
- ready_for_review

env:
STABLE_PYTHON_VERSION: '3.10'
STABLE_PYTHON_VERSION: '3.11'
FORCE_COLOR: '1'
HATCH_VERBOSE: '1'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' && github.event.action != 'closed' }}

env:
STABLE_PYTHON_VERSION: '310'
STABLE_PYTHON_VERSION: '311'
HATCH_VERBOSE: '1'
FORCE_COLOR: '1'
CIBW_BUILD_FRONTEND: build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-ffi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ concurrency:
cancel-in-progress: ${{ github.event_name == 'pull_request' && github.event.action != 'closed' }}

env:
STABLE_PYTHON_VERSION: '310'
STABLE_PYTHON_VERSION: '311'
HATCH_VERBOSE: '1'
FORCE_COLOR: '1'
CIBW_BUILD_FRONTEND: build
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ permissions:
contents: read

env:
STABLE_PYTHON_VERSION: '3.10'
STABLE_PYTHON_VERSION: '3.11'
PYTEST_ADDOPTS: --color=yes
HATCH_VERBOSE: '1'
FORCE_COLOR: '1'
Expand Down Expand Up @@ -67,8 +67,8 @@ jobs:
- ubuntu-latest
- windows-latest
python-version:
- '3.10'
- '3.14'
- '3.11'
- '3.15'

steps:
- name: Checkout code
Expand Down Expand Up @@ -143,8 +143,8 @@ jobs:
- ubuntu-latest
- windows-latest
python-version:
- '3.10'
- '3.14'
- '3.11'
- '3.15'

steps:
- name: Checkout code
Expand Down
2 changes: 1 addition & 1 deletion examples/catalog/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ dependencies = [
"python-multipart~=0.0",
]
description = "Pact Python catalog: Well-documented patterns and use cases"
requires-python = ">=3.10"
requires-python = ">=3.11"

[dependency-groups]
test = ["pact-python", "pytest~=9.0", "uvicorn~=0.30"]
Expand Down
2 changes: 1 addition & 1 deletion examples/http/aiohttp_and_flask/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Use the above links to view additional documentation within.

## Prerequisites

- Python 3.10 or higher
- Python 3.11 or higher
- A dependency manager ([uv](https://docs.astral.sh/uv/) recommended, [pip](https://pip.pypa.io/en/stable/) also works)

## Running the Example
Expand Down
14 changes: 1 addition & 13 deletions examples/http/aiohttp_and_flask/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
from __future__ import annotations

import logging
import sys
from dataclasses import dataclass
from datetime import datetime
from typing import TYPE_CHECKING, Any
Expand All @@ -36,8 +35,7 @@

if TYPE_CHECKING:
from types import TracebackType

from typing_extensions import Self
from typing import Self

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -200,11 +198,6 @@ async def get_user(self, user_id: int) -> User:
response.raise_for_status()
data: dict[str, Any] = await response.json()

# Python < 3.11 don't support ISO 8601 offsets without a colon
if sys.version_info < (3, 11) and data["created_on"][-4:].isdigit():
data["created_on"] = (
data["created_on"][:-2] + ":" + data["created_on"][-2:]
)
return User(
id=data["id"],
name=data["name"],
Expand Down Expand Up @@ -238,11 +231,6 @@ async def create_user(
):
response.raise_for_status()
data = await response.json()
# Python < 3.11 don't support ISO 8601 offsets without a colon
if sys.version_info < (3, 11) and data["created_on"][-4:].isdigit():
data["created_on"] = (
data["created_on"][:-2] + ":" + data["created_on"][-2:]
)
logger.debug("Created user %s", data["id"])
return User(
id=data["id"],
Expand Down
4 changes: 2 additions & 2 deletions examples/http/aiohttp_and_flask/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

import logging
from dataclasses import dataclass
from datetime import datetime, timezone
from datetime import UTC, datetime
from typing import TYPE_CHECKING, Any, ClassVar, Literal

from flask import Flask, Response, abort, jsonify, request
Expand Down Expand Up @@ -273,7 +273,7 @@ def create_user() -> tuple[Response, int]:
new_user = User(
id=UserDb.new_user_id(),
name=user["name"],
created_on=datetime.now(tz=timezone.utc),
created_on=datetime.now(tz=UTC),
email=user.get("email"),
ip_address=user.get("ip_address"),
hobbies=user.get("hobbies", []),
Expand Down
4 changes: 2 additions & 2 deletions examples/http/aiohttp_and_flask/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ name = "example-aiohttp-and-flask"
description = "Example of using an aiohttp client and Flask server with Pact Python"

version = "1.0.0"
requires-python = ">=3.10"
dependencies = ["aiohttp~=3.0", "flask~=3.0", "typing-extensions~=4.0"]
requires-python = ">=3.11"
dependencies = ["aiohttp~=3.0", "flask~=3.0"]

[dependency-groups]
test = ["pact-python", "pytest~=9.0", "pytest-asyncio~=1.0"]
Expand Down
4 changes: 2 additions & 2 deletions examples/http/aiohttp_and_flask/test_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from __future__ import annotations

import logging
from datetime import datetime, timezone
from datetime import UTC, datetime
from typing import TYPE_CHECKING, Any

import aiohttp
Expand Down Expand Up @@ -124,7 +124,7 @@ async def test_create_user(pact: Pact) -> None:
response: dict[str, Any] = {
"id": match.int(1000),
"name": "Bob",
"created_on": match.datetime(datetime.now(tz=timezone.utc)),
"created_on": match.datetime(datetime.now(tz=UTC)),
}

(
Expand Down
10 changes: 5 additions & 5 deletions examples/http/aiohttp_and_flask/test_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import contextlib
import dataclasses
import logging
from datetime import datetime, timezone
from datetime import UTC, datetime
from threading import Thread
from typing import TYPE_CHECKING, Any, Literal

Expand Down Expand Up @@ -112,7 +112,7 @@ def default_mock_db() -> dict[int, User]:
id=1,
name="Alice",
email="alice@example.com",
created_on=datetime(2020, 1, 1, 12, 0, 0, tzinfo=timezone.utc),
created_on=datetime(2020, 1, 1, 12, 0, 0, tzinfo=UTC),
ip_address="1.2.3.4",
hobbies=["pact testing", "programming", "qa"],
admin=False,
Expand All @@ -121,7 +121,7 @@ def default_mock_db() -> dict[int, User]:
id=2,
name="Bob",
email=None, # Edge case: email is None
created_on=datetime(1999, 12, 31, 23, 59, 59, tzinfo=timezone.utc),
created_on=datetime(1999, 12, 31, 23, 59, 59, tzinfo=UTC),
ip_address="",
hobbies=[],
admin=True,
Expand All @@ -130,7 +130,7 @@ def default_mock_db() -> dict[int, User]:
id=10,
name="Charlie",
email="charlie@example.com",
created_on=datetime(2025, 8, 8, 8, 8, 8, tzinfo=timezone.utc),
created_on=datetime(2025, 8, 8, 8, 8, 8, tzinfo=UTC),
ip_address="3.4.5.6",
hobbies=[""],
admin=False,
Expand All @@ -139,7 +139,7 @@ def default_mock_db() -> dict[int, User]:
id=42,
name="Dana",
email="dana+test@example.com",
created_on=datetime(2022, 2, 22, 2, 22, 22, tzinfo=timezone.utc),
created_on=datetime(2022, 2, 22, 2, 22, 22, tzinfo=UTC),
ip_address="255.255.255.255",
hobbies=["edge", "case", "testing"],
admin=False,
Expand Down
2 changes: 1 addition & 1 deletion examples/http/requests_and_fastapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ This example is intended for software engineers and engineering managers who wan

## Prerequisites

- Python 3.10 or higher
- Python 3.11 or higher
- A dependency manager ([uv](https://docs.astral.sh/uv/) recommended, [pip](https://pip.pypa.io/en/stable/) also works)

## Running the Example
Expand Down
10 changes: 1 addition & 9 deletions examples/http/requests_and_fastapi/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
from __future__ import annotations

import logging
import sys
from dataclasses import dataclass
from datetime import datetime
from typing import TYPE_CHECKING, Any
Expand All @@ -36,8 +35,7 @@

if TYPE_CHECKING:
from types import TracebackType

from typing_extensions import Self
from typing import Self

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -197,9 +195,6 @@ def get_user(self, user_id: int) -> User:
response.raise_for_status()
data: dict[str, Any] = response.json()

# Python < 3.11 don't support ISO 8601 offsets without a colon
if sys.version_info < (3, 11) and data["created_on"][-4:].isdigit():
data["created_on"] = data["created_on"][:-2] + ":" + data["created_on"][-2:]
return User(
id=data["id"],
name=data["name"],
Expand Down Expand Up @@ -233,9 +228,6 @@ def create_user(
response.raise_for_status()
data = response.json()

# Python < 3.11 don't support ISO 8601 offsets without a colon
if sys.version_info < (3, 11) and data["created_on"][-4:].isdigit():
data["created_on"] = data["created_on"][:-2] + ":" + data["created_on"][-2:]
logger.debug("Created user %s", data["id"])
return User(
id=data["id"],
Expand Down
6 changes: 3 additions & 3 deletions examples/http/requests_and_fastapi/provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
from __future__ import annotations

import logging
from datetime import datetime, timezone
from datetime import UTC, datetime
from typing import Any, ClassVar

from fastapi import FastAPI, HTTPException, status
Expand All @@ -52,7 +52,7 @@ class User(BaseModel):

id: int
name: str
created_on: datetime = Field(default_factory=lambda: datetime.now(tz=timezone.utc))
created_on: datetime = Field(default_factory=lambda: datetime.now(tz=UTC))
email: str | None = None
ip_address: str | None = None
hobbies: list[str] = Field(default_factory=list)
Expand Down Expand Up @@ -195,7 +195,7 @@ async def create_user(data: dict[str, Any]) -> User:
user = User(
id=UserDb.new_user_id(),
name=data["name"],
created_on=datetime.now(tz=timezone.utc),
created_on=datetime.now(tz=UTC),
email=data.get("email"),
ip_address=data.get("ip_address"),
hobbies=data.get("hobbies", []),
Expand Down
4 changes: 2 additions & 2 deletions examples/http/requests_and_fastapi/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ name = "example-requests-and-fastapi"
description = "Example of using a requests client and FastAPI server with Pact Python"

version = "1.0.0"
requires-python = ">=3.10"
dependencies = ["fastapi~=0.0", "requests~=2.0", "typing-extensions~=4.0"]
requires-python = ">=3.11"
dependencies = ["fastapi~=0.0", "requests~=2.0"]

[dependency-groups]
test = ["pact-python", "pytest~=9.0", "uvicorn~=0.29"]
Expand Down
4 changes: 2 additions & 2 deletions examples/http/requests_and_fastapi/test_consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from __future__ import annotations

import logging
from datetime import datetime, timezone
from datetime import UTC, datetime
from typing import TYPE_CHECKING, Any

import pytest
Expand Down Expand Up @@ -125,7 +125,7 @@ def test_create_user(pact: Pact) -> None:
response: dict[str, Any] = {
"id": match.int(1000),
"name": "Bob",
"created_on": match.datetime(datetime.now(tz=timezone.utc)),
"created_on": match.datetime(datetime.now(tz=UTC)),
}

(
Expand Down
10 changes: 5 additions & 5 deletions examples/http/requests_and_fastapi/test_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import contextlib
import dataclasses
import logging
from datetime import datetime, timezone
from datetime import UTC, datetime
from threading import Thread
from typing import TYPE_CHECKING, Any, Literal

Expand Down Expand Up @@ -114,7 +114,7 @@ def default_mock_db() -> dict[int, User]:
id=1,
name="Alice",
email="alice@example.com",
created_on=datetime(2020, 1, 1, 12, 0, 0, tzinfo=timezone.utc),
created_on=datetime(2020, 1, 1, 12, 0, 0, tzinfo=UTC),
ip_address="1.2.3.4",
hobbies=["pact testing", "programming", "qa"],
admin=False,
Expand All @@ -123,7 +123,7 @@ def default_mock_db() -> dict[int, User]:
id=2,
name="Bob",
email=None, # Edge case: email is None
created_on=datetime(1999, 12, 31, 23, 59, 59, tzinfo=timezone.utc),
created_on=datetime(1999, 12, 31, 23, 59, 59, tzinfo=UTC),
ip_address="",
hobbies=[],
admin=True,
Expand All @@ -132,7 +132,7 @@ def default_mock_db() -> dict[int, User]:
id=10,
name="Charlie",
email="charlie@example.com",
created_on=datetime(2025, 8, 8, 8, 8, 8, tzinfo=timezone.utc),
created_on=datetime(2025, 8, 8, 8, 8, 8, tzinfo=UTC),
ip_address="3.4.5.6",
hobbies=[""],
admin=False,
Expand All @@ -141,7 +141,7 @@ def default_mock_db() -> dict[int, User]:
id=42,
name="Dana",
email="dana+test@example.com",
created_on=datetime(2022, 2, 22, 2, 22, 22, tzinfo=timezone.utc),
created_on=datetime(2022, 2, 22, 2, 22, 22, tzinfo=UTC),
ip_address="255.255.255.255",
hobbies=["edge", "case", "testing"],
admin=False,
Expand Down
4 changes: 2 additions & 2 deletions examples/http/service_consumer_provider/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ name = "example-service-consumer-provider"
description = "Example of a service acting as both a Pact consumer and provider"

version = "1.0.0"
requires-python = ">=3.10"
dependencies = ["fastapi~=0.0", "requests~=2.0", "typing-extensions~=4.0"]
requires-python = ">=3.11"
dependencies = ["fastapi~=0.0", "requests~=2.0"]

[dependency-groups]
test = ["pact-python", "pytest~=9.0", "uvicorn~=0.29"]
Expand Down
2 changes: 1 addition & 1 deletion examples/http/xml_example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ For JSON-based examples using the same matchers, see

## Prerequisites

- Python 3.10 or higher
- Python 3.11 or higher
- A dependency manager ([uv](https://docs.astral.sh/uv/) recommended,
[pip](https://pip.pypa.io/en/stable/) also works)

Expand Down
3 changes: 1 addition & 2 deletions examples/http/xml_example/consumer.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@

if TYPE_CHECKING:
from types import TracebackType

from typing_extensions import Self
from typing import Self

logger = logging.getLogger(__name__)

Expand Down
4 changes: 2 additions & 2 deletions examples/http/xml_example/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ name = "example-xml"
description = "Example of XML contract testing with Pact Python"

version = "1.0.0"
requires-python = ">=3.10"
dependencies = ["fastapi~=0.0", "requests~=2.0", "typing-extensions~=4.0"]
requires-python = ">=3.11"
dependencies = ["fastapi~=0.0", "requests~=2.0"]

[dependency-groups]
test = ["pact-python", "pytest~=9.0", "uvicorn~=0.29"]
Expand Down
Loading
Loading