Skip to main content

typer-powertools

Extended batteries for Typer — 12 powerful CLI extensions to build production-grade tools faster.

Python License Tests

typer-powertools extends Typer with the features every professional CLI eventually needs: layered configuration, auditing, interactive shells, setup wizards, and more. Stop writing boilerplate and start building features.


12 Batteries Included

Module Description
config Layered settings (pyproject.toml, .env, YAML, JSON) with Pydantic validation.
shell Turn your multi-command app into an interactive REPL with history and help.
progress Declarative progress bars, spinners, and task tracking via Rich.
audit Transparent SQLite-backed logging of every command invocation and result.
i18n Internationalization for help text and messages (files or in-memory).
hooks Lifecycle hooks (before, after, error, finally) for setup and teardown.
cache TTL-based result caching for expensive API calls or heavy computations.
middleware Request/response pipeline for authentication, timing, retries, and more.
plugins Dynamic plugin discovery from paths or installed Python packages.
wizard Interactive multi-step setup wizards with validation and conditional logic.
templates Project and file generation using Jinja2 templates.
migrations Versioning and automatic migration of user configuration files.

Quick Start

import typer
from typer_powertools import config_option, audit_command, cached_command, track_progress

app = typer.Typer()

@app.command()
@audit_command(app_name="myapp")  # ← Logs invocation to SQLite
@cached_command(ttl=3600)         # ← Caches result for 1 hour
@config_option(app_name="myapp")  # ← Loads from pyproject.toml / .env
def deploy(env: str = "staging"):
    for step in track_progress(range(10), description="Deploying..."):
        do_work(step)
    typer.echo(f"✓ Deployed to {env}")

if __name__ == "__main__":
    app()

Feature Highlights

🛠 Layered Config & Pydantic

Automatically load configuration from multiple sources with strict precedence: CLI args > Env Vars > Config File > Defaults.

from typer_powertools import pydantic_config_option
from pydantic import BaseModel

class MyConfig(BaseModel):
    api_key: str
    timeout: int = 30

@app.command()
@pydantic_config_option(MyConfig, app_name="myapp")
def connect(cfg: MyConfig):
    typer.echo(f"Connecting with {cfg.api_key}...")

🐚 Interactive Shell (REPL)

Give your users a powerful interactive environment with one line of code.

from typer_powertools import shell_command

# Registers a 'shell' command to your app
shell_command(app, prompt="myapp> ")

🕵️‍♂️ Transparent Auditing

Keep a permanent record of what your CLI did. Includes management commands to view history and stats.

from typer_powertools import register_audit_commands

@app.command()
@audit_command(app_name="myapp", sensitive_params=["password"])
def login(password: str):
    pass

register_audit_commands(app, app_name="myapp")
# Adds: myapp audit history / myapp audit stats

🧙‍♂️ Setup Wizards

Build complex interactive configurations with a fluent API.

from typer_powertools import WizardBuilder

@app.command()
def init():
    wizard = (
        WizardBuilder("Initial Setup")
        .ask("name", "Project Name?")
        .choose("theme", "Select Theme", ["dark", "light"])
        .ask_secret("key", "API Key")
        .build()
    )
    results = wizard.run()
    typer.echo(f"Setup complete for {results['name']}!")

🔄 Config Migrations

Evolve your configuration schema without breaking your users' setups.

from typer_powertools import MigrationManager, register_migration_commands

manager = MigrationManager("myapp")

@manager.migration("v1_to_v2", from_version="1.0", to_version="2.0")
def upgrade(config):
    config["new_key"] = config.pop("old_key")
    return config

register_migration_commands(app, manager)

Installation

# Install core
pip install typer-powertools

# Install with optional features
pip install "typer-powertools[cache]"      # For TTL caching
pip install "typer-powertools[templates]"  # For Jinja2 templates
pip install "typer-powertools[all]"        # Install everything

Documentation & Learning


Examples

Check out the examples/ directory for complete applications:


License

Built by Muhammad Ali. Distributed under the Apache License 2.0. See LICENSE for more information.

Built on top of Typer and Rich.

Release files for typer-powertools 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for typer-powertools 0.2.0
File Size Uploaded
typer_powertools-0.2.0.tar.gz 62.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for typer-powertools 0.2.0
File Interpreter ABI Platform
typer_powertools-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 121.2 kB

Release files / typer_powertools-0.2.0.tar.gz

Download URL typer_powertools-0.2.0.tar.gz
Size 62.7 kB
Tags Source
SHA-256 checksum
How to use checksums
a0df315d59a1be66529633a6d7d24c6608a6f0e1fcc6a3640099baa0d2db8a8d
BLAKE2b-256 checksum
How to use checksums
2947d72c818aad61eb0f6abe54d73aca12a459f9eadd31741ec7131c27735ebb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 8, 2026.

Transparency log

Release files / typer_powertools-0.2.0-py3-none-any.whl

Download URL typer_powertools-0.2.0-py3-none-any.whl
Size 58.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8e940d7de59979965aaa24994835f0233e5f748c64b7dec21898f504d6335d06
BLAKE2b-256 checksum
How to use checksums
46090895b9406eac90c00c33ea233e24be53440f9128334ccb6a6911b938932e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

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 May 8, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

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