Skip to content

workflow extra's anyio<4.7 pin blocks the mcp extra (anyio>=4.9) #139

Description

@LukasGold

osw[workflow] and osw[mcp] cannot be installed into the same environment.

  • osw[workflow] pins anyio>=4.4.0,<4.7
  • mcp>=2 requires anyio>=4.9 (anyio>=4.10 on Python 3.14+)

No anyio version satisfies both, so uv lock fails when both extras are resolvable together.

Why the anyio cap exists

prefect 2.20.25's GatherTaskGroup subclasses anyio's TaskGroup but does not
implement create_task, which newer anyio made abstract. Broken on anyio 4.14,
verified good on 4.6.2. prefect 2.20.25 is the final 2.x release, so no backport
is coming.

Current workaround

Applied in #133:

  1. [tool.uv] conflicts declares the mcp extra mutually exclusive with both the
    workflow extra and the dev dependency-group.
  2. mcp is excluded from the all extra and from the dev group, so the default
    resolution keeps the workflow-compatible anyio.
  3. The dev group lists prefect and anyio directly instead of inheriting them
    from osw[workflow]. Being in a conflict set, a self-referential osw[workflow]
    entry would only activate under --extra workflow, leaving a bare uv sync on
    anyio 4.14 (the version that breaks prefect). These pins now have to be kept in
    sync with the workflow extra by hand.
  4. The pytest stack moved into its own test group, since dev conflicts with the
    mcp extra and there would otherwise be no environment containing both pytest
    and mcp.
  5. src/osw/mcp is excluded from ty, since its imports are unresolvable in the
    default dev environment.
  6. The MCP unit tests use importorskip, so they skip in the default suite.

Cost

The MCP server module is neither type-checked nor unit-tested in the default
environment. Its tests pass (32 passed against mcp==2.0.0) but only when run
explicitly:

uv sync --extra mcp --group test --no-dev
uv run --extra mcp --group test --no-dev --no-sync python -m pytest tests/test_mcp_*.py

CI does not currently run that second environment.

What to check

Whether the anyio cap is still needed, either because a newer anyio restored the
non-abstract create_task path, or because the workflow extra can move to
prefect 3.x. If the cap can be lifted, revert all six workarounds above and put
mcp back into all and dev.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions