- Python 82.2%
- Shell 17.8%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
| .vscode | ||
| patches | ||
| settings-reports | ||
| .gitignore | ||
| apply_config_customizations.py | ||
| customizations.yaml | ||
| example.json | ||
| example.yaml | ||
| README.md | ||
| rebase_and_reapply.sh | ||
Marlin Config Customizer
This folder is intentionally self-contained so it can be moved into a separate repository later.
Files
apply_config_customizations.py: generic rule engine that edits Marlin config files.customizations.yaml: your printer-specific customization map.
Why this structure
- Marlin release updates often shuffle comments and sections.
- Reapplying a fixed list of symbol edits is faster and safer than manual merge edits.
- Warnings help catch upstream renames or removed symbols.
Map format
Top-level keys are file paths relative to repo root. Each key contains a list of rules.
Optional top-level metadata keys:
boardor_meta.board: board path underConfigurations/config/examples, for exampleCreality/Ender-3 Pro/BigTreeTech SKR Mini E3 2.0.environmentor_meta.environment: PlatformIO environment for the final build hint.
Rule fields:
symbol(required): C preprocessor define symbol.action(required):enable,disable, orset.value(required forset): replacement value right side of define.note(optional): rationale shown in verbose mode.
Reference Config Copy
You can copy a board reference config from the Marlin Configurations repository before applying custom rules.
- Default Configurations repo path is
../Configurationsrelative to this script. - Default Marlin target repo path remains
../Marlin. - Files copied to the target Marlin tree:
Marlin/Configuration.h,Marlin/Configuration_adv.h,Marlin/_Bootscreen.h,Marlin/_Statusscreen.h.
Set board in your map file (board or _meta.board) and run:
python3 apply_config_customizations.py --copy-reference-config --dry-run
python3 apply_config_customizations.py --copy-reference-config
When --copy-reference-config --dry-run is used, the script automatically prints a unified diff between your current Marlin files and the selected board reference files.
Or override board and paths from CLI:
python3 apply_config_customizations.py \
--copy-reference-config \
--board "Creality/Ender-3 Pro/BigTreeTech SKR Mini E3 2.0" \
--config-repo-root ../Configurations \
--repo-root ../Marlin \
--dry-run
Usage
Run from this customizer repository root:
python3 apply_config_customizations.py --dry-run
python3 apply_config_customizations.py
To reset local changes and align sources before re-applying customizations:
- Marlin: checkout latest stable release tag (no beta/rc/alpha/dev).
- Verify the tag matches
SHORT_BUILD_VERSIONinMarlin/Version.h(fail if mismatch). - Configurations: if the same tag exists, checkout that tag.
- If Configurations lacks that tag, fallback to a matching release/bugfix branch and print a warning.
./rebase_and_reapply.sh
Normal mode applies customizations directly after source alignment (no automatic pre-dry-run step).
To only preview the re-apply step after source alignment:
./rebase_and_reapply.sh --dry-run
By default, --repo-root points to ../Marlin relative to this script.
By default the script is verbose. Use quiet mode when scripting:
python3 apply_config_customizations.py --dry-run --quiet
Strict mode (exit non-zero on warnings):
python3 apply_config_customizations.py --dry-run --strict
Colored output
The script emits colored output when run in a TTY terminal.
Set NO_COLOR=1 to disable colors.
Use JSON instead of YAML if preferred:
python3 apply_config_customizations.py \
--map-file example.json --dry-run
The customizer prints a final build hint plus EEPROM/config reset reminders after it finishes.
YAML dependency
YAML parsing requires PyYAML:
pip install pyyaml
If you do not want dependencies, use a .json map file via --map-file.
Safety notes
- Always run
--dry-runfirst on a new Marlin release. - Treat warnings as required manual review.
- Do not assume all edits apply cleanly across major version jumps.