Skip to content

Commit 7737475

Browse files
fix(packaging): floor-only client pin, scope extra-files, prune heavy-wheel tests
Addresses review of the dual-wheel split (#370): - adk: pin agentex-sdk-client floor-only (>=0.11.5). The two packages co-version and release-please can't rewrite a dep string, so a <0.12 ceiling would make the first 0.12.0 cut unresolvable (slim is a new PyPI name with no 0.11.x to fall back to). - adk: prune agentex/lib/** test files from the heavy wheel via a custom hatch build hook — force-include ignores `exclude` (hatchling #1395). Drops 14 test files; keeps the 138 .j2 templates and py.typed. The hook imports build-only hatchling, so it's excluded from pyright. - release-please-config: scope extra-files (_version.py) to the slim package so a heavy-only release can't overwrite the slim's __version__. - run_agent_test.sh: fail loud when a wheel is missing instead of silently testing the pre-installed SDK; fix the dead repo-root fallback glob (quoted inside ls). - ci: add scripts/check-slim-deps guardrail asserting root pyproject keeps exactly the 6 slim deps — catches Stainless re-adding the ADK deps. - requirements{,-dev}.lock: regenerate for the two-package workspace via rye sync — the locks still named the pre-split agentex-sdk and pinned openai-agents below the new >=0.14.3 floor. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 8068352 commit 7737475

9 files changed

Lines changed: 125 additions & 208 deletions

File tree

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ jobs:
3737
- name: Run lints
3838
run: ./scripts/lint
3939

40+
- name: Check slim dependency set
41+
run: ./scripts/check-slim-deps
42+
4043
build:
4144
if: (github.event_name == 'push' || github.event.pull_request.head.repo.fork) && (github.event_name != 'push' || github.event.head_commit.message != 'codegen metadata')
4245
timeout-minutes: 10

adk/hatch_build.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
"""Builds the agentex/lib force-include map per-file so test files can be pruned
2+
— force-include ignores `exclude` (hatchling #1395)."""
3+
4+
from __future__ import annotations
5+
6+
import os
7+
8+
from hatchling.builders.hooks.plugin.interface import BuildHookInterface
9+
10+
_SKIP_DIRS = {"__pycache__", "tests"}
11+
_SKIP_NAMES = {"conftest.py", "pytest.ini", "run_tests.py"}
12+
# Floor below the ~333 shippable files: a collapse means the walk broke — fail
13+
# loud rather than ship a near-empty wheel.
14+
_MIN_FILES = 320
15+
16+
17+
def _is_test_file(name: str) -> bool:
18+
return name in _SKIP_NAMES or (name.startswith("test_") and name.endswith(".py"))
19+
20+
21+
class CustomBuildHook(BuildHookInterface):
22+
PLUGIN_NAME = "custom"
23+
24+
def initialize(self, version: str, build_data: dict) -> None: # noqa: ARG002
25+
lib_root = os.path.normpath(os.path.join(self.root, "..", "src", "agentex", "lib"))
26+
force_include = build_data.setdefault("force_include", {})
27+
collected = 0
28+
for dirpath, dirnames, filenames in os.walk(lib_root):
29+
dirnames[:] = [d for d in dirnames if d not in _SKIP_DIRS]
30+
for name in filenames:
31+
if _is_test_file(name):
32+
continue
33+
src = os.path.join(dirpath, name)
34+
rel = os.path.relpath(src, lib_root)
35+
force_include[src] = os.path.join("agentex", "lib", rel)
36+
collected += 1
37+
if collected < _MIN_FILES:
38+
raise RuntimeError(
39+
f"agentex/lib force-include collected only {collected} files "
40+
f"(expected >= {_MIN_FILES}); aborting build."
41+
)

adk/pyproject.toml

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,9 @@ authors = [
1616
readme = "README.md"
1717

1818
dependencies = [
19-
# Lockstep with this package's own version — both are co-released. The
20-
# heavy package imports from `agentex.types.*` and `agentex.protocol.*`
21-
# which ship from the slim, so a slim bump that drops/renames anything
22-
# imported here would silently break heavy. Bump this range whenever the
23-
# slim's major/minor changes.
24-
"agentex-sdk-client>=0.11.4,<0.12",
19+
# Co-released in lockstep; floor-only by design — a ceiling would
20+
# eventually exclude the co-versioned slim (release-please can't bump it).
21+
"agentex-sdk-client>=0.11.5",
2522
# CLI surface (agentex.lib.cli.*, agentex.lib.sdk.config.*)
2623
"typer>=0.16,<0.17",
2724
"questionary>=2.0.1,<3",
@@ -94,8 +91,10 @@ build-backend = "hatchling.build"
9491
[tool.hatch.build.targets.wheel]
9592
bypass-selection = true
9693

97-
[tool.hatch.build.targets.wheel.force-include]
98-
"../src/agentex/lib" = "agentex/lib"
94+
# Builds the ../src/agentex/lib force-include map per-file (see hatch_build.py)
95+
# so test files can be pruned — force-include ignores `exclude` (hatchling #1395).
96+
[tool.hatch.build.targets.wheel.hooks.custom]
97+
path = "hatch_build.py"
9998

10099
# Sdist deferred: hatchling can't represent the wheel's ../src/agentex/lib
101100
# force-include in an sdist include list. CI + bin/publish-pypi pass --wheel.

examples/tutorials/run_agent_test.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,15 +280,17 @@ run_test() {
280280
local heavy_wheel slim_wheel
281281
heavy_wheel=$(ls /home/runner/work/*/*/adk/dist/agentex_sdk-*.whl 2>/dev/null | head -n1)
282282
if [[ -z "$heavy_wheel" ]]; then
283-
heavy_wheel=$(ls "${SCRIPT_DIR}/../../adk/dist/agentex_sdk-*.whl" 2>/dev/null | head -n1)
283+
heavy_wheel=$(ls "${SCRIPT_DIR}"/../../adk/dist/agentex_sdk-*.whl 2>/dev/null | head -n1)
284284
fi
285285
slim_wheel=$(ls /home/runner/work/*/*/dist/agentex_sdk_client-*.whl 2>/dev/null | head -n1)
286286
if [[ -z "$slim_wheel" ]]; then
287-
slim_wheel=$(ls "${SCRIPT_DIR}/../../dist/agentex_sdk_client-*.whl" 2>/dev/null | head -n1)
287+
slim_wheel=$(ls "${SCRIPT_DIR}"/../../dist/agentex_sdk_client-*.whl 2>/dev/null | head -n1)
288288
fi
289-
if [[ -n "$heavy_wheel" && -n "$slim_wheel" ]]; then
290-
pytest_cmd=("uv" "run" "--with" "$heavy_wheel" "--with" "$slim_wheel" "--with" "pytest" "--with" "pytest-asyncio" "pytest")
289+
if [[ -z "$heavy_wheel" || -z "$slim_wheel" ]]; then
290+
echo -e "${RED}❌ BUILD_CLI=true but a wheel is missing (heavy='${heavy_wheel}' slim='${slim_wheel}'); refusing to test against the pre-installed SDK${NC}"
291+
return 1
291292
fi
293+
pytest_cmd=("uv" "run" "--with" "$heavy_wheel" "--with" "$slim_wheel" "--with" "pytest" "--with" "pytest-asyncio" "pytest")
292294
fi
293295

294296
local max_retries=5

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,8 @@ exclude = [
186186
# Exclude autogenerated Stainless code from type checking
187187
"src/agentex/resources",
188188
"src/agentex/types",
189+
# Build-time hook; imports hatchling, a build dep absent from the synced env.
190+
"adk/hatch_build.py",
189191
]
190192

191193
reportImplicitOverride = true

release-please-config.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
{
22
"packages": {
33
".": {
4-
"component": "agentex-sdk-client"
4+
"component": "agentex-sdk-client",
5+
"extra-files": [
6+
"src/agentex/_version.py"
7+
]
58
},
69
"adk": {
710
"component": "agentex-sdk"
@@ -64,8 +67,5 @@
6467
"hidden": true
6568
}
6669
],
67-
"release-type": "python",
68-
"extra-files": [
69-
"src/agentex/_version.py"
70-
]
70+
"release-type": "python"
7171
}

0 commit comments

Comments
 (0)