Skip to content

feat: support modern-di 4 - #36

Draft
lesnik512 wants to merge 1 commit into
mainfrom
modern-di-4
Draft

lesnik512 wants to merge 1 commit into
mainfrom
modern-di-4

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Refs modern-python/modern-di#579.

Summary

  • Widen the requirement to modern-di>=3,<5.
  • docs/adr/0002-only-worker-lifecycle-is-wired.md: the last sentence cited ContainerClosedWarning, which 4.0 removes. It now says that from 4.0 a resolve from a closed container raises ContainerClosedError, so the unconditional container.open() on worker startup is what keeps the second worker cycle working.
  • tests/dependencies.py: fetch_task_name took message: TaskiqMessage | None = None. Tests only resolve it inside a task, where taskiq_message_provider has a value, and in 4.0 a registered ContextProvider with no value raises regardless of the creator default. The parameter is now required.

Verification

  • 3.x (modern-di 3.6.0 from PyPI): eof-fixer, ruff format/check and ty pass; pytest 10 passed, coverage 100%.
  • 4.0 (modern-di main f300c2e from a local wheel): ty passes; pytest 10 passed, coverage 100%.

This PR stays a draft until modern-di 4.0.0 is on PyPI.

Widen the requirement to modern-di>=3,<5. ADR 0002 now describes the 4.0 behaviour on a closed container, and the fetch_task_name test helper drops its unused None default.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant