Typer (Slim)
Typer-slim was initially conceived as a minimal version of the Typer library for building CLI applications, omitting dependencies like `rich` and `shellingham`. However, since version 0.22.0, `typer-slim` merely installs the full `typer` package, rendering its 'slim' purpose obsolete. As of version 0.24.1, `typer-slim` has been officially abandoned, with no further updates or releases planned. Users are strongly advised to install `typer` directly instead.
Warnings
- breaking `typer-slim` is officially abandoned. No further versions or updates will be released. Users should migrate all dependencies to the main `typer` package.
- breaking Since version 0.22.0, `typer-slim` became a direct wrapper around the full `typer` package, negating its original purpose of being 'slim' by implicitly installing `rich` and `shellingham`.
- gotcha Installing both `typer` and `typer-slim` in the same environment can lead to package conflicts, file overwrites, and corrupted installations, making one or both packages unusable.
- breaking Support for Python 3.9 was dropped in version 0.24.0, and Python 3.8 was dropped in version 0.21.0.
- gotcha Starting with version 0.23.0, the default behavior for Rich tracebacks changed to not show local variables, which can make debugging more difficult in some cases.
Install
-
pip install typer-slim -
pip install typer
Imports
- Typer
from typer import Typer
Quickstart
import typer
app = typer.Typer()
@app.command()
def hello(name: str = 'World'):
"""Say hello to NAME."""
typer.echo(f"Hello {name}!")
if __name__ == '__main__':
app()