PYPI PACKAGE AUDIT v0.1.0 Enterprise Healthy

pfig

A tiny, strict DSL for declarative object configuration

PyPkgScore pfig
Methodology & Criteria ♥ Donate
920 / 1000
Quick Install
pip install pfig
1. Governance
200/200
2. PEP Metadata
200/200
3. Security
200/200
4. Docs & SEO
155/200
5. CI Engineering
165/200
📣 Share Audit: Share this report and visual preview in the current language
Advertisement
PYPI TELEMETRY

Downloads & Community Adoption

Last 30 days (without mirrors)
Last 7 days
0
Last 30 days
0
Total (180 days)
0
Metric / Ecosystem Status / Value Source
Downloads (30d / 180d) — PyPI Stats (without mirrors)
Trusted Publishing (PEP 740) ✓ Verified OIDC PyPI Integrity / Sigstore
Django Packages — djangopackages.org
PyTech / PyPkgScore 920 / 1000 PyPkgScore Engine

Health & Engineering Analysis (5 Pillars)

1. Governance & Community200 / 200 ▾
LICENSE✓ 50 pts
SECURITY.md✓ 50 pts
CONTRIBUTING.md✓ 50 pts
CODE_OF_CONDUCT.md✓ 50 pts
2. PEP Metadata & Packaging200 / 200 ▾
Wheel (.whl)✓ 50 pts
pyproject.toml✓ 50 pts
Project URLs✓ 50 pts
Trove Classifiers✓ 50 pts
3. Security & Supply Chain200 / 200 ▾
Zero CVEs (OSV)✓ 60 pts
Trusted Publishing (OIDC)✓ 50 pts
Snyk / Audit Link✓ 40 pts
HTTPS Repository✓ 50 pts
4. Documentation, SEO & Ecosystem155 / 200 ▾
Structured README✓ 60 pts
Read the Docs✓ 50 pts
Django Packages✕ 0 pts
Website / Technical Articles✓ 45 pts
5. Engineering, CI & Quality165 / 200 ▾
Automated Tests✓ 65 pts
GitHub Actions CI✓ 65 pts
CHANGELOG.md✓ 35 pts
Env & Lockfile (uv/rye/poetry/pdm/hatch)✕ 0 pts
Advertisement
README & DOCS

Official Documentation & Usage Guide — pfig

PyPI Metadata v0.1.0
Show full original documentation (English README) ▾

pfig logo

CI Coverage PyPI version License: Apache 2.0

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.

Quick Start

pip install pfig

If the package is not yet on PyPI, install from GitHub:

pip install git+https://github.com/pfig-dev/pfig.git
# 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
pfig run config.pfig --set device=cuda

Security

pfig configs are trusted inputs, not a sandboxed data format. Running pfig validate, pfig run, or loading a bundle/replay snapshot can import Python modules, instantiate objects, clone git repositories, and install dependencies from lock files. Only run configs, bundles, and snapshots from sources you trust.

Core Syntax

Syntax Description
name = value Literal binding
provider = Class(args) Lazy provider recipe
@name Shared instance (memoized)
@name() Fresh instance
@provider.attr[.attr...] Attribute or bound method
include "./file.pfig" as alias Include with namespace
override alias/name = value Override included binding
external name Runtime environment parameter
__entrypoint__ What to execute

Key Features

  • Providers: Lazy recipes with @name (shared) and @name() (fresh) instances
  • Includes: Modular configs with explicit filesystem paths: include "./base.pfig" as base. Copy/vendor shared configs into your project; no Python-package config discovery.
  • Externals: Runtime environment separation
  • Overrides: Config layering with override base/param = value
  • Snapshots: Best-effort reproducibility with config bundles, Git patches, and environment capture
  • CLI: Validate, run, diff, fmt, bundle, replay, view, diff-view, and install-rules

Formatting

pfig fmt rewrites .pfig files to a canonical style — 4-space indent, 100-char lines, black-style magic trailing comma, sorted imports within blank-line groups. Comments are preserved.

pfig fmt config.pfig           # format in place
pfig fmt path/to/configs/      # recurse into a directory
pfig fmt --check config.pfig   # exit non-zero if it would change
pfig fmt --diff config.pfig    # show a unified diff
pfig fmt -                     # read stdin, write stdout

Editor Language Server

The pfig LSP server is included as an optional extra. For VS Code, Neovim, or local editor integration, install it from the pfig repo and run it as a module:

python -m pip install "pfig[lsp] @ git+https://github.com/pfig-dev/pfig.git"
python -m pfig.lsp

For private GitHub installs, configure git and GitHub authentication for https://github.com/ before the first install.

The server supports diagnostics, go-to-definition, hover, completion, signature help, and semantic tokens for provider/value highlighting.

Graph Viewer

The graph visualizer is available as the optional vis extra and can run in a browser:

python -m pip install "pfig[vis]"
pfig view config.pfig --mode reachable
pfig diff-view base.pfig proposed.pfig

It serves a local React viewer backed by the same graph view model used by the language server. Use --mode all to show every binding instead of only bindings reachable from __entrypoint__. In standalone CLI views, clicking a reference zooms to its graph node, opening its file in Overview and revealing the binding if it was folded. Editor-integrated views use source navigation: VS Code's webview or a Neovim --reveal-url callback.

The editable frontend source lives in webview/. The packaged runtime serves the built files from pfig/vis/assets/, so frontend changes should be rebuilt before committing:

cd webview
npm ci
npm run test
npm run build

Documentation

📚 Full Documentation - Complete guide, API reference, and examples

Editor / AI agent support:

  • AI agent rules: Run pfig install-rules <agent> in your project to install rules that teach AI coding agents how to write .pfig files and pfig-friendly Python. Supported targets:
    • cursor — writes .cursor/rules/*.mdc (per-file rules with globs: for conditional loading)
    • claude — writes .claude/rules/*.md (per-file rules with paths: for conditional loading)
    • codex — writes a single concatenated AGENTS.md at the repo root
  • VS Code syntax highlighting: See the vscode-pfig repository for installation instructions.

pfig: Explicit wiring, zero magic

Community

License

pfig is licensed under Apache-2.0. The bundled graph viewer includes components under other licenses; see the third-party notices.

Honorable mentions

pfig originated during work at Ocado Group plc and is now personally maintained. Ocado Group plc is gratefully acknowledged for supporting the open-sourcing of the project.