Development Setup¶
This guide covers setting up your development environment for contributing to pfig.
Prerequisites¶
- Python 3.10+
- Node.js and npm, for graph viewer frontend changes
- Basic understanding of Python imports and class instantiation
- Familiarity with compiler/interpreter concepts (helpful but not required)
Installation¶
-
Clone the repository:
-
Install the package in editable mode:
This installs pfig in development mode with development dependencies, so changes to the source code are immediately available without reinstalling.
-
Verify installation:
-
Run type checking directly when needed:
Pyright is included in the dev extra and enforced by CI through pre-commit. The
pre-commit hook uses language: system, so run it from an environment where
pyright is on PATH (for example, an activated virtual environment after
installing .[dev,remote,lsp]).
Graph viewer frontend setup¶
The graph viewer frontend source lives in webview/. Its production build is
checked in under pfig/vis/assets/ so installed Python packages can serve the
viewer without requiring Node.js.
Install frontend dependencies from the lockfile when working on graph UI code:
After editing files in webview/src/, run:
Commit both the source changes in webview/ and the rebuilt output in
pfig/vis/assets/. Do not commit webview/node_modules/.
Building documentation locally¶
pip install -e ".[docs]"
mkdocs serve # Live preview
mkdocs build --strict # Check links, API rendering, and site generation
The docs extra keeps pymdown-extensions below 12 because its changed
highlighting API is not yet compatible with the mkdocstrings renderer.
Publishing documentation¶
Documentation is built with MkDocs and deployed to pfig.dev via Cloudflare Pages on pushes to main.
- In Cloudflare, use the Pages project named
pfigwithmainas its production branch andpfig.devattached as a custom domain. Reuse the existing project if present. If it was connected to GitHub, disable automatic Git deployments so Wrangler is the only publisher. - Under Settings → Secrets and variables → Actions in
pfig-dev/pfig, add: CLOUDFLARE_API_TOKEN— a scoped token with Account → Cloudflare Pages → Edit for the account that owns the projectCLOUDFLARE_ACCOUNT_ID— account ID from the Cloudflare dashboard- Merge to
mainor manually run Deploy docs onmain. The workflow builds withmkdocs build --strictand uploadssite/with Wrangler. Verify the production deployment in Cloudflare and atpfig.dev.
Next Steps¶
- Read the Architecture guide to understand pfig internals
- Check out the Development Workflow for how to work on pfig
- See Contributing for contribution guidelines