Skip to content

chore(deps): drop unused runtime deps and exclude tests from wheel#367

Merged
max-parke-scale merged 1 commit into
nextfrom
maxparke/agx1-292-drop-unused-runtime-deps
May 26, 2026
Merged

chore(deps): drop unused runtime deps and exclude tests from wheel#367
max-parke-scale merged 1 commit into
nextfrom
maxparke/agx1-292-drop-unused-runtime-deps

Conversation

@max-parke-scale
Copy link
Copy Markdown
Contributor

@max-parke-scale max-parke-scale commented May 26, 2026

Summary

First of a planned set under AGX1-292. Zero-risk wins.

The published agentex-sdk wheel declares 44 required runtime deps. Audit found that 8 of them are imported nowhere in src/ and 2 more (pytest, pytest-asyncio) are only used by test files we accidentally ship inside the wheel.

Dropped (zero imports anywhere in src/agentex/**)

Dep Notes
anthropic>=0.40.0 Transitively pulled by claude-agent-sdk if a consumer actually uses it.
datadog>=0.52.1 Likely confused with ddtrace (kept).
tornado>=6.5.5 Was a security pin transitively pulled by ipykernel; both unused.
ipykernel>=6.29.5
tzlocal>=5.3.1
tzdata>=2025.2 temporalio will pull what it needs.

Tests stop shipping in the wheel

hatchling's packages = ["src/agentex"] was including 24 test files (tests/, conftest.py, pytest.ini, test_*.py) under src/agentex/lib/. Those forced pytest + pytest-asyncio into the runtime metadata. Added an exclude to the wheel target so they stop shipping; dropped both deps.

The Jinja templates at lib/cli/templates/**/test_agent.py.j2 are intentionally preserved — those render into scaffolded user projects and don't end in .py.

mcp[cli]mcp

The [cli] extra of mcp pulls typer/rich/pyperclip for the mcp dev CLI; the SDK only uses from mcp import StdioServerParameters.

Verification

python -m build --wheel
unzip -p dist/agentex_sdk-*.whl '*.dist-info/METADATA' | grep -c '^Requires-Dist'
# before: 47    after: 40 (37 required + 3 extras)

unzip -l dist/agentex_sdk-*.whl | grep -cE '(tests/|conftest|pytest\.ini|test_[^/]+\.py$)'
# before: 24    after: 0

unzip -l dist/agentex_sdk-*.whl | grep -c 'test_agent.py.j2'
# 10 (preserved — these are templates, not tests)

Test plan

  • CI builds the wheel and Validate PR title passes.
  • No Requires-Dist regression in the published wheel after release.
  • Downstream agentex-server install (in scaleapi/scale-agentex) still resolves — the deps dropped here either weren't used or are transitively available via siblings (e.g. temporalio brings tz data).

Follow-ups (separate PRs)

  • Move ADK/server-side deps to opt-in extras ([adk], [cli], [server], [temporal], [provider-*], [observability]).
  • Lazify provider imports in src/agentex/lib/adk/__init__.py so the extras split is safe.

Both tracked in AGX1-292.

Greptile Summary

This maintenance PR removes 8 runtime dependencies that have zero imports anywhere in src/agentex/, downgrades mcp[cli] to mcp (since only StdioServerParameters is imported), and adds hatchling exclude rules to stop test infrastructure files from shipping inside the published wheel.

  • All removed packages (tornado, ipykernel, tzlocal, tzdata, datadog, anthropic, pytest, pytest-asyncio) were confirmed to have no direct imports in src/agentex/** — grep returns zero matches for each.
  • The four from mcp import StdioServerParameters call sites are all in the core mcp namespace, unaffected by dropping the [cli] extra.
  • Wheel exclude patterns (lib/**/tests/**, lib/**/test_*.py, lib/**/conftest.py, lib/**/pytest.ini) correctly cover every test file currently present under src/agentex/lib/.

Confidence Score: 5/5

Safe to merge — all removed packages are confirmed unused in src/ and the wheel exclude patterns cover every test file in the current codebase.

Every dropped dependency was verified to have zero direct imports in src/agentex. The mcp[cli]→mcp narrowing is backed by four call sites that exclusively import StdioServerParameters from the core namespace. The wheel exclude globs match all test files present under src/agentex/lib/, and the Jinja templates are correctly left untouched.

No files require special attention. pyproject.toml is the only changed file and the edits are straightforward.

Important Files Changed

