Skip to main content

typer-alias

Add command aliases to your Typer CLI with clean, readable help output.

typer-alias is a tiny utility that extends Typer by allowing a command to have one or more aliases while keeping the generated help concise.

Instead of registering multiple command implementations, write your command once and expose it under multiple names.

Features

  • ✅ Simple decorator API
  • ✅ Support for unlimited aliases
  • ✅ Aliases actually work as independent commands
  • ✅ Clean help output
  • ✅ Zero runtime dependencies besides Typer

Installation

pip install typer-alias

Quick Start

import typer

from typer_alias import command

app = typer.Typer()


@command(
    app,
    name="list",
    aliases=("ls", "l"),
)
def get_all():
    """Get all users."""
    print("Getting users...")


if __name__ == "__main__":
    app()

All of the following commands execute the same function:

app list
app ls
app l

Help Output

Instead of listing every alias as a separate command, the help is displayed as:

Commands:

  list (ls, l)     Get all users.

This keeps the help page compact while still showing users every available alias.


API

command(...)

A drop-in replacement for @app.command.

command(
    app,
    *,
    name=None,
    aliases=None,
    help=None,
    hidden=False,
    ...
)

Parameters

Parameter Description
app The typer.Typer application.
name Override the command name. Defaults to the function name.
aliases Iterable of alternative command names.
help Command help text.
hidden Hide the command from help output.
cls Custom TyperCommand class.
context_settings Click context settings.
epilog Help epilog.
options_metavar Override options metavar.
add_help_option Enable/disable --help.
no_args_is_help Show help when no arguments are supplied.
deprecated Mark the command as deprecated.
rich_help_panel Rich help panel name.

All other behavior matches Typer's built-in @app.command.


Example

import typer

from typer_alias import command

app = typer.Typer()


@command(
    app,
    aliases=("rm", "delete"),
)
def remove():
    """Remove an item."""
    print("Removing...")


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


if __name__ == "__main__":
    app()

Usage:

app remove
app rm
app delete

app list
app ls

Why?

Typer (and Click) do not provide an ergonomic way to define command aliases that also produce clean help output.

This package solves that by:

  • registering each alias as a hidden command
  • exposing a single visible command
  • displaying aliases inline in the command list

Compatibility

  • Python 3.12+
  • Typer

License

MIT

Release files for typer-alias 0.1.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-alias 0.1.0
File Size Uploaded
typer_alias-0.1.0.tar.gz 3.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for typer-alias 0.1.0
File Interpreter ABI Platform
typer_alias-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.1 kB

Release files / typer_alias-0.1.0.tar.gz

Download URL typer_alias-0.1.0.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
33bca738b9d71af1809bb8b0f236e8ba53e067c8d6df97bbe5d5bed22c334d47
BLAKE2b-256 checksum
How to use checksums
db48a1a25b658c927e53fcf26dc0a423ee1c2ec05410df0c2c20c76096893b58
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","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_alias-0.1.0-py3-none-any.whl

Download URL typer_alias-0.1.0-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
deca5070fba7526ca96af79fc56118e9ef9df397ec17e5c2ae73cc6277db1f7e
BLAKE2b-256 checksum
How to use checksums
5964ab81f4e5d0c0be334d7c27dff45178e6821d3b8224a92be9b05fab10cb4d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","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.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