Repository navigation
Variables Substitution System
Overview
Introduces a variable substitution system for the configuration, along with project infrastructure improvements and bug fixes.
✨ Feature: Config Variable Substitution
The configuration system now supports flexible variable substitution, making configs more reusable and maintainable.
Supported Syntax
-
Environment Variables -
%ENV_VAR%- Use OS environment variables in any path or value
- Expanded at config load time
variables: user_home: '%USERPROFILE%' entries: my_entry: target: '%USER_HOME%\Downloads\file.exe'
-
Config Variables -
{{variable_name}}- Define custom variables in the
variables:section - Reference them anywhere in entries
variables: games_dir: 'D:\Games' gw2_dir: '{{games_dir}}\GW2' entries: my_entry: target: '{{gw2_dir}}\bin64'
- Define custom variables in the
-
Chained Variable References
- Variables can reference other variables defined earlier
- Processed in order, enabling powerful composition
variables: base_dir: 'D:\Games' gw2_dir: '{{base_dir}}\GW2' # References base_dir tools_dir: '{{gw2_dir}}\tools' # References gw2_dir
-
Per-Entry Variables
- Each entry can define its own variables
- Entry-specific variables override global ones
variables: drive_root: 'D:\' # Global default entries: my_entry: variables: drive_root: 'C:\' # Override for this entry only target: '{{drive_root}}\file.exe'
🔧 Infrastructure Improvements
- Project Structure: Migrated to src layout for better packaging
- Pre-commit Hooks: Added comprehensive pre-commit configuration with:
- Code quality checks (ruff)
- Formatting (ruff-format)
- YAML validation
- TODO tracking
- Development Tools: Added pytest-asyncio, ruff, rust-just
🐛 Bug Fixes
- Fixed: Infinite recursion in config validation
- Previously, accessing
config.entriestriggered Dynaconf setup - Now reads YAML directly to avoid validation loops
- Previously, accessing
New Dependencies
pytest-asyncioruffpre-commitpre-commit-uvrust-just
Migration Guide
Updating Existing Configs
If you have existing configs, they will continue to work. However, you can now leverage the new variable system:
Before:
entries:
d912pxy:
target: 'D:\Games\GW2\_tools\d912pxy.zip'
unzip_target: 'D:\Games\GW2'After (with variables):
variables:
games_dir: 'D:\Games'
gw2_dir: '{{games_dir}}\GW2'
tools_dir: '{{gw2_dir}}\_tools'
entries:
d912pxy:
target: '{{tools_dir}}\d912pxy.zip'
unzip_target: '{{gw2_dir}}'Breaking Changes
- Python 3.14 Required: The project now requires Python 3.14
- Removed:
.python-versionfile (use pyproject.toml instead)