Skip to content
Myr

features.md

This file

Path

docs/features.md

85 lines · 4.3 KiB · Markdown

Last changed by

✨ Add `typer-slim` package without extras, make `typer` include `typer-slim[default]` and integrate Typer CLI (`typer` command) into Typer (#780)Sebastián Ramírezbefore adoption7d5d6bb

History of this file

Take it

The walk stopped after 200 commits: lines older than ddeebf1 point at it.

✏ Fix broken plac link (#275)Michael Gieldabefore adoptionddeebf1

lines 1–10why, one step back
1## Design based on **FastAPI**
23<a href="https://fastapi.tiangolo.com" target="_blank"><img src="https://fastapi.tiangolo.com/img/logo-margin/logo-teal.png" style="width: 20%;"></a>45**Typer** is <a href="https://fastapi.tiangolo.com" class="external-link" target="_blank">FastAPI</a>'s little sibling.67It follows the same design and ideas. If you know **FastAPI**, you already know **Typer**... more or less.89## Just Modern Python10

🔥 Remove support for Python 3.6 (#758)Sebastián Ramírezbefore adoption13404a0

line 11why, one step back
11It's all based on standard **Python type** declarations. No new syntax to learn. Just standard modern Python.

✏ Fix broken plac link (#275)Michael Gieldabefore adoptionddeebf1

lines 12–51why, one step back
12
13If you need a 2 minute refresher of how to use Python types (even if you don't use FastAPI or Typer), check the FastAPI tutorial section: <a href="https://fastapi.tiangolo.com/python-types/" class="external-link" target="_blank">Python types intro</a>.1415You will also see a 20 seconds refresher on the section [Tutorial - User Guide: First Steps](tutorial/first-steps.md){.internal-link target=_blank}.1617## Editor support1819**Typer** was designed to be easy and intuitive to use, to ensure the best development experience. With autocompletion everywhere.2021You will rarely need to come back to the docs.2223Here's how your editor might help you:2425* in <a href="https://code.visualstudio.com/" class="external-link" target="_blank">Visual Studio Code</a>:2627![editor support](img/vscode-completion.png)2829* in <a href="https://www.jetbrains.com/pycharm/" class="external-link" target="_blank">PyCharm</a>:3031![editor support](img/pycharm-completion.png)3233You will get completion for everything. That's something no other CLI library provides right now.3435No more guessing what type was that variable, if it could be `None`, etc.3637### Short3839It has sensible **defaults** for everything, with optional configurations everywhere. All the parameters can be fine-tuned to do what you need, customize the help, callbacks per parameter, make them required or not, etc.4041But by default, it all **"just works"**.4243## User friendly CLI apps4445The resulting CLI apps created with **Typer** have the nice features of many "pro" command line programs you probably already love.4647* Automatic help options for the main CLI program and all its subcommands.48* Automatic command and subcommand structure handling (you will see more about subcommands in the Tutorial - User Guide).49* Automatic completion for the CLI app in all operating systems, in all the shells (Bash, Zsh, Fish, PowerShell), so that the final user of your app can just hit <kbd>TAB</kbd> and get the available options or subcommands. *5051!!! note "* Auto completion"

✨ Add `typer-slim` package without extras, make `typer` include `typer-slim[default]` and integrate Typer CLI (`typer` command) into Typer (#780)Sebastián Ramírezbefore adoption7d5d6bb

line 52why, one step back
52 Auto completion works when you create a package (installable with `pip`). Or when using the `typer` command.

✏ Fix broken plac link (#275)Michael Gieldabefore adoptionddeebf1

line 53why, one step back
53

✨ Add `typer-slim` package without extras, make `typer` include `typer-slim[default]` and integrate Typer CLI (`typer` command) into Typer (#780)Sebastián Ramírezbefore adoption7d5d6bb

line 54why, one step back
54 **Typer** uses `shellingham` to auto-detect the current shell when installing completion. If you don't want to include `shellingham`, install `typer-slim`.

✏ Fix broken plac link (#275)Michael Gieldabefore adoptionddeebf1

lines 55–60why, one step back
55
56 **Typer** will automatically create 2 *CLI options*:5758 * `--install-completion`: Install completion for the current shell.59 * `--show-completion`: Show completion for the current shell, to copy it or customize the installation.60

✨ Add `typer-slim` package without extras, make `typer` include `typer-slim[default]` and integrate Typer CLI (`typer` command) into Typer (#780)Sebastián Ramírezbefore adoption7d5d6bb

line 61why, one step back
61 If you didn't add `shellingham` (if you installed `pip install typer-slim`) those *CLI options* take a value with the name of the shell to install completion for, e.g.:

✏ Fix broken plac link (#275)Michael Gieldabefore adoptionddeebf1

lines 62–76why, one step back
62
63 * `--install-completion bash`.64 * `--show-completion powershell`.6566 Then you can tell the user to install completion after installing your CLI program and the rest will just work.6768!!! tip69 **Typer**'s completion is implemented internally, it uses ideas and components from Click and ideas from `click-completion`, but it doesn't use `click-completion` and re-implements some of the relevant parts of Click.7071 Then it extends those ideas with features and bug fixes. For example, **Typer** programs also support modern versions of PowerShell (e.g. in Windows 10) among all the other shells.7273## The power of Click7475<a href="https://click.palletsprojects.com" class="external-link" target="_blank">Click</a> is one of the most popular tools for building CLIs in Python.76

✨ Add `typer-slim` package without extras, make `typer` include `typer-slim[default]` and integrate Typer CLI (`typer` command) into Typer (#780)Sebastián Ramírezbefore adoption7d5d6bb

line 77why, one step back
77**Typer** is based on it, so you get all its benefits.

✏ Fix broken plac link (#275)Michael Gieldabefore adoptionddeebf1

lines 78–85why, one step back
78
79But you can write simpler code with the benefits of modern Python.8081## Tested8283* 100% <abbr title="The amount of code that is automatically tested">test coverage</abbr>.84* 100% <abbr title="Python type annotations, with this your editor and external tools can give you better support">type annotated</abbr> code base.85* Used in production applications.