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
Prerequisites
- Python 3.9+
pip
Installation
Install from PyPI with a single command:
pip install routine-workflow
Tip For an enhanced CLI experience with rich formatting and colors, install with the
richextra:pip install "routine-workflow[rich]"
Usage Example
Run the default workflow in safe mode (Dry-Run):
routine-workflow
Execute the full workflow (Real Run):
routine-workflow -nd -y
Run specific steps using Aliases:
routine-workflow -s reformat clean backup -nd
โจ Key Features
- ๐ก๏ธ Safe by Default: Ships with
dry-runenabled to prevent accidental changes. - ๐ง Interactive Mode: Guided wizard to configure steps and options on the fly.
- โ๏ธ Extensible Step Runner: Run steps in any order, repeat them, or run a custom selection.
- ๐งฉ Alias-Driven: Use intuitive aliases like
reformat,clean,pytest, oraudit. - โก Parallel Execution: Utilizes multi-core processing for supported tasks to save time.
- โ
Integrated Testing: Run your
pytestsuite as part of the hygiene workflow. - ๐ Concurrency Safe: Robust file-based locking prevents multiple instances from stepping on each other.
- ๐ Security & Auditing: God Level integration of security scans (
bandit,safety) and dependency auditing. - ๐ Performance Profiling: Built-in
--profilemode to analyze step execution times. - ๐ช Pre-commit Ready: Easily install as a pre-commit hook with
--install-pre-commit. - ๐ Advanced Logging: JSON output, log rotation, and configurable verbosity levels.
- โ๏ธ Git Integration: Automatically commit and push a hygiene snapshot after a successful run.
โ๏ธ Configuration & Advanced Usage
Environment Variables
You can configure defaults via environment variables or a .env file (if supported by your environment loader).
| Variable | Description | Default |
|---|---|---|
PROJECT_ROOT |
Root directory of the project. | CWD |
LOG_DIR |
Directory for log files. | /sdcard/tools/logs |
LOCK_DIR |
Directory for the lock file. | /tmp/routine_workflow.lock |
LOCK_TTL |
Lock time-to-live in seconds. | 3600 |
WORKFLOW_TIMEOUT |
Overall workflow timeout in seconds. | 0 (Disabled) |
FAIL_ON_BACKUP |
Set to 1 to fail if backup fails. |
0 |
GIT_PUSH |
Set to 1 to enable git push. |
0 |
ENABLE_SECURITY |
Set to 1 to enable security scans. |
0 |
ENABLE_DEP_AUDIT |
Set to 1 to enable dependency audit. |
0 |
LOG_LEVEL |
Logging verbosity (DEBUG, INFO, etc.). | INFO |
LOG_FORMAT |
Log format (text or json). | text |
CLI Arguments
Below is the complete list of arguments available in routine-workflow:
| Flag | Description | Default |
|---|---|---|
-p, --project-root |
Path to the project root. | CWD |
-l, --log-dir |
Directory to write logs. | /sdcard/tools/logs |
--log-file |
Optional single log file path. | None |
--lock-dir |
Directory for lock file. | /tmp/routine_workflow.lock |
--lock-ttl |
Lock eviction TTL in seconds (0=disable). | 3600 |
--log-level |
Logging verbosity (DEBUG, INFO, etc.). | INFO |
--log-format |
Log format (text or json). | text |
--log-rotation-max-bytes |
Max bytes per log file before rotation. | 5MB |
--log-rotation-backup-count |
Number of backup log files to keep. | 5 |
--fail-on-backup |
Exit if backup step fails. | False |
-y, --yes |
Auto-confirm prompts. | False |
-d, --dry-run |
Dry-run mode (default). | True |
-nd, --no-dry-run |
Disable dry-run (perform real execution). | False |
-w, --workers |
Parallel workers. | min(8, CPU) |
-t, --workflow-timeout |
Overall timeout in seconds. | 0 |
-s, --steps |
Specific steps/aliases to run. | All |
--test-cov-threshold |
Pytest coverage threshold. | 85 |
--git-push |
Enable git commit/push in step 6. | False |
-es, --enable-security |
Enable security scan (step 3.5). | False |
-eda, --enable-dep-audit |
Enable dependency audit (step 6.5). | False |
--profile |
Profile execution time of steps. | False |
--install-pre-commit |
Install routine-workflow hook. | False |
-i, --interactive |
Enter interactive configuration mode. | False |
--create-dump-run-cmd |
Override create-dump run command. | None |
--exclude-patterns |
Override default exclude patterns. | None |
--version |
Show program's version. | N/A |
๐๏ธ Architecture
The routine-workflow follows a clean src/ layout with modular components.
src/routine_workflow/
โโโ __init__.py
โโโ banner.py # CLI Banner & Art
โโโ cli.py # Entry point & Argument Parsing
โโโ config.py # Configuration Dataclass
โโโ defaults.py # Default Settings
โโโ lock.py # Concurrency Control
โโโ runner.py # Workflow Orchestrator
โโโ steps/ # Modular Step Definitions
โ โโโ step1.py # Delete Dumps
โ โโโ step2.py # Reformat Code
โ โโโ step2_5.py # Pytest Runner
โ โโโ step3.py # Clean Caches
โ โโโ step3_5.py # Security Scan
โ โโโ step4.py # Backup
โ โโโ step5.py # Create Dumps
โ โโโ step6.py # Git Operations
โ โโโ step6_5.py # Dependency Audit
โโโ utils.py # Helpers
Core Flow:
- Config Loading: Loads defaults, env vars, and CLI args into a
WorkflowConfigobject. - Lock Acquisition: Ensures only one instance runs via
lock.py. - Step Resolution: Maps requested aliases (e.g.,
audit) to step modules (e.g.,step6_5.py). - Execution: The
WorkflowRunnerexecutes steps sequentially, handling logging and errors. - Report: Generates a summary of the run.
๐บ๏ธ Roadmap
Upcoming vs. Completed Features:
โ Completed
- Core Essentials: CLI entrypoint, step runner, reformatting (
ruff,isort), cache cleaning, and concurrency locking. - Integration:
pytestintegration, backup orchestration, and git snapshotting. - Security: Security scanning (
bandit,safety) and dependency auditing. - Advanced Usage: Interactive mode, performance profiling, and pre-commit hook generation.
- Observability: Advanced JSON logging and rotation.
๐ฎ Upcoming
- Ecosystem: 3rd party plugins architecture and official Docker image.
- Integrations: Webhook notifications (Slack/Discord) and CI/CD blueprints.
- Visionary: AI-powered code analysis and automated refactoring.
- Sandbox: Gamification and experimental "chaos mode" features.
๐ค Contributing & License
We welcome contributions! Please see CONTRIBUTING.md (if available) or open a PR.
License: This project is licensed under the MIT License.
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.0.tar.gz.
File metadata
- Download URL: routine_workflow-10.0.0.tar.gz
- Upload date:
- Size: 54.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02bc5bb71d1dc2ddea9409d705c1979998b8d997d22f345a2e6bd5477e4a4574
|
|
| MD5 |
4a1861cfe38bb24daed2f76799f1dfbb
|
|
| BLAKE2b-256 |
bd5067dd0298386765fb69892102af0ea7a5e43ddd870891cb903d32aca036d3
|
Provenance
The following attestation bundles were made for routine_workflow-10.0.0.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.0.tar.gz -
Subject digest:
02bc5bb71d1dc2ddea9409d705c1979998b8d997d22f345a2e6bd5477e4a4574 - Sigstore transparency entry: 747634733
- Sigstore integration time:
-
Permalink:
dhruv13x/routine-workflow@757073941307e87b38d52f8a015e0c49d0fa0713 -
Branch / Tag:
refs/tags/v10.0.0 - Owner: https://github.com/dhruv13x
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@757073941307e87b38d52f8a015e0c49d0fa0713 -
Trigger Event:
push
-
Statement type:
File details
Details for the file routine_workflow-10.0.0-py3-none-any.whl.
File metadata
- Download URL: routine_workflow-10.0.0-py3-none-any.whl
- Upload date:
- Size: 38.5 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 |
ee8f9b265ca83b0304c34a66f946547cf0f7ac9d91a9f714c167142a8a5c7ac1
|
|
| MD5 |
bde243408ca50687512d1085815871fc
|
|
| BLAKE2b-256 |
eee5cdcf202c8306dc4b5867538ba3e3ddbe0e465db7ca87adc63e253edaf436
|
Provenance
The following attestation bundles were made for routine_workflow-10.0.0-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.0-py3-none-any.whl -
Subject digest:
ee8f9b265ca83b0304c34a66f946547cf0f7ac9d91a9f714c167142a8a5c7ac1 - Sigstore transparency entry: 747634735
- Sigstore integration time:
-
Permalink:
dhruv13x/routine-workflow@757073941307e87b38d52f8a015e0c49d0fa0713 -
Branch / Tag:
refs/tags/v10.0.0 - Owner: https://github.com/dhruv13x
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@757073941307e87b38d52f8a015e0c49d0fa0713 -
Trigger Event:
push
-
Statement type: