Home

A tiny, strict DSL for declarative Python object configuration
pfig separates what you build (algorithm) from how you run it (environment). Built for ML workflows.
Install¶
Until the first PyPI release is published, install from the repository:
For a complete walkthrough, see Getting Started.
Quick Example¶
# config.pfig
import torch
from train import Model, Trainer
include "./consts.pfig" as consts
external device
model = Model(hidden_size=@consts/hidden_size)
trainer = Trainer(model=@model, epochs=@consts/epochs, device=@device)
__entrypoint__ = @trainer.fit
Security¶
pfig configs are trusted inputs. Running pfig validate, pfig run, or loading a bundle/replay snapshot can import Python modules, instantiate objects, clone git repositories, and install dependencies. See SECURITY.md.
Key Features¶
- Providers: Lazy recipes with
@name(shared) and@name()(fresh) instances - Includes: Modular configs with
include "./base.pfig" as base - Externals: Runtime environment separation
- Overrides: Config layering with
override base/param = value - Snapshots: Automatic reproducibility tracking with Git state and environment capture
- CLI: Validate, run, diff, fmt, bundle, and replay commands
Formatting¶
pfig fmt rewrites .pfig files to a canonical style. See the CLI reference.
Editor and AI agent support¶
pfig install-rules: Install agent rules for Cursor, Claude Code, or Codex — see CLI reference- LSP server: Diagnostics, go-to-definition, hover, completion, signature help, and semantic tokens — see LSP API
- VS Code: Syntax highlighting via the vscode-pfig extension
Get Started¶
- 👉 Installation & Quick Start - Get up and running in minutes
- Patterns & Best Practices - Structure configs, layer experiments, and reuse recipes
- 📖 Syntax Reference - Complete syntax reference
- 🔧 CLI Reference - Commands for validate, run, diff, fmt, and more
- 📸 Snapshots Guide - Reproducibility and experiment tracking
- 📋 Specification - Complete language specification
Resources¶
- 🔗 Repository - Source code and issue tracking
- 📚 Examples - Working examples and use cases
- 🐛 Issues - Report bugs or request features
- 🤝 Contributing - How to contribute to pfig
pfig: Explicit wiring, zero magic