Overview
Themkroot command discovers all ConfigFile subclasses across the project and its dependencies, then validates each one to create or update configuration files. It generates the complete project structure including pyproject.toml, .gitignore, GitHub workflows, pre-commit hooks, and other configuration files.
What It Does
The command:- Discovers all
ConfigFilesubclasses in your project and its dependencies - Validates each config file (triggering generation via
dump()) - Creates or updates configuration files on disk
- Respects opt-out markers - won’t overwrite files marked for manual management
- Ensures directory structure - creates parent directories as needed
The command is idempotent: safe to run multiple times. It overwrites incorrect files but respects opt-out markers.
Usage
Basic Usage
After Modifying Config Classes
With Verbose Output
Quiet Mode
Generated Files
The command generates comprehensive project configuration:Python Configuration
pyproject.toml- Project metadata, dependencies, tool configs.python-version- Python version specificationuv.lock- Locked dependencies
Version Control
.gitignore- Git ignore patterns.gitattributes- Git file attributes
Code Quality
.pre-commit-config.yaml- Pre-commit hook configurationruff.toml- Ruff linter/formatter settings.bandit- Security scanner configuration
CI/CD
.github/workflows/health_check.yml- CI workflow.github/workflows/release.yml- CD workflow.github/CODEOWNERS- Code review assignments
Repository Management
.github/ISSUE_TEMPLATE/- Issue templates.github/PULL_REQUEST_TEMPLATE.md- PR templatebranch-protection.json- Branch protection rules
Development
.scratch- Temporary code execution fileLICENSE- Project licenseREADME.md- Project documentation
Expected Output
Behavior
Automatically finds all
ConfigFile subclasses across the entire dependency chain, from pyrig through your project.Each config file is validated, which triggers content generation and writing to disk.
- Overwrites files with incorrect content
- Respects opt-out markers (files marked for manual management)
- Preserves manual customizations in marked sections
Safe to run multiple times. Running again produces the same result unless configs changed.
When to Use
Use mkroot When:
- You’ve modified a
ConfigFilesubclass and want to apply changes - You’ve added a new
ConfigFilesubclass - You want to ensure all configs are up-to-date
- You’re updating from a new version of pyrig
- Configuration files were accidentally deleted or corrupted
Example Workflow
Opt-Out Markers
To preventmkroot from overwriting a file, add an opt-out marker:
Config File Discovery
The command discovers configs across your entire dependency chain:Related Commands
- init - Full project initialization (includes
mkroot) - build - Build artifacts using
BuilderConfigFilesubclasses
Implementation
Themkroot command calls ConfigFile.validate_all_subclasses(), which discovers and validates all config file subclasses. See pyrig/rig/cli/commands/create_root.py:10.
Run
uv run pyrig mkroot --help to see the command’s built-in help text.