Skip to main content
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.

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)

Source distribution for routine-workflow 10.0.1
File Size Uploaded
routine_workflow-10.0.1.tar.gz 53.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for routine-workflow 10.0.1
File Interpreter ABI Platform
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 log

Release 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

Release history Release notifications | RSS feed

This release

10.0.1 This release

2 release files

9.0.3

2 release files

9.0.2

2 release files

7.0.0

2 release files

6.4.0

2 release files

3.2.0

2 release files

3.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page