| examples | Initial version | |
| src/verfix | Initial version | |
| Development.md | Initial version | |
| LICENCE | Initial version | |
| LICENCE.verfix | Initial version | |
| pyproject.toml | Initial version | |
| pyproject.verfix.toml | Initial version | |
| README.md | Initial version | |
| requirements.txt | Initial version | |
| verfix.py | Initial version | |
| verfix.yaml | Initial version | |
Verfix - Version String Management Tool
Verfix is a lightweight Python tool that manages version strings and other variables across your project files using template files. Each file that needs versioning has a corresponding .verfix template, making it clear which files contain version strings while keeping the templates under version control.
Features
- 🔍 Clear identification of files with version strings via
.verfixtemplates - 📝 Templates stay under version control
- 🔗 Variable interpolation using
${var}syntax in YAML - 🎯 Explicit file listing
- 🛡️ Editor-friendly template naming (maintains syntax highlighting)
- ✨ Simple, direct processing of templates to files
Installation
There are several ways to install verfix:
From PyPI (recommended)
pip install verfix
From Source
# Clone the repository
git clone https://codeberg.org/threadpanic/verfix.git
cd verfix
# Install in development mode
pip install -e .
# Or install directly from repo
pip install git+https://codeberg.org/threadpanic/verfix.git
Dependencies Only (run from source)
pip install -r requirements.txt
./src/verfix/main.py
Usage
As Command Line Tool
After installation with pip:
# Using default verfix.yaml
verfix
# Using custom config file
verfix custom-config.yaml
When running from source:
./src/verfix/main.py
# or
python -m verfix.main
As a Python Library
from verfix import VersionFixer
# Using default verfix.yaml
fixer = VersionFixer()
fixer.run()
# Using custom config
fixer = VersionFixer("custom-config.yaml")
fixer.run()
# Access variables after loading
fixer.load_config()
print(fixer.variables["version"])
# Process single file
fixer.process_file("path/to/file.txt")
Configuration
Create a verfix.yaml configuration file:
variables:version:0.1.2fullversion:${version}-betafiles:- Cargo.toml- src/main.rsTemplate Files
Create .verfix template files (note: .verfix goes before the extension):
# Cargo.verfix.toml
[package]
name = "myapp"
version = "^(version)^"
edition = "2021"
// src/main.verfix.rs
fn main(){println!("MyApp version ^(version)^ starting up...");}Project Structure Example
myproject/
├── verfix.yaml
├── Cargo.toml # Generated from template
├── Cargo.verfix.toml # Template with ^(version)^
├── src/
│ ├── main.rs # Generated from template
│ ├── main.verfix.rs # Template with ^(version)^
│ └── lib.rs # No versioning needed
Template Naming Convention
To maintain proper syntax highlighting in editors:
main.rs→main.verfix.rsCargo.toml→Cargo.verfix.tomlversion.py→version.verfix.pyREADME.md→README.verfix.md
For files without extensions:
README→README.verfixVERSION→VERSION.verfix
Variable Interpolation
Templates use ^(variable)^ syntax:
constVERSION: &str ="^(version)^";constFULL_VERSION: &str ="^(fullversion)^";YAML config supports variable references:
variables:major:2minor:0patch:5version:${major}.${minor}.${patch}fullversion:${version}-betaCommon Use Cases
- Rust Projects
variables:version:0.1.2files:- Cargo.toml- src/main.rs- Python Packages
variables:version:1.0.0files:- setup.py- src/myapp/__init__.py- Node.js Projects
variables:version:2.1.0files:- package.json- src/version.tsDevelopment
Want to contribute? Here's how to set up for development:
# Clone the repository
git clone https://codeberg.org/threadpanic/verfix.git
cd verfix
# Create a virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install in development mode
pip install -e .
Notes
- Run verfix from the directory containing your verfix.yaml file
- Each file listed in verfix.yaml must have a corresponding .verfix template
- Original files are overwritten with processed content
- Templates stay under version control showing where version strings appear
- Template files now use
.verfixbefore the extension for better IDE support - Missing templates will cause an error
License
MIT No Attribution License (MIT-0)
For more information or to contribute, please visit verfix on Codeberg.