From 0407d194bafb148eaf4947b565c765cf81609cf2 Mon Sep 17 00:00:00 2001 From: ZdenekSrotyr <139972147+ZdenekSrotyr@users.noreply.github.com> Date: Tue, 12 May 2026 19:32:28 +0200 Subject: [PATCH] ci: fix indentation in cli-wheel-clean-install Python heredoc (#273) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The cli-wheel-clean-install lane introduced in v0.53.4 (#272) failed on its first main run with `IndentationError: unexpected indent`: YAML `run: |` preserves the relative indent of the inline `python3 -c` heredoc, so the Python interpreter saw `try:` at column 12 and refused to parse. Fix: write the assertion script to /tmp/smoke.py via a `cat <<'PY'` heredoc (left-aligned content lands flat), mount it into the container, and invoke the tool's venv python directly (`$HOME/.local/share/uv/tools/agnes-the-ai-analyst/bin/python`). Cleaner than the previous inline form and side-steps `uv tool run --from ` doing a PyPI lookup that fails because we don't publish there. Verified locally with the same docker run as the CI step — prints `OK: kbcstorage absent, urllib3 2.7.0`. --- .github/workflows/ci.yml | 51 +++++++++++++++++++++++----------------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab7aa1e..48fe3df 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,29 +55,38 @@ jobs: - name: Build wheel run: uv build --wheel --out-dir dist + - name: Write CLI install assertion script + run: | + cat > /tmp/smoke.py <<'PY' + import sys, urllib3 + try: + import kbcstorage # noqa: F401 + sys.exit("REGRESSION: kbcstorage leaked into the CLI wheel — should be in [server] extra only") + except ImportError: + pass + maj, minor = (int(x) for x in urllib3.__version__.split(".")[:2]) + assert (maj, minor) >= (2, 7), f"urllib3 too old: {urllib3.__version__}" + print(f"OK: kbcstorage absent, urllib3 {urllib3.__version__}") + PY + - name: Smoke install in fresh python:3.13-slim run: | - docker run --rm -v "$PWD/dist:/wheels:ro" python:3.13-slim bash -c ' - set -euo pipefail - apt-get update -qq && apt-get install -y -qq --no-install-recommends curl ca-certificates >/dev/null - curl -LsSf https://astral.sh/uv/install.sh | sh > /dev/null 2>&1 - export PATH="$HOME/.local/bin:$PATH" - WHEEL=$(ls /wheels/agnes_the_ai_analyst-*-py3-none-any.whl | head -1) - uv tool install --force "$WHEEL" - agnes --version - agnes --help > /dev/null - agnes catalog --help > /dev/null - python3 -c " - try: - import kbcstorage - raise SystemExit(\"REGRESSION: kbcstorage leaked into the CLI wheel — should be in [server] extra only\") - except ImportError: - pass - import urllib3 - assert tuple(int(x) for x in urllib3.__version__.split(\".\")[:2]) >= (2, 7), urllib3.__version__ - print(\"OK: kbcstorage absent, urllib3\", urllib3.__version__) - " - ' + docker run --rm \ + -v "$PWD/dist:/wheels:ro" \ + -v /tmp/smoke.py:/smoke.py:ro \ + python:3.13-slim bash -c ' + set -euo pipefail + apt-get update -qq && apt-get install -y -qq --no-install-recommends curl ca-certificates >/dev/null + curl -LsSf https://astral.sh/uv/install.sh | sh > /dev/null 2>&1 + export PATH="$HOME/.local/bin:$PATH" + WHEEL=$(ls /wheels/agnes_the_ai_analyst-*-py3-none-any.whl | head -1) + uv tool install --force "$WHEEL" + agnes --version + agnes --help > /dev/null + agnes catalog --help > /dev/null + # Run the assertion in the same venv uv tool created + "$HOME/.local/share/uv/tools/agnes-the-ai-analyst/bin/python" /smoke.py + ' docker-build: runs-on: ubuntu-latest