#!/usr/bin/env bash # Set up a side environment where the app runs against n3xd-ocp instead of the # stock wheel. # # The app's manifests are never touched: a swap is per-environment because both # distributions own the OCP/ import path and a process can hold only one OCCT # build. main therefore keeps resolving cadquery-ocp-novtk until the Phase 10C # cutover, and this venv is how parity is proven in the meantime. # # tools/parity_venv.sh install from the Gitea registry # tools/parity_venv.sh --local install the local wheelhouse build # # Then run whichever slice of the app suite the current increment claims: # cd ../app && UV_PROJECT_ENVIRONMENT=.venv-ocp-parity uv run pytest backend/tests/test_geom_memo.py set -euo pipefail HERE=$(cd "$(dirname "$0")" && pwd) OCP_REPO=$(dirname "$HERE") APP="${APP_DIR:-$(dirname "$OCP_REPO")/app}" VENV_NAME="${VENV_NAME:-.venv-ocp-parity}" INDEX="https://git.stroblme.de/api/packages/N3XD/pypi/simple/" SOURCE="registry" [ "${1:-}" = "--local" ] && SOURCE="local" cd "$APP" export UV_PROJECT_ENVIRONMENT="$VENV_NAME" echo "--- syncing the app's dependencies into $VENV_NAME ---" uv sync --all-groups # Removal must precede installation: both distributions install a top-level # OCP/, so installing over the stock wheel would leave a half-overwritten mix. echo "--- removing the stock wheel ---" uv pip uninstall cadquery-ocp-novtk || true echo "--- installing n3xd-ocp ($SOURCE) ---" if [ "$SOURCE" = "local" ]; then uv pip install "$OCP_REPO"/wheelhouse/*.whl else uv pip install --index-url "$INDEX" --prerelease=allow n3xd-ocp fi echo "--- sanity ---" uv run python -c " import OCP print('OCP', OCP.__version__, '/ OCCT', OCP.__occt_version__) print('modules:', len(OCP._OCP.__all_modules__)) " echo "--- coverage against the app's symbol inventory ---" uv run python "$HERE/inventory.py" --check || \ echo "(incomplete coverage is expected until the increments land)" # The binding's own suite, run from the swapped venv: this is what exercises the # published artifact inside the app's exact dependency set. It imports only # OCP/n3xd_ocp, so it works long before the app's own tests can collect (their # conftest imports n3xd.main, i.e. the whole OCP surface). echo "--- ocp suite under the swapped venv ---" uv run pytest "$OCP_REPO/tests" -q