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
11 changes: 6 additions & 5 deletions .github/workflows/constraints.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
pip==24.0
nox==2023.4.22
nox-poetry==1.0.3
poetry==1.7.1
virtualenv==20.25.0
pip==26.3
nox==2026.10.20
nox-poetry==1.2.0
poetry==2.5.1
poetry-plugin-export==1.10.1
virtualenv==21.15.9
26 changes: 15 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,27 @@ jobs:
matrix:
include:
# mypy
- { python: "3.15", os: "ubuntu-latest", session: "mypy" }
- { python: "3.14", os: "ubuntu-latest", session: "mypy" }
- { python: "3.13", os: "ubuntu-latest", session: "mypy" }
- { python: "3.12", os: "ubuntu-latest", session: "mypy" }
- { python: "3.11", os: "ubuntu-latest", session: "mypy" }
- { python: "3.10", os: "ubuntu-latest", session: "mypy" }
- { python: "3.9", os: "ubuntu-latest", session: "mypy" }
- { python: "3.8", os: "ubuntu-latest", session: "mypy" }
# testes
- { python: "3.15", os: "ubuntu-latest", session: "tests" }
- { python: "3.14", os: "ubuntu-latest", session: "tests" }
- { python: "3.13", os: "ubuntu-latest", session: "tests" }
- { python: "3.12", os: "ubuntu-latest", session: "tests" }
- { python: "3.11", os: "ubuntu-latest", session: "tests" }
- { python: "3.10", os: "ubuntu-latest", session: "tests" }
- { python: "3.9", os: "ubuntu-latest", session: "tests" }
- { python: "3.8", os: "ubuntu-latest", session: "tests" }
# tests mac / windows
- { python: "3.11", os: "windows-latest", session: "tests" }
- { python: "3.11", os: "macos-latest", session: "tests" }
- { python: "3.14", os: "windows-latest", session: "tests" }
- { python: "3.14", os: "macos-latest", session: "tests" }
# misc
- { python: "3.11", os: "ubuntu-latest", session: "pre-commit" }
- { python: "3.11", os: "ubuntu-latest", session: "typeguard" }
- { python: "3.11", os: "ubuntu-latest", session: "xdoctest" }
- { python: "3.11", os: "ubuntu-latest", session: "docs-build" }
- { python: "3.14", os: "ubuntu-latest", session: "pre-commit" }
- { python: "3.14", os: "ubuntu-latest", session: "typeguard" }
- { python: "3.14", os: "ubuntu-latest", session: "xdoctest" }
- { python: "3.14", os: "ubuntu-latest", session: "docs-build" }

env:
NOXSESSION: ${{ matrix.session }}
Expand Down Expand Up @@ -66,6 +68,7 @@ jobs:
- name: Install Poetry
run: |
pipx install --pip-args=--constraint=${PWD}/.github/workflows/constraints.txt poetry
pipx inject --pip-args=--constraint=${PWD}/.github/workflows/constraints.txt poetry poetry-plugin-export
poetry --version

- name: Install Nox
Expand Down Expand Up @@ -127,7 +130,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5.4.0
with:
python-version: "3.11"
python-version: "3.14"

- name: Upgrade pip
run: |
Expand All @@ -137,6 +140,7 @@ jobs:
- name: Install Poetry
run: |
pipx install --pip-args=--constraint=${PWD}/.github/workflows/constraints.txt poetry
pipx inject --pip-args=--constraint=${PWD}/.github/workflows/constraints.txt poetry poetry-plugin-export
poetry --version

- name: Install Nox
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Request features on the [Issue Tracker].

## How to set up your development environment

You need Python 3.8+ and the following tools:
You need Python 3.10+ and the following tools:

- [Poetry]
- [Nox]
Expand Down
3 changes: 1 addition & 2 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

import nox


try:
from nox_poetry import Session
from nox_poetry import session
Expand All @@ -23,7 +22,7 @@
raise SystemExit(dedent(message)) from None

