Routine Workflow
Production-grade automation for repository hygiene: code reformatting, cache cleaning, backups, dumps orchestration, and security auditing.
routine_workflow is a robust, "batteries-included" Python tool designed to automate the mundane but critical maintenance tasks of your repository. Whether running in a CI pipeline or on a local developer machine, it ensures your project stays clean, secure, and well-formatted with a single command.
⚡ Quick Start (The "5-Minute Rule")
Prerequisites
- Python: 3.9+
- Pip: Latest version recommended
Installation
Install via pip:
pip install routine-workflow
Run
Run the default workflow in Dry-Run Mode (Safe by default):
routine-workflow
To execute the Full Workflow (Real changes):
routine-workflow -nd -y
Demo
Copy-paste this snippet to see it in action (Dry Run):
# 1. Install
pip install routine-workflow
# 2. Run with rich interface (safe mode)
routine-workflow
# 3. View help for more options
routine-workflow --help
✨ Features
🛠️ Core Essentials
- Code Reformatting: Automatically formats code using
ruffandisort. - Cache Cleaning: Wipes
__pycache__,.pytest_cache, and other temporary files. - Backups & Dumps: Orchestrates safe backups and code dumps before changes.
- Git Integration: Auto-commits and pushes a "hygiene snapshot" after success.
🛡️ Security & Quality
- Security Audits: Runs
banditandsafetyto catch vulnerabilities. - Dependency Auditing: Checks for outdated or insecure dependencies.
- Test Integration: Runs
pytestsuite with coverage enforcement.
🚀 Performance & UX
- Parallel Execution: Uses multi-processing for CPU-bound tasks.
- Interactive Mode: Guided wizard (
-i) for easy configuration. - Profiling: Built-in performance profiling (
--profile). - Rich Logging: JSON output, log rotation, and beautiful terminal UI.
🛠️ Configuration
Configure routine-workflow via Environment Variables (for CI/CD) or CLI Arguments (for local use).
Environment Variables
| Variable | Description | Default | Required |
|---|---|---|---|
PROJECT_ROOT |
Root path of the target project. | CWD |
No |
LOG_DIR |
Directory for log files. | /sdcard/tools/logs |
No |
LOCK_DIR |
Directory for the execution lock file. | /tmp/routine_workflow.lock |
No |
FAIL_ON_BACKUP |
Fail the workflow if backup fails (0/1). | 0 (False) |
No |
GIT_PUSH |
Enable git push after hygiene (0/1). | 0 (False) |
No |
ENABLE_SECURITY |
Enable security scanning steps (0/1). | 0 (False) |
No |
LOG_LEVEL |
Logging verbosity (DEBUG, INFO). | INFO |
No |
CLI Arguments
| Flag | Description |
|---|---|
-p, --project-root |
Path to the project root. |
-nd, --no-dry-run |
Execute real changes (Disable dry-run). |
-y, --yes |
Auto-confirm all prompts. |
-s, --steps |
Run specific steps (e.g., -s reformat backup). |
-i, --interactive |
Launch interactive configuration wizard. |
-es, --enable-security |
Enable security scan step. |
-eda, --enable-dep-audit |
Enable dependency audit step. |
--install-pre-commit |
Install as a pre-commit hook. |
🏗️ Architecture
The project follows a modular, step-based architecture designed for extensibility and reliability.
Directory Tree
src/routine_workflow
├── __init__.py
├── banner.py # CLI Art
├── cli.py # Entry Point
├── config.py # Configuration Model
├── runner.py # Workflow Orchestrator
├── lock.py # File-based Locking
├── steps/ # Modular Workflow Steps
│ ├── step1.py # Delete Dumps
│ ├── step2.py # Reformat
│ ├── step3.py # Clean Caches
│ ├── step3_5.py # Security Scan
│ ├── step4.py # Backup
│ ├── step6.py # Git Operations
│ └── ...
└── utils.py # Helpers
Data Flow
- Init: CLI parses args & env vars ->
WorkflowConfig. - Lock: Acquires file lock to prevent concurrent runs.
- Plan:
WorkflowRunnerresolves requested steps/aliases. - Execute: Steps run sequentially (some parallelized internally).
- Report: Results logged to console and JSON log files.
🐞 Troubleshooting
Common Issues
| Error Message | Possible Cause | Solution |
|---|---|---|
LockAcquisitionError |
Another instance is running or stale lock. | Wait or delete lock file at /tmp/routine_workflow.lock. |
CommandNotFoundError |
Missing external tool (e.g., ruff). |
Ensure dev dependencies are installed (pip install .[dev]). |
BackupFailedError |
Disk space or permission issue. | Check LOG_DIR permissions and disk space. |
Debug Mode
To see verbose output for debugging:
routine-workflow --log-level DEBUG
🤝 Contributing
We welcome contributions!
- Fork the repository.
- Install dev dependencies:
pip install -e ".[dev]"
- Run Tests:
pytest
- Submit a Pull Request.
See CONTRIBUTING.md (if available) for detailed guidelines.
🗺️ Roadmap
- Core: CLI, Step Runner, Reformat, Clean, Backup.
- Security: Bandit, Safety, Dependency Audit.
- Advanced: Interactive Mode, Profiling, JSON Logging.
- Upcoming: 3rd Party Plugins, Webhooks (Slack/Discord), AI Refactoring.
See ROADMAP.md for the full vision.
Metadata
Release files for routine-workflow 10.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| routine_workflow-10.0.1.tar.gz | 53.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| routine_workflow-10.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 91.4 kB
Release files / routine_workflow-10.0.1.tar.gz
| Download URL | routine_workflow-10.0.1.tar.gz |
|---|---|
| Size | 53.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0101c16dcfbaa3265bc87ea8f54662864c2e89cb9cc7758fab4173c06c91af28
|
|
BLAKE2b-256 checksum How to use checksums |
47708b124d0b6160d159d6c4546205ca57e3f1920b6d679d624a40f24ac171cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 15, 2025.
Transparency logRelease files / routine_workflow-10.0.1-py3-none-any.whl
| Download URL | routine_workflow-10.0.1-py3-none-any.whl |
|---|---|
| Size | 37.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b855f5cc25b86ddf40ea9d27acc04e6425582c73bff29d3b9c7f7d764a7917e2
|
|
BLAKE2b-256 checksum How to use checksums |
4bdc438cf9f84e1dcd9aaa2d6bbfcd2e8fd550bee85dbd68dffd6b1a9c6bca37
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Dec 15, 2025.
Transparency log