Download testing/agent_evaluation/environment/sync-python-env.sh from yuhanqin/ut-evaluation: direct link, hf CLI and curl.
- Browser
- Download file 2.11 kB
-
https://huggingface.co/datasets/yuhanqin/ut-evaluation/resolve/main/testing/agent_evaluation/environment/sync-python-env.sh
- Command line
-
hf download hf://datasets/yuhanqin/ut-evaluation/testing/agent_evaluation/environment/sync-python-env.sh
-
curl -L -o sync-python-env.sh https://huggingface.co/datasets/yuhanqin/ut-evaluation/resolve/main/testing/agent_evaluation/environment/sync-python-env.sh
2.11 kB
| set -euo pipefail | |
| ENV_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | |
| WORKSPACE_ROOT="$(cd "$ENV_DIR/../../.." && pwd)" | |
| RUNTIME_DIR="${RUNTIME_DIR:-$WORKSPACE_ROOT/package}" | |
| VENV="${VENV:-$RUNTIME_DIR/.venv}" | |
| # The evaluation-specific eval-events projection and native OTLP export are | |
| # maintained in the project's fork. Keep the dependency pinned to an | |
| # immutable commit so a rebuilt environment is reproducible. | |
| ADAPTER_REPO="${ADAPTER_REPO:-https://github.com/PiyiHan/coding-harness-tracing.git}" | |
| ADAPTER_REV="${ADAPTER_REV:-5e89472683de3f2a2a7cfe5e12543462f4939a82}" | |
| ADAPTER_SOURCE="${ADAPTER_SOURCE:-$RUNTIME_DIR/coding-harness-tracing}" | |
| command -v uv >/dev/null 2>&1 || { | |
| echo "uv is required: https://docs.astral.sh/uv/getting-started/installation/" >&2 | |
| exit 2 | |
| } | |
| command -v git >/dev/null 2>&1 || { | |
| echo "git is required to install coding-harness-tracing" >&2 | |
| exit 2 | |
| } | |
| mkdir -p "$RUNTIME_DIR" | |
| UV_PROJECT_ENVIRONMENT="$VENV" uv sync \ | |
| --project "$ENV_DIR" \ | |
| --locked \ | |
| --python 3.12 | |
| if [[ ! -d "$ADAPTER_SOURCE/.git" ]]; then | |
| git clone "$ADAPTER_REPO" "$ADAPTER_SOURCE" | |
| fi | |
| current_rev="$(git --git-dir="$ADAPTER_SOURCE/.git" --work-tree="$ADAPTER_SOURCE" rev-parse HEAD)" | |
| if [[ "$current_rev" != "$ADAPTER_REV" ]]; then | |
| if ! git --git-dir="$ADAPTER_SOURCE/.git" --work-tree="$ADAPTER_SOURCE" diff-index --quiet HEAD --; then | |
| echo "Adapter checkout has local changes and cannot switch revisions: $ADAPTER_SOURCE" >&2 | |
| exit 2 | |
| fi | |
| git --git-dir="$ADAPTER_SOURCE/.git" --work-tree="$ADAPTER_SOURCE" \ | |
| fetch "$ADAPTER_REPO" "$ADAPTER_REV" | |
| git --git-dir="$ADAPTER_SOURCE/.git" --work-tree="$ADAPTER_SOURCE" \ | |
| checkout --detach "$ADAPTER_REV" | |
| fi | |
| # The upstream wheel at this revision omits the OpenCode TypeScript plugin. | |
| # Editable installation keeps that non-Python runtime asset available. | |
| uv pip install \ | |
| --python "$VENV/bin/python" \ | |
| --no-deps \ | |
| --editable "$ADAPTER_SOURCE" | |
| "$VENV/bin/python" -c \ | |
| 'import sqlite3, jsonschema, yaml, openai; print(f"Native SQLite {sqlite3.sqlite_version}")' | |
| echo "Python environment ready: $VENV" | |