Automated routine workflow runner for repository hygiene, backups, and dumps orchestration and much more.
Project description
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file routine_workflow-10.0.1.tar.gz.
File metadata
- Download URL: routine_workflow-10.0.1.tar.gz
- Upload date:
- Size: 53.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0101c16dcfbaa3265bc87ea8f54662864c2e89cb9cc7758fab4173c06c91af28
|
|
| MD5 |
110d2245cc985feb20ef65fdb9d86749
|
|
| BLAKE2b-256 |
47708b124d0b6160d159d6c4546205ca57e3f1920b6d679d624a40f24ac171cb
|
Provenance
The following attestation bundles were made for routine_workflow-10.0.1.tar.gz:
Publisher:
publish.yml on dhruv13x/routine-workflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
routine_workflow-10.0.1.tar.gz -
Subject digest:
0101c16dcfbaa3265bc87ea8f54662864c2e89cb9cc7758fab4173c06c91af28 - Sigstore transparency entry: 764296421
- Sigstore integration time:
-
Permalink:
dhruv13x/routine-workflow@8ec3b7a1b057c6cae80ae633cdd66b6bcc773a86 -
Branch / Tag:
refs/tags/v10.0.1 - Owner: https://github.com/dhruv13x
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8ec3b7a1b057c6cae80ae633cdd66b6bcc773a86 -
Trigger Event:
push
-
Statement type:
File details
Details for the file routine_workflow-10.0.1-py3-none-any.whl.
File metadata
- Download URL: routine_workflow-10.0.1-py3-none-any.whl
- Upload date:
- Size: 37.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b855f5cc25b86ddf40ea9d27acc04e6425582c73bff29d3b9c7f7d764a7917e2
|
|
| MD5 |
0a0ee9ed34f156200b3ab6912e4d5724
|
|
| BLAKE2b-256 |
4bdc438cf9f84e1dcd9aaa2d6bbfcd2e8fd550bee85dbd68dffd6b1a9c6bca37
|
Provenance
The following attestation bundles were made for routine_workflow-10.0.1-py3-none-any.whl:
Publisher:
publish.yml on dhruv13x/routine-workflow
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
routine_workflow-10.0.1-py3-none-any.whl -
Subject digest:
b855f5cc25b86ddf40ea9d27acc04e6425582c73bff29d3b9c7f7d764a7917e2 - Sigstore transparency entry: 764296425
- Sigstore integration time:
-
Permalink:
dhruv13x/routine-workflow@8ec3b7a1b057c6cae80ae633cdd66b6bcc773a86 -
Branch / Tag:
refs/tags/v10.0.1 - Owner: https://github.com/dhruv13x
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@8ec3b7a1b057c6cae80ae633cdd66b6bcc773a86 -
Trigger Event:
push
-
Statement type: