Skip to main content

typer-swissknife

typer-swissknife is a lightweight companion library for Typer that helps you build cleaner, more expressive CLI applications.

It focuses on a small set of practical helpers for common CLI patterns such as alias-aware commands, nested sub-apps, and richer help output.

Why use it

  • Keep command registration simple and readable.
  • Organize larger CLIs into smaller, reusable Typer components.
  • Improve discoverability with optional visual help text.
  • Stay close to Typer's native behavior while adding a bit more structure.

Features

  • Alias-aware command decorators
  • Nested Typer app registration
  • Optional ASCII-enhanced help sections
  • Simple integration into existing Typer projects

Installation

pip install typer-swissknife

Quick example

import typer
from typer_swissknife import add_typer, command

app = typer.Typer()
admin = typer.Typer()

@command(app, name="list", aliases=("ls",), ascii_name="List")
def list_items():
    """List all items."""
    print("Listing items...")

@command(admin, aliases=("rm",))
def remove(item: str):
    print(f"Removing {item}")

add_typer(
    app,
    admin,
    name="admin",
    ascii_name="Admin",
    aliases=("a",),
    help="Administrative commands",
)

if __name__ == "__main__":
    app()
  • list, ls, admin and a all work; the help lists them once as list (ls) and admin (a).
  • ascii_name draws a banner at the top of that command's or group's --help page, while the commands list keeps the plain help text. Use ascii_font to pick any pyfiglet font (default: ansi_shadow).
  • The banner is formatted for the app's rich_markup_mode ("rich", "markdown" or None).

Development

uv sync
uv run pytest

Tests run with branch coverage, and the run fails below 100%.

Project philosophy

This package is intentionally compact and focused. As the project grows, the goal is to keep the documentation high-level and feature-oriented rather than listing every helper in detail.

License

typer-swissknife is licensed under the GNU General Public License v3 (GPLv3).

Metadata

Release files for typer-swissknife 0.1.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 typer-swissknife 0.1.1
File Size Uploaded
typer_swissknife-0.1.1.tar.gz 6.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for typer-swissknife 0.1.1
File Interpreter ABI Platform
typer_swissknife-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 15.3 kB

Release files / typer_swissknife-0.1.1.tar.gz

Download URL typer_swissknife-0.1.1.tar.gz
Size 6.5 kB
Tags Source
SHA-256 checksum
How to use checksums
963fe8cd33f96e198e0643c75812ad56288d8aaab39100e08bd12208ad2251d6
BLAKE2b-256 checksum
How to use checksums
f55aece93af593564b593b406c587374f0698d7e6e5ef62cdc96597dfed58a65
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / typer_swissknife-0.1.1-py3-none-any.whl

Download URL typer_swissknife-0.1.1-py3-none-any.whl
Size 8.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
244a3fa0931703e49025795315148e0abeb19cb4cea10f2633ba13e99672be6f
BLAKE2b-256 checksum
How to use checksums
2367a41a096a332b7d2f999363a509d46ec48b0978779ac3054cdd32522ac87d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1.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