From 375d1c62b1c2d5bef43e77521427cba28e485f78 Mon Sep 17 00:00:00 2001 From: Pigbibi <20649888+Pigbibi@users.noreply.github.com> Date: Wed, 5 Aug 2026 13:39:07 +0800 Subject: [PATCH] fix(packaging): preserve src wheel import contract Co-Authored-By: Codex --- .github/workflows/ci.yml | 26 ++++++++++++++++++++++++++ pyproject.toml | 6 +++--- 2 files changed, 29 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d6cb0ae..392834d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,6 +36,32 @@ jobs: set -euo pipefail python -m pip check + - name: Verify clean wheel package contract + run: | + set -euo pipefail + TMP_DIR="$(mktemp -d)" + trap 'rm -rf "$TMP_DIR"' EXIT + python -m pip wheel --no-deps --wheel-dir "$TMP_DIR/dist" . + python -m venv --system-site-packages "$TMP_DIR/venv" + ( + cd "$TMP_DIR" + unset PYTHONPATH + "$TMP_DIR/venv/bin/python" -m pip install "$TMP_DIR/dist"/*.whl + "$TMP_DIR/venv/bin/python" - <<'PY' + import importlib + from pathlib import Path + + package_root = Path(importlib.import_module("src").__file__).parent + required = [ + package_root / "__init__.py", + package_root / "backtest.py", + package_root / "strategy_lifecycle" / "orchestrator_runner.py", + ] + assert all(path.is_file() for path in required), required + importlib.import_module("src.strategy_lifecycle.orchestrator_runner") + PY + ) + - name: Run ruff run: | set -euo pipefail diff --git a/pyproject.toml b/pyproject.toml index cb4a3d9..d99b0b8 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,8 +27,8 @@ dependencies = [ test = ["pytest>=8"] [tool.setuptools] -package-dir = {"" = "src"} +package-dir = {"" = "."} [tool.setuptools.packages.find] -where = ["src"] - +where = ["."] +include = ["src", "src.*"]