Skip to content

fix(evaluation): Support direct run_evaluation script execution#415

Open
Gujiassh wants to merge 1 commit into
bytedance:mainfrom
Gujiassh:fix/evaluation-script-entrypoint-20260522
Open

fix(evaluation): Support direct run_evaluation script execution#415
Gujiassh wants to merge 1 commit into
bytedance:mainfrom
Gujiassh:fix/evaluation-script-entrypoint-20260522

Conversation

@Gujiassh
Copy link
Copy Markdown

Description

The evaluation README tells users to run python run_evaluation.py from the evaluation directory, but run_evaluation.py only used a package-relative import. Direct script execution therefore failed before argument parsing with ImportError: attempted relative import with no known parent package.

This PR keeps the package import path for python -m evaluation.run_evaluation and adds a direct-script import path for the documented python run_evaluation.py invocation.

More Information

  • Adds a small __package__ check at the top of evaluation/run_evaluation.py.
  • When executed directly, the repository root is added to sys.path and evaluation.utils is imported by absolute package name.
  • Package/module execution continues to use the existing relative import.
  • Adds a regression test that loads the script with runpy.run_path and stubs optional heavy evaluation dependencies.

Validation

uv sync --extra test --extra evaluation
uv run pytest tests/test_evaluation_entrypoint.py
uv run pytest tests/test_evaluation_entrypoint.py tests/test_cli.py
uv run ruff check evaluation/run_evaluation.py tests/test_evaluation_entrypoint.py
uv run python -m py_compile evaluation/run_evaluation.py tests/test_evaluation_entrypoint.py
git diff --check

Linked Issues

Fixes #371

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.

[Bug]: Bug of Evaluation for Trae Agent.

1 participant