From 5702a79807cdb2415a53e096eab77836fa00ba9b Mon Sep 17 00:00:00 2001 From: Artur Shiriev Date: Mon, 5 Oct 2026 18:17:01 +0300 Subject: [PATCH] feat: support modern-di 4 Widen the requirement to modern-di>=3.1,<5. The fetch_request_path test helper drops its None default and the comment that described 3.x optional context. --- pyproject.toml | 2 +- tests/conftest.py | 2 +- tests/dependencies.py | 7 ++----- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index f5dbb25..87d6990 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -17,7 +17,7 @@ classifiers = [ "Typing :: Typed", "Topic :: Software Development :: Libraries", ] -dependencies = ["flask>=3,<4", "modern-di>=3.1,<4"] +dependencies = ["flask>=3,<4", "modern-di>=3.1,<5"] version = "0" [project.urls] diff --git a/tests/conftest.py b/tests/conftest.py index ca59e40..4130d8a 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -16,6 +16,6 @@ def app() -> Flask: @pytest.fixture def container() -> typing.Iterator[Container]: - # caller owns opening the root container under modern-di 3.x's mandatory-open lifecycle + # caller owns opening the root container under modern-di's mandatory-open lifecycle with Container(groups=[Dependencies]) as container_: yield container_ diff --git a/tests/dependencies.py b/tests/dependencies.py index c2f9da1..a8b4ea0 100644 --- a/tests/dependencies.py +++ b/tests/dependencies.py @@ -14,11 +14,8 @@ class DependentCreator: dep1: SimpleCreator -def fetch_request_path(request: flask.Request | None = None) -> str: - # Optional-with-default so an explicit container.validate() treats the request - # as optional (the provider is only registered by setup_di); the real request - # still injects at runtime. - return request.path if request else "" +def fetch_request_path(request: flask.Request) -> str: + return request.path class Dependencies(Group):