Skip to content

Fix dependency update checks for ty and AnyIO deprecations - #406

Merged
zmievsa merged 2 commits into
mainfrom
fix/coroutine-detection-deprecation
Sep 4, 2026
Merged

Fix dependency update checks for ty and AnyIO deprecations#406
zmievsa merged 2 commits into
mainfrom
fix/coroutine-detection-deprecation

Conversation

@zmievsa

@zmievsa zmievsa commented Sep 3, 2026

Copy link
Copy Markdown
Owner

The scheduled dependency-update run failed before pytest because ty 0.0.78 reports asyncio.iscoroutinefunction as deprecated for Python 3.11 and 3.12. After resolving that, upgraded dependencies exposed a second collection failure: Starlette imports anyio.abc.BlockingPortal, an alias deprecated by AnyIO 4.15.

Preserve FastAPI's coroutine detection: asyncio.iscoroutinefunction below Python 3.13 and inspect.iscoroutinefunction on Python 3.13 and newer. The asyncio implementation recognizes the legacy _is_coroutine marker. Cadwyn must agree with FastAPI about whether to await a dependency, so replacing that implementation solely to silence a deprecation diagnostic would change compatibility. The code comment records this reasoning, and local suppressions handle the checker diagnostics.

Add a pytest warning filter scoped to Starlette's use of the deprecated AnyIO alias. Update the locked ty and AnyIO versions so regular PR CI checks both failures, and record the typing compatibility fix in the changelog.

Reported run: https://github.com/zmievsa/cadwyn/actions/runs/33707914502
FastAPI's version split: https://github.com/fastapi/fastapi/blob/0.141.1/fastapi/dependencies/models.py#L11-L14

Validation:

  • Reproduced the type-checker diagnostics and the Starlette import failure before their respective fixes.
  • Manual HTTP requests through two Cadwyn API versions, with plain FastAPI as a control, return the expected values from marked coroutine functions and callable instances on Python 3.10, 3.11, 3.12, 3.13, and 3.14.
  • All 393 existing tests and type checks pass on each supported Python version, both with the final lockfile and after uv lock --upgrade.
  • uv run --locked tox run-parallel --parallel-no-spinner -e py3.10,py3.11,py3.12,py3.13,py3.14,lint -- -q passes, including all lint hooks.

The fix preserves the runtime behavior on main, so the existing regression tests remain unchanged.

@codecov

codecov Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (966d07f) to head (d05d1e3).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #406   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           71        71           
  Lines         6243      6243           
  Branches       377       377           
=========================================
  Hits          6243      6243           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@zmievsa
zmievsa merged commit 799b92c into main Sep 4, 2026
15 checks passed
@zmievsa
zmievsa deleted the fix/coroutine-detection-deprecation branch September 4, 2026 09:29
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