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
5 changes: 5 additions & 0 deletions .changelog/plain-mules-fix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
pympp: patch
---

Added Python 3.11 support by lowering the `requires-python` constraint from `>=3.12` to `>=3.11`, updating tooling targets accordingly, and replacing PEP 695 generic syntax with `TypeVar` for compatibility.
7 changes: 4 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "pympp"
version = "0.5.2"
description = "Python SDK for the Machine Payments Protocol (MPP)"
readme = "README.md"
requires-python = ">=3.12"
requires-python = ">=3.11"
dependencies = [
"httpx>=0.27",
]
Expand All @@ -15,6 +15,7 @@ classifiers = [
"License :: OSI Approved :: MIT License",
"License :: OSI Approved :: Apache Software License",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Typing :: Typed",
Expand Down Expand Up @@ -68,7 +69,7 @@ packages = ["src/mpp"]

[tool.ruff]
line-length = 100
target-version = "py312"
target-version = "py311"
exclude = ["examples"]

[tool.ruff.lint]
Expand All @@ -82,7 +83,7 @@ ignore = []
quote-style = "double"

[tool.pyright]
pythonVersion = "3.12"
pythonVersion = "3.11"
typeCheckingMode = "standard"
include = ["src", "tests"]

Expand Down
8 changes: 5 additions & 3 deletions src/mpp/server/decorator.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import json as _json
from collections.abc import Awaitable, Callable
from functools import wraps
from typing import TYPE_CHECKING, Any
from typing import TYPE_CHECKING, Any, TypeVar

from mpp import Challenge, Credential, Receipt
from mpp.errors import PaymentRequiredError
Expand All @@ -16,6 +16,8 @@
if TYPE_CHECKING:
from mpp.server.intent import Intent

R = TypeVar("R")

RequestParamsType = dict[str, Any] | Callable[[Any], dict[str, Any]]


Expand Down Expand Up @@ -63,7 +65,7 @@ def make_challenge_response(challenge: Challenge, realm: str) -> Any:
}


def wrap_payment_handler[R](
def wrap_payment_handler(
handler: Callable[..., Awaitable[R]],
verify_fn: Callable[[str | None, Any], Awaitable[Challenge | tuple[Credential, Receipt]]],
realm_fn: Callable[[], str],
Expand Down Expand Up @@ -117,7 +119,7 @@ async def wrapper(*args: Any, **kwargs: Any) -> R | Any:
return wrapper


def pay[R](
def pay(
*,
intent: Intent,
request: RequestParamsType,
Expand Down