package = "requestmodel"
python_versions = ["3.11", "3.10", "3.9", "3.8", "3.12"]
python_versions = ["3.14", "3.15", "3.13", "3.12", "3.11", "3.10"]
nox.needs_version = ">= 2021.6.6"
nox.options.sessions = (
"pre-commit",
Expand Down
4,650 changes: 3,338 additions & 1,312 deletions poetry.lock

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ classifiers = [
Changelog = "https://github.com/foarsitter/requestmodel/releases"

[tool.poetry.dependencies]
python = ">=3.8"
python = ">=3.10"
httpx = "*"
pydantic = "^2.0.0"

Expand Down Expand Up @@ -69,7 +69,6 @@ fail_under = 100
[tool.isort]
profile = "black"
force_single_line = true
lines_after_imports = 2

[tool.mypy]
plugins = [
Expand Down
1 change: 0 additions & 1 deletion src/requestmodel/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from .model import IteratorRequestModel
from .model import RequestModel


__all__ = ["RequestModel", "IteratorRequestModel"]
1 change: 0 additions & 1 deletion src/requestmodel/fastapi.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
from typing_extensions import get_args
from typing_extensions import get_origin


IncEx = Union[Set[int], Set[str], Dict[int, Any], Dict[str, Any]]


Expand Down
2 changes: 1 addition & 1 deletion src/requestmodel/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class BaseRequestModel(BaseModel, Generic[ResponseType]):
url: ClassVar[str]
method: ClassVar[str]

response_model: ClassVar[Type[ResponseType]] # type: ignore[misc]
response_model: ClassVar[Type[ResponseType]]

def get_path_param_names(self) -> Set[str]:
return get_path_param_names(self.url)
Expand Down
24 changes: 11 additions & 13 deletions src/requestmodel/params.py
Original file line number Diff line number Diff line change
@@ -1,37 +1,35 @@
from typing import Any

from pydantic.fields import FieldInfo
from pydantic.fields import _FieldInfoInputs
from typing_extensions import Unpack


class Param(FieldInfo):
class Param(FieldInfo): # type: ignore[misc]
pass


class Body(Param):
def __init__(self, embed: bool = False, **kwargs: Unpack[_FieldInfoInputs]) -> None:
class Body(Param): # type: ignore[misc]
def __init__(self, embed: bool = False, **kwargs: Any) -> None:
super().__init__(**kwargs)
self.embed = embed


class Cookie(Param):
class Cookie(Param): # type: ignore[misc]
pass


class File(Param):
class File(Param): # type: ignore[misc]
pass


class Header(Param):
def __init__(
self, convert_underscores: bool = True, **kwargs: Unpack[_FieldInfoInputs]
) -> None:
class Header(Param): # type: ignore[misc]
def __init__(self, convert_underscores: bool = True, **kwargs: Any) -> None:
super().__init__(**kwargs)
self.convert_underscores = convert_underscores


class Path(Param):
class Path(Param): # type: ignore[misc]
pass


class Query(Param):
class Query(Param): # type: ignore[misc]
pass
1 change: 0 additions & 1 deletion src/requestmodel/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
from pydantic import TypeAdapter
from pydantic.fields import FieldInfo


ResponseType = TypeVar(
"ResponseType",
bound=Union[BaseModel, TypeAdapter[List[BaseModel]], List[BaseModel]],
Expand Down
1 change: 0 additions & 1 deletion tests/fastapi_server/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
from tests.fastapi_server.schema import NameModelList
from tests.fastapi_server.schema import PaginatedResponse


app = FastAPI()


Expand Down
10 changes: 0 additions & 10 deletions tests/test_request_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from typing import Type

import pytest
from fastapi._compat import field_annotation_is_scalar
from fastapi._compat import field_annotation_is_sequence
from pydantic import BaseModel
from pydantic import ValidationError
Expand Down Expand Up @@ -115,15 +114,6 @@ def test_field_annotation_is_sequence() -> None:
assert field_annotation_is_sequence(SimpleResponse) is False


def test_field_annotation_is_scalar() -> None:
assert field_annotation_is_scalar(Annotated[SimpleResponse, params.Path()]) is True

assert field_annotation_is_scalar(SimpleResponse) is False
assert field_annotation_is_scalar(str) is True
assert field_annotation_is_scalar(Annotated[str, params.Path()]) is True
assert field_annotation_is_scalar(Annotated[SimpleResponse, params.Path()]) is True


class SimpleRequest(RequestModel[SimpleResponse]):
url: ClassVar[str] = "test"
method: ClassVar[str] = "test"
Expand Down
Loading