Developer & Release Guide¶
This guide covers MolForge's local development loop, clean-room engineering rules, automated CI gates, documentation tooling, and release pipeline.
Local Development Loop¶
# 1. Build the Rust engine extension -> python/pymol/_engine.abi3.so
scripts/build.sh debug # fast debug build (or omit `debug` for release)
# 2. Run Rust unit tests
cargo test -p molforge-core
cargo test -p molforge-scene -p molforge-pathtrace -p molforge-traj
# 3. Run PyMOL's compatibility test suite against MolForge
scripts/pymol-tests.sh tests/api/selecting.py
# 4. Compare behaviour against real PyMOL 3.1 (oracle black-box)
ENGINE=oracle scripts/pymol-tests.sh tests/api/selecting.py
# 5. Run MolForge feature tests
PYTHONPATH=python .venv/bin/python -m pytest tests/molforge
The Mandatory CI Gate (scripts/ci.sh)¶
GitHub CI runs scripts/ci.sh identically across Linux, macOS, and Windows:
scripts/ci.sh # release build + release.py check + cargo test + PyMOL ratchet
scripts/ci.sh --debug # faster loop while iterating
scripts/ci.sh --wheel # also build the wheel and smoke-test in a fresh venv
The final line is machine-readable: CI PASS ratchet=511 ... or CI FAIL step=<name> ....
Clean-Room Protocol¶
MolForge's Python layer (python/pymol/, python/pymol2/, python/chempy/) and all ChimeraX-style features are strictly clean-room (see docs/CLEAN_ROOM.md in the repository root):
- Never read or copy from PyMOL's Python sources, ChimeraX's source code, or PyMOL docstrings.
- Derive PyMOL interface facts solely from
docs/spec/*.tsv,docs/cmd_signatures.tsv,tests/pymol-testing/, and black-box execution via$MOLFORGE_ORACLE_PY. - Every file under
python/pymol/,python/pymol2/, andpython/chempy/must carry the MIT MolForge copyright header:
Verify compliance before committing:
Adding a Feature Package¶
New scientific toolkits live under python/molforge/<feature>/ and integrate with zero edits to shared registries (molforge.features auto-discovers them):
molforge/<feature>/commands.py— exportregister(cmd)usingcmd.extend(checkcmd.keywordfirst so PyMOL 3.1 commands are never shadowed).molforge/<feature>/tools.py— register typed AI/MCP tools with@tool(...)frommolforge.ai.tools; route all state changes throughctx.recso every action stays replayable.- Route all HTTP requests through
molforge.netso caching,MOLFORGE_OFFLINE, and offline test fixtures work automatically.
Documentation & Demo Videos¶
The documentation site is built with MkDocs Material (mkdocs.yml) and deploys to GitHub Pages via .github/workflows/docs.yml.
# Regenerate PyMOL command/settings & 120 AI tool references + llms.txt
python3 scripts/docs-gen.py
# Check that generated docs are up to date (enforced in CI)
python3 scripts/docs-gen.py --check
# Preview locally with live reload (uses uvx — no global install required)
uvx --with mkdocs-material --with pymdown-extensions mkdocs serve
# Strict production build (fails on any broken link or warning)
uvx --with mkdocs-material --with pymdown-extensions mkdocs build --strict
Visual assets:
- Static screenshots & diagrams: regenerate via
scripts/docs-screenshots.sh. - Demo videos: conform to
docs/assets/videos/manifest.json(1280×720H.264 MP4+faststart, no audio, ≤6 MB + PNG poster).
Changelog Fragments & Releasing¶
Changelog Fragments (changelog.d/)¶
Every user-visible change adds a single-line file changelog.d/<slug>.<type>.md (never edit CHANGELOG.md by hand):
| Type | Use For |
|---|---|
breaking |
Breaking changes (bumps minor in 0.x, major ≥ 1.0) |
feature |
New commands, APIs, desktop or AI features |
compat |
Improved PyMOL 3.1 compatibility |
fix |
Bug fixes |
perf |
Measurable speedups (include numbers) |
other |
Packaging, install, notable documentation |
Cutting a Release (docs/RELEASING.md)¶
Never edit version numbers manually—[workspace.package] version in Cargo.toml is the single source of truth, managed exclusively by scripts/release.py:
python3 scripts/release.py status # JSON status, fragments, ratchet, suggested version
python3 scripts/release.py check # validate Cargo.toml, recipe/meta.yaml, fragments
scripts/ci.sh --wheel # full CI gate + wheel smoke test
python3 scripts/release.py prepare --rc # or: prepare / prepare --version X.Y.Z
git push origin main vX.Y.Z # triggers .github/workflows/release.yml
Publishing occurs only when a maintainer pushes a v* tag: GitHub Actions runs full CI, builds abi3 wheels + sdist + cross-platform desktop installers (.dmg, NSIS setup.exe, AppImage), publishes to PyPI via Trusted Publishing (when enabled), and creates the GitHub Release with SHA256SUMS and build provenance attestations.