Skip to content

Commit 0a2418c

Browse files
authored
fix(tutorials): restore tutorial CI deps after agentex-sdk 0.11.5 (pytest + debugpy) (#379)
1 parent e1b31d9 commit 0a2418c

2 files changed

Lines changed: 17 additions & 5 deletions

File tree

examples/tutorials/run_agent_test.sh

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,16 +259,23 @@ run_test() {
259259
cd "$tutorial_path" || return 1
260260

261261

262-
# Run the tests with retry mechanism
263-
local -a pytest_cmd=("uv" "run" "pytest")
262+
# Run the tests with retry mechanism.
263+
#
264+
# pytest is brought in explicitly via --with: the tutorials only list it
265+
# under an optional `dev` extra (which `uv run` does not install), and it
266+
# used to be pulled in transitively by agentex-sdk's runtime deps. Once
267+
# agentex-sdk 0.11.5 dropped pytest as a runtime dep, `uv run pytest` could
268+
# no longer find it ("Failed to spawn: pytest"). Requesting it directly is
269+
# robust across all tutorials regardless of how each declares test deps.
270+
local -a pytest_cmd=("uv" "run" "--with" "pytest" "--with" "pytest-asyncio" "pytest")
264271
if [ "$BUILD_CLI" = true ]; then
265272
local wheel_file
266273
wheel_file=$(ls /home/runner/work/*/*/dist/agentex_sdk-*.whl 2>/dev/null | head -n1)
267274
if [[ -z "$wheel_file" ]]; then
268275
wheel_file=$(ls "${SCRIPT_DIR}/../../dist/agentex_sdk-*.whl" 2>/dev/null | head -n1)
269276
fi
270277
if [[ -n "$wheel_file" ]]; then
271-
pytest_cmd=("uv" "run" "--with" "$wheel_file" "pytest")
278+
pytest_cmd=("uv" "run" "--with" "$wheel_file" "--with" "pytest" "--with" "pytest-asyncio" "pytest")
272279
fi
273280
fi
274281

src/agentex/lib/utils/debug.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
import os
88

9-
import debugpy # type: ignore
10-
119
from agentex.lib.utils.logging import make_logger
1210

1311
logger = make_logger(__name__)
@@ -30,6 +28,13 @@ def setup_debug_if_enabled() -> None:
3028
Any exception from debugpy setup (will bubble up naturally)
3129
"""
3230
if os.getenv("AGENTEX_DEBUG_ENABLED") == "true":
31+
# Imported lazily: debugpy is a development-only tool, so a normal
32+
# worker startup must not require it to be installed. Importing it at
33+
# module scope forced it onto every worker (it used to be satisfied
34+
# transitively via ipykernel; that dep was dropped in agentex-sdk
35+
# 0.11.5, surfacing this as "No module named 'debugpy'").
36+
import debugpy # type: ignore
37+
3338
debug_port = int(os.getenv("AGENTEX_DEBUG_PORT", "5678"))
3439
debug_type = os.getenv("AGENTEX_DEBUG_TYPE", "worker")
3540
wait_for_attach = os.getenv("AGENTEX_DEBUG_WAIT_FOR_ATTACH", "false").lower() == "true"

0 commit comments

Comments
 (0)