Skip to main content

Automated routine workflow runner for repository hygiene, backups, and dumps orchestration and much more.

Project description

routine-workflow logo

PyPI version Python Wheel Release

Build status Codecov Test Coverage Code style: black Ruff Security Maintenance

Downloads License: MIT

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 ruff and isort.
  • 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 bandit and safety to catch vulnerabilities.
  • Dependency Auditing: Checks for outdated or insecure dependencies.
  • Test Integration: Runs pytest suite 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

  1. Init: CLI parses args & env vars -> WorkflowConfig.
  2. Lock: Acquires file lock to prevent concurrent runs.
  3. Plan: WorkflowRunner resolves requested steps/aliases.
  4. Execute: Steps run sequentially (some parallelized internally).
  5. 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!

  1. Fork the repository.
  2. Install dev dependencies:
    pip install -e ".[dev]"
    
  3. Run Tests:
    pytest
    
  4. 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

routine_workflow-10.0.1.tar.gz (53.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

routine_workflow-10.0.1-py3-none-any.whl (37.9 kB view details)

Uploaded Python 3

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

Hashes for routine_workflow-10.0.1.tar.gz
Algorithm Hash digest
SHA256 0101c16dcfbaa3265bc87ea8f54662864c2e89cb9cc7758fab4173c06c91af28
MD5 110d2245cc985feb20ef65fdb9d86749
BLAKE2b-256 47708b124d0b6160d159d6c4546205ca57e3f1920b6d679d624a40f24ac171cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for routine_workflow-10.0.1.tar.gz:

Publisher: publish.yml on dhruv13x/routine-workflow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file routine_workflow-10.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for routine_workflow-10.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 b855f5cc25b86ddf40ea9d27acc04e6425582c73bff29d3b9c7f7d764a7917e2
MD5 0a0ee9ed34f156200b3ab6912e4d5724
BLAKE2b-256 4bdc438cf9f84e1dcd9aaa2d6bbfcd2e8fd550bee85dbd68dffd6b1a9c6bca37

See more details on using hashes here.

Provenance

The following attestation bundles were made for routine_workflow-10.0.1-py3-none-any.whl:

Publisher: publish.yml on dhruv13x/routine-workflow

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page