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,adminandaall work; the help lists them once aslist (ls)andadmin (a).ascii_namedraws a banner at the top of that command's or group's--helppage, while the commands list keeps the plain help text. Useascii_fontto pick any pyfiglet font (default:ansi_shadow).- The banner is formatted for the app's
rich_markup_mode("rich","markdown"orNone).
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)
| File | Size | Uploaded | |
|---|---|---|---|
| typer_swissknife-0.1.1.tar.gz | 6.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| 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}
|