Skip to content

fix(tools): add skill script dir to sys.path#5885

Closed
he-yufeng wants to merge 1 commit into
google:mainfrom
he-yufeng:fix/skill-script-sys-path
Closed

fix(tools): add skill script dir to sys.path#5885
he-yufeng wants to merge 1 commit into
google:mainfrom
he-yufeng:fix/skill-script-sys-path

Conversation

@he-yufeng

Copy link
Copy Markdown
Contributor

Summary

  • add the executed Python skill script directory to sys.path before runpy.run_path
  • preserve the existing skill-root working directory, so references/assets still resolve from the skill root
  • add a real executor regression test for importing a sibling helper module from scripts/

Fixes #5882.

To verify

  • git diff --check
  • python -m py_compile src/google/adk/tools/skill_toolset.py tests/unittests/tools/test_skill_toolset.py
  • python -m ruff check src/google/adk/tools/skill_toolset.py tests/unittests/tools/test_skill_toolset.py
  • python -m pyink --check src/google/adk/tools/skill_toolset.py tests/unittests/tools/test_skill_toolset.py
  • PYTHONPATH=src python -m pytest tests/unittests/tools/test_skill_toolset.py::test_execute_script_python_success tests/unittests/tools/test_skill_toolset.py::test_integration_python_imports_sibling_script_module tests/unittests/tools/test_skill_toolset.py::test_integration_python_stdout tests/unittests/tools/test_skill_toolset.py::test_integration_python_sys_exit_zero -q
  • PYTHONPATH=src python -m pytest tests/unittests/tools/test_skill_toolset.py -k "not shell" -q

I also ran the full tests/unittests/tools/test_skill_toolset.py file on Windows. The Python tests passed, but three existing shell integration tests fail because this Windows environment does not have bash on PATH.

@adk-bot adk-bot added the tools [Component] This issue is related to tools label May 28, 2026
@rohityan rohityan self-assigned this May 28, 2026
@rohityan

Copy link
Copy Markdown
Collaborator

Hi @he-yufeng , Thank you for your contribution! We appreciate you taking the time to submit this pull request. Please fix formatting errors by running autoformat.sh

@rohityan rohityan added the request clarification [Status] The maintainer need clarification or more information from the author label May 28, 2026
@he-yufeng he-yufeng force-pushed the fix/skill-script-sys-path branch from 7164881 to 237c4e1 Compare May 28, 2026 19:01
@boyangsvl

Copy link
Copy Markdown
Collaborator

I have merged in commit 9296198

@boyangsvl boyangsvl closed this May 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

request clarification [Status] The maintainer need clarification or more information from the author tools [Component] This issue is related to tools

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add scripts/ directory to sys.path when executing Python skill scripts

4 participants