Setup Locally¶
Clone, install, and run r10n for repeated use or development. This makes all automation features available persistently on your machine.
Prerequisites¶
You need uv installed. If you don't have it:
Verify installation:
Installation¶
Step 1: Clone the Repository¶
Step 2: Install Dependencies¶
This creates a virtual environment and installs all dependencies automatically, including contributor tooling like documentation builders and testing frameworks.
Step 3: Verify Installation¶
You should see:
Usage: r10n [OPTIONS] COMMAND [ARGS]...
r10n - Automate repetitive data and workflow tasks
Options:
--help Show this message and exit.
Commands:
fill-pdfs Fill PDF templates with data
colors Convert CSS colors to oklch() format
contacts Generate VCF contact cards from phone numbers
email Send bulk personalized emails
images Optimize and convert images to WebP
Project Structure¶
After installation, your directory looks like this:
r10n/
├── src/
│ ├── cli.py # Main CLI entry point
│ └── automations/ # Automation modules
├── local/ # Your working directory (gitignored)
│ ├── inputs/ # Place your input files here
│ │ ├── contacts/
│ │ ├── fill-pdfs/
│ │ ├── images/
│ │ └── email/
│ ├── outputs/ # Generated files appear here
│ │ ├── contacts/
│ │ ├── fill-pdfs/
│ │ ├── images/
│ │ └── email/
│ └── configs/ # Configuration files
├── configs/ # Default config templates
├── docs/ # Documentation
└── tests/ # Test suite
Running Automations¶
Interactive Mode¶
Run any command without arguments for step-by-step prompts:
Command Line Mode¶
Pass all options directly for scripting:
uv run r10n contacts \
--input local/inputs/contacts/numbers.txt \
--prefix Customer \
--output local/outputs/contacts/customers.vcf
Setting Up Your Workspace¶
Create the Local Folder Structure¶
mkdir -p local/inputs/contacts
mkdir -p local/inputs/fill-pdfs
mkdir -p local/inputs/images
mkdir -p local/inputs/email
mkdir -p local/outputs/contacts
mkdir -p local/outputs/fill-pdfs
mkdir -p local/outputs/images
mkdir -p local/outputs/email
mkdir -p local/configs
Or run the setup script (if available):
Example: Contacts Workflow¶
- Create your input file:
cat > local/inputs/contacts/numbers.txt << 'EOF'
# Customer phone numbers
0771234567
0781234567
+94791234567
EOF
- Run the automation:
uv run r10n contacts \
--input local/inputs/contacts/numbers.txt \
--prefix Customer \
--output local/outputs/contacts/customers.vcf
- Check the output:
Example: Fill PDFs Workflow¶
-
Place your template PDF in
local/inputs/fill-pdfs/ -
Create your data file:
cat > local/inputs/fill-pdfs/participants.csv << 'EOF'
name,course,date
John Doe,Web Development,2025-01-15
Jane Smith,Data Science,2025-01-15
EOF
- Run the automation:
Example: Images Workflow¶
- Copy images to process:
- Run the optimization:
Configuration Files¶
Some automations support configuration files for default settings.
Email Configuration¶
Create local/configs/email.json:
{
"smtp_server": "smtp.gmail.com",
"smtp_port": 587,
"email": "your-email@gmail.com",
"password": "your-app-password",
"subject": "Your Certificate",
"use_tls": true
}
Images Configuration¶
Create local/configs/images.json:
Note: The current CLI does not load this file directly. This format is provided for programmatic use or future CLI support.
{
"input_directory": "local/inputs/images",
"output_directory": "local/outputs/images",
"prefix": "img",
"max_size_mb": 1.0,
"quality": 85,
"max_width": 1920,
"max_height": 1080,
"convert_to_webp": true,
"preserve_aspect_ratio": true,
"auto_orient": true,
"preserve_filename": false
}
Updating r10n¶
Pull the latest changes:
If you installed via standalone binary, use:
Development Setup¶
If you want to contribute or modify r10n:
Run Tests¶
Run Linting¶
Format Code¶
Pre-commit Hooks¶
The project uses lefthook for git hooks:
# Install lefthook (if not already installed)
brew install lefthook # or: npm install -g lefthook
# Enable hooks
lefthook install
Now tests and linting run automatically before each commit.
Troubleshooting¶
"Command not found: uv"¶
Install uv:
Restart your terminal or run:
"ModuleNotFoundError"¶
Run uv sync to install dependencies:
"Permission denied" on outputs¶
Make sure the output directory exists and is writable:
Tests Failing¶
Run tests with verbose output to see details:
Next Steps¶
- Run on Terminal — For quick one-off tasks without local setup
- Automations — Detailed guides for each automation
- GitHub Issues — Get help or report bugs
- Contribute — Development guidelines