|
| 1 | +# fvtk: Claude Code guide |
| 2 | + |
| 3 | +fvtk is a trimmed, fast fork of VTK 9.6.2, maintained by the PyVista community as a |
| 4 | +drop-in graphics layer for [PyVista](https://github.com/pyvista/pyvista). It is public, |
| 5 | +BSD-3 licensed, and developed in the open at `pyvista/fvtk`. Read `README.md` for the |
| 6 | +public story and `CONTRIBUTING.md` for the rules of engagement. |
| 7 | + |
| 8 | +This file is the always-on context for working in this repo. The skills and commands under |
| 9 | +`.claude/` encode the recurring maintenance jobs. |
| 10 | + |
| 11 | +## The prime directive: parity |
| 12 | + |
| 13 | +fvtk is a **bit-exact drop-in for stock VTK 9.6.2 by default** (`maxULP = 0`). Every change |
| 14 | +falls into one of two buckets: |
| 15 | + |
| 16 | +1. **Byte-identical → ships on by default.** Must pass `tests/bitexact/` at `maxULP = 0`, |
| 17 | + including thread-count determinism for anything threaded. |
| 18 | +2. **Correct but reorders output → opt-in behind `fvtk.EnableFast()`.** Relaxed-order parity |
| 19 | + gate plus an engagement check proving the fast path ran. |
| 20 | + |
| 21 | +Positions and values are sacred. Only emission order is ever negotiable. Backported upstream |
| 22 | +bug fixes are the one deliberate exception: they intentionally diverge from stock 9.6.2 to fix |
| 23 | +a real defect, and must be recorded as such. See the `parity-contract` skill before touching |
| 24 | +any filter, kernel, or render path. |
| 25 | + |
| 26 | +## Repo map |
| 27 | + |
| 28 | +- `fvtk-config/`: the build profiles and the trim lists (`_modules_minimal.cmake`, |
| 29 | + `_nowrap_classes.cmake`, `_nocompile_classes.cmake`). See the `module-trimming` skill. |
| 30 | +- `ci/`: build and validation scripts (`build-fvtk.sh` entry, `run-bitexact.sh`, |
| 31 | + `run-renderexact.sh`, `run-regression.sh`, `run-pyvista.sh`, `build-sdk.sh`) and the |
| 32 | + cibuildwheel backend under `ci/cibw/`. |
| 33 | +- `tests/bitexact/`: the byte-exact gate. `tests/renderexact/`: pixel-exact render gate. |
| 34 | + `tests/regression/`: fvtk's own regression scenes. `tests/pyvista/`: the PyVista parity |
| 35 | + suite and its pinned ref (lands with PR #112). |
| 36 | +- `docs/`: `build-internals.md` (the lever set and parity gates, read this first for build |
| 37 | + work), `versioning.md`, `abi3-feasibility.md`, `threading-bitexact.md`, `ci-closers.md`, |
| 38 | + `ci-runners.md`. |
| 39 | +- `tools/`: `pgo-train.py`, `fvtk_shim.py` (the `vtkmodules` → `fvtk` import redirect used by |
| 40 | + every parity harness). |
| 41 | +- The module trees (`Common/`, `Filters/`, `Rendering/`, `IO/`, …) are the forked VTK source. |
| 42 | + |
| 43 | +## Build and validate |
| 44 | + |
| 45 | +The build runs inside `nix-shell` (pinned cmake 4.1.2, Python 3.13, GL/EGL/OSMesa). Entry: |
| 46 | + |
| 47 | +```bash |
| 48 | +./build-fvtk.sh # default profile (minimal), LTO on |
| 49 | +PROFILE=fast ./build-fvtk.sh # fast iteration, LTO off |
| 50 | +``` |
| 51 | + |
| 52 | +Validation gates (also run in CI): |
| 53 | + |
| 54 | +```bash |
| 55 | +ci/run-bitexact.sh # byte-exact vs stock vtk==9.6.2 (maxULP=0) |
| 56 | +ci/run-renderexact.sh # pixel-exact offscreen render (EGL/Mesa) |
| 57 | +ci/run-regression.sh # fvtk's regression scenes |
| 58 | +ci/run-pyvista.sh # PyVista's own suite against the built wheel (PR #112) |
| 59 | +``` |
| 60 | + |
| 61 | +The parity harnesses install stock `vtk==9.6.2` and the fvtk wheel on separate venvs and |
| 62 | +redirect `vtkmodules` → `fvtk` via `tools/fvtk_shim.py`. Never install stock `vtk` into the |
| 63 | +fvtk venv. Details and env vars are in `tests/bitexact/README.md` and the `parity-contract` |
| 64 | +skill. |
| 65 | + |
| 66 | +## Contribution workflow |
| 67 | + |
| 68 | +- Branch from `main`; **never push to `main`**. Every change lands through a pull request. |
| 69 | +- One logical change per PR. Backports are one MR per PR (see the `backport-vtk` skill). |
| 70 | +- State which parity bucket the change is in, with its evidence, in the PR body. |
| 71 | +- CI on `main` is always green. A red branch is the branch's fault; do not wave it off as |
| 72 | + flaky. Run the relevant gate locally before pushing. If main's CI is genuinely failing |
| 73 | + that is an issue that needs to be rectified immediately. |
| 74 | + |
| 75 | +## Commits and PRs |
| 76 | + |
| 77 | +- **Single-line commit messages**, matching the conventional-commit style already in the |
| 78 | + history: `fix(opengl): …`, `perf(SMP): …`, `test(bitexact): …`, `ci: …`, `docs: …`, |
| 79 | + `chore: …`, `build: …`. Pick the scope from the touched area. |
| 80 | +- Never `git add -A` or `git add .`; stage explicit paths by name. |
| 81 | +- Never `--amend` a pushed commit, never use a HEREDOC commit body. |
| 82 | +- **No additional attribution anywhere**: no `Co-Authored-By: Claude`, |
| 83 | + `🤖 Generated with…`, `noreply@anthropic.com`, or `[Claude Code]` in commits, PR bodies, |
| 84 | + PR/issue comments, or release notes. |
| 85 | + |
| 86 | +## Scope discipline |
| 87 | + |
| 88 | +fvtk is a community fork for PyVista, and every public artifact stays framed that way: it |
| 89 | +exists to give PyVista a graphics layer that is tested, fast, and released on a community |
| 90 | +cadence. Keep rationale in commits, PRs, issues, and docs anchored to PyVista and scientific |
| 91 | +visualization. Do not reference, name, or speculate about specific downstream commercial users |
| 92 | +or private infrastructure in anything that lands in this repo or on GitHub. When a motivation |
| 93 | +would only make sense by pointing at a particular downstream consumer, frame it generically |
| 94 | +("for large-scale visualization workloads") instead. When unsure, ask. |
| 95 | + |
| 96 | +## Skills and commands |
| 97 | + |
| 98 | +- `/backport-vtk`: sweep recently merged upstream VTK merge requests, triage the ones that |
| 99 | + matter to fvtk's shipped modules, and land each as its own PR linked back to the MR. |
| 100 | +- `/pyvista-bump`: advance the pinned PyVista ref and triage the parity suite (real |
| 101 | + regression vs image-cache drift). |
| 102 | +- `/fvtk-release`: cut an fvtk release (tag-driven publish to PyPI for the wheel and SDK). |
| 103 | +- `/triage-ci`: diagnose a failing CI run or PR check and propose the fix. |
| 104 | +- `parity-contract` (skill): the bit-exact contract, the gates, and the fast-filter checklist. |
| 105 | +- `module-trimming` (skill): the three trim levers and how to add, remove, or restore classes. |
| 106 | +- `vtk-backport-engineer` (agent): lands a single backport end to end; driven by |
| 107 | + `/backport-vtk`. |
0 commit comments