Files
ocp/tools/parity_venv.sh
stroblme 091a2ad0cf Housekeeping ahead of the Inc 1-4 coverage work
- inventory.py --methods: report the instance methods the app calls per class,
  plus chained calls that constrain a return type. --check says which classes
  to bind; this says what to bind on them, which is what writing ~38 module
  TUs needs.
- Drop StlAPI from the inventory: StlAPI_Writer has no app call site (the only
  use was a test fixture, now on the app's own STL writer). 138 symbols / 47
  modules.
- adding-symbols.md: scope the executing-constructor ban to the BRepAlgoAPI
  booleans, which are the only classes with a deferred Set*/Build form —
  BRepMesh_IncrementalMesh, GeomAPI_*, BRepCheck_Analyzer and friends compute
  in their constructor by design and bind as stock. Replace the per-increment
  app-test guidance: backend/tests/conftest.py imports n3xd.main, so no app
  test can collect until the last module is bound. Increments gate on
  stock-recorded fixtures here; the app suite is the Inc 4 gate.
- parity_venv.sh: run the ocp suite in the swapped venv (it imports only
  OCP/n3xd_ocp, so it works throughout).
- Fix a stale macro name in occt_handle.h (ocp_new, not OCP_TRANSIENT_NEW) and
  drop the unused ocp_transient_class helper.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DfriM8XUkn7uYf5Dwe2xo6
2026-08-10 19:23:27 +02:00

61 lines
2.3 KiB
Bash
Executable File

#!/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