Config Files
Every managed file in a pyrig project is backed by a ConfigFile subclass that
declares what the file must contain. pyrig sync validates all of them —
creating missing files, merging in absent required content, and leaving
everything else untouched.
Implementing a New Config File
Subclass one of the format-specific bases and implement the required members:
| Member | Purpose |
|---|---|
parent_path() |
Directory where the file lives |
stem() |
Filename without extension |
extension() |
Extension without the leading dot |
_configs() |
Minimum required content (dict or list) |
_load() |
Parse the file from disk |
_dump(configs) |
Write configuration to disk |
Format-specific bases already implement _load() and _dump()
and other methods for you and possibly define other abstract members to implement.
Some examples are:
TOMLConfigFile— TOML filesYMLDictConfigFile— YAML filesMarkdownConfigFile— Markdown filesPythonConfigFile— Python source files
Place the class anywhere under <your_package>.rig.configs and it will be
discovered and validated automatically by pyrig sync — no registration needed.
Optional Overrides
priority()— Validation order. Higher values run first. UsePriority.increase()/Priority.decrease()relative to another file's priority, or return anyintorfloat.version_control_ignored()— Set toTruefor files that should not be committed (e.g..env). These are also validated bypyrig mk local.
Overriding an Existing Config File
Run pyrig mk subcls, search for the class you want to change, and select it.
A correctly placed subclass skeleton is generated for you. Override whichever
methods need changing — the rest of the behaviour is inherited.
Disabling Validation for a File
Override validate() to do nothing. The file will no longer be created or
updated by pyrig sync.