Skip to content

fix: annotate context managers with Generator for ty 0.0.85 - #278

Merged
lesnik512 merged 1 commit into
mainfrom
fix/ty-0-0-85
Oct 7, 2026
Merged

lesnik512 merged 1 commit into
mainfrom
fix/ty-0-0-85

Conversation

@lesnik512

Copy link
Copy Markdown
Member

Summary

Closes #277

ty 0.0.85 bundles a typeshed that deprecates the contextmanager and asynccontextmanager overloads for functions annotated -> Iterator[T] or -> AsyncIterator[T]. ty check reported 9 such warnings, which failed the scheduled lint-ci run. This annotates those functions with Generator[T] and AsyncGenerator[T].

They come from collections.abc, because typing.Generator needs all three type arguments before Python 3.13.

Changes

  • lite_bootstrap/bootstrappers/fastapi_bootstrapper.py, fastmcp_bootstrapper.py: lifespan context managers return AsyncGenerator[...]
  • lite_bootstrap/exceptions.py: capture and collect_teardown_errors return Generator[...]; drop the now unused typing import
  • tests/conftest.py, tests/test_fastapi_bootstrap.py, tests/test_litestar_bootstrap.py: test context managers return Generator[...]

Checklist

  • Lint and format pass (ruff)
  • Type check passes (ty)
  • Tests pass and new behavior is covered
  • Build succeeds (uv build) if packaging or build config changed
  • Repo metadata stays consistent across the three surfaces (GitHub description, pyproject description, profile blurb) if this touches packaging

@lesnik512
lesnik512 merged commit 5b4ee4f into main Oct 7, 2026
30 checks passed
@lesnik512
lesnik512 deleted the fix/ty-0-0-85 branch October 7, 2026 16:24
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.

Scheduled dependency check failed

1 participant