Filename Overview
pyproject.toml Drops 8 unused runtime dependencies, narrows mcp[cli] to mcp, and adds wheel exclude patterns to prevent test files shipping in the published package.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[agentex-sdk wheel] --> B[Runtime deps kept]
    A --> C[Deps removed]
    A --> D[Wheel build target]

    B --> B1[mcp - StdioServerParameters only]
    B --> B2[claude-agent-sdk - transitively pulls anthropic]
    B --> B3[temporalio - transitively pulls tzdata]
    B --> B4[ddtrace - replaced datadog]

    C --> C1[tornado - security pin, unused]
    C --> C2[ipykernel - unused]
    C --> C3[tzlocal / tzdata - transitive via temporalio]
    C --> C4[datadog - confused with ddtrace]
    C --> C5[anthropic - transitive via claude-agent-sdk]
    C --> C6[pytest / pytest-asyncio - test-only]

    D --> E[packages = src/agentex]
    D --> F[exclude patterns added]
    F --> F1[lib/**/tests/**]
    F --> F2[lib/**/test_*.py]
    F --> F3[lib/**/conftest.py]
    F --> F4[lib/**/pytest.ini]
    F --> G[Jinja templates test_agent.py.j2 preserved]
Loading

Reviews (1): Last reviewed commit: "chore(deps): drop unused runtime deps an..." | Re-trigger Greptile

Audit (AGX1-292) found that the published wheel declared 8 deps with zero
import sites in `src/`, plus shipped its own test files under
`src/agentex/lib/.../tests/` — which forced `pytest` and `pytest-asyncio` to
appear as runtime deps.

Dropped: tornado, ipykernel, tzlocal, tzdata, datadog, anthropic, pytest,
pytest-asyncio. Also strips the `[cli]` extra from `mcp` (only
`StdioServerParameters` is imported).

Hatchling wheel `exclude` added so the test trees stop shipping. The Jinja
templates under `lib/cli/templates/**/test_agent.py.j2` are intentionally
preserved — they render into scaffolded user projects.

Verified locally:
- `Requires-Dist` count 44 → 37
- Test files in wheel 24 → 0
- `.j2` agent templates still present (10)

Follow-ups in AGX1-292: extras-based split of ADK/server deps, and lazy
imports under `agentex.lib.adk` to keep that safe.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
max-parke-scale added a commit that referenced this pull request May 26, 2026
Bare `pip install agentex-sdk` now installs only the 6 deps the
Stainless-generated REST client actually needs (`httpx`, `pydantic`,
`typing-extensions`, `anyio`, `distro`, `sniffio`). Everything used by the
`agentex.lib.*` surface — CLI, ACP server, Temporal workflows, LLM provider
integrations, observability — moves to a single `[adk]` optional extra.

The current install behavior is recoverable with `pip install agentex-sdk[adk]`.

BREAKING CHANGE: consumers who rely on `agentex.lib.*` (CLI, ADK, fastacp,
temporal, providers) must switch from `agentex-sdk` to `agentex-sdk[adk]`.
The REST client surface (`from agentex import Agentex, AsyncAgentex`) is
unchanged and still works with a bare install.

Verified by building the wheel locally:
- `Requires-Dist` (base): 6
- `Requires-Dist; extra == 'adk'`: 31
- Bare install pulls ~6 packages instead of ~hundreds.

Stacked on AGX1-292 / #367 (drop unused deps).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
max-parke-scale added a commit that referenced this pull request May 26, 2026
…bility] extras

Bare `pip install agentex-sdk` now installs only the 6 deps the
Stainless-generated REST client actually needs (`httpx`, `pydantic`,
`typing-extensions`, `anyio`, `distro`, `sniffio`). Everything used by the
`agentex.lib.*` surface — CLI, ACP server, Temporal workflows, LLM provider
integrations, observability — moves to optional extras.

Three extras for different consumer slices:
- `[cli]` (11 deps) — `agentex.lib.cli.*`, `agentex.lib.sdk.config.*`, and the
  `agentex` CLI entry point. For tools like sgpctl that need the CLI helpers
  without temporal/fastapi/redis.
- `[observability]` (4 deps) — `agentex.lib.core.tracing.*`,
  `agentex.lib.core.observability.*`. For consumers that only attach the
  SGP/Datadog/OTel tracing processors.
- `[adk]` (31 deps) — union of [cli] + [observability] + ACP server + Temporal
  + Redis + MCP + LLM providers. Full agent authoring.

The current install behavior is recoverable with `pip install agentex-sdk[adk]`.
CLI templates (`agentex init`) are updated to pin `agentex-sdk[adk]` so newly
bootstrapped agents work out of the box.

BREAKING CHANGE: consumers who rely on `agentex.lib.*` must pin one of the new
extras instead of bare `agentex-sdk`. The REST client surface
(`from agentex import Agentex, AsyncAgentex`) is unchanged and still works with
a bare install.

Verified by building the wheel locally:
- `Requires-Dist` (base): 6
- `Requires-Dist; extra == 'cli'`: 11
- `Requires-Dist; extra == 'observability'`: 4
- `Requires-Dist; extra == 'adk'`: 31

Stacked on AGX1-292 / #367 (drop unused deps).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@max-parke-scale max-parke-scale merged commit f4303d1 into next May 26, 2026
37 checks passed
@max-parke-scale max-parke-scale deleted the maxparke/agx1-292-drop-unused-runtime-deps branch May 26, 2026 21:48
@stainless-app stainless-app Bot mentioned this pull request May 26, 2026
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.

2 participants