Skip to content
Myr

features.md

This file

Path

docs/features.md

87 lines · 4.2 KiB · Markdown

Last changed by

:sparkles: Re-implement completion, fixes, add PowerShell support (#66)Sebastián Ramírezbefore adoption1d3337a

History of this file

Take it

:memo: Add first version of docsSebastián Ramírezbefore adoptionc24269f

lines 1–2why, one step back
1## Design based on **FastAPI**
2

:memo: Refactor docs with internal links #38Sebastián Ramírezbefore adoption8d6b201

line 3why, one step back
3**Typer** is <a href="https://fastapi.tiangolo.com" class="external-link" target="_blank">FastAPI</a>'s little sibling.

:memo: Add first version of docsSebastián Ramírezbefore adoptionc24269f

lines 4–10why, one step back
4
5It follows the same design and ideas. If you know FastAPI, you already know **Typer**... more or less.67## Just Modern Python89It's all based on standard **Python 3.6 type** declarations. No new syntax to learn. Just standard modern Python.10

:memo: Refactor docs with internal links #38Sebastián Ramírezbefore adoption8d6b201

line 11why, one step back
11If 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>.

:memo: Add first version of docsSebastián Ramírezbefore adoptionc24269f

line 12why, one step back
12

:memo: Refactor docs with internal links #38Sebastián Ramírezbefore adoption8d6b201

line 13why, one step back
13You will also see a 20 seconds refresher on the section [Tutorial - User Guide: First Steps](tutorial/first-steps.md){.internal-link target=_blank}.

:memo: Add first version of docsSebastián Ramírezbefore adoptionc24269f

lines 14–22why, one step back
14
15## Editor support1617**Typer** was designed to be easy and intuitive to use, to ensure the best development experience. With autocompletion everywhere.1819You will rarely need to come back to the docs.2021Here's how your editor might help you:22

:art: Tweak external links' format #36Sebastián Ramírezbefore adoption38c19f0

line 23why, one step back
23* in <a href="https://code.visualstudio.com/" class="external-link" target="_blank">Visual Studio Code</a>:

:memo: Add first version of docsSebastián Ramírezbefore adoptionc24269f

lines 24–26why, one step back
24
25![editor support](img/vscode-completion.png)26

:art: Tweak external links' format #36Sebastián Ramírezbefore adoption38c19f0

line 27why, one step back
27* in <a href="https://www.jetbrains.com/pycharm/" class="external-link" target="_blank">PyCharm</a>:

:memo: Add first version of docsSebastián Ramírezbefore adoptionc24269f

lines 28–44why, one step back
28
29![editor support](img/pycharm-completion.png)3031You will get completion for everything. That's something no other CLI library provides right now.3233No more guessing what type was that variable, if it could be `None`, etc.3435### Short3637It 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.3839But by default, it all **"just works"**.4041## User friendly CLI apps4243The resulting CLI apps created with **Typer** have the nice features of many "pro" command line programs you probably already love.44

:sparkles: Re-implement completion, fixes, add PowerShell support (#66)Sebastián Ramírezbefore adoption1d3337a

line 45why, one step back
45* Automatic help options for the main CLI program and all its subcommands.

:pencil: Update docs with references to --install-completionSebastián Ramírezbefore adoption9b44a9f

line 46why, one step back
46* Automatic command and subcommand structure handling (you will see more about subcommands in the Tutorial - User Guide).

:sparkles: Docs for Typer CLI (#64)Sebastián Ramírezbefore adoption96731c4

line 47why, one step back
47* 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. *

:memo: Add first version of docsSebastián Ramírezbefore adoptionc24269f

line 48why, one step back
48

:sparkles: Docs for Typer CLI (#64)Sebastián Ramírezbefore adoption96731c4

line 49why, one step back
49!!! note "* Auto completion"

:sparkles: Re-implement completion, fixes, add PowerShell support (#66)Sebastián Ramírezbefore adoption1d3337a

line 50why, one step back
50 Auto completion works when you create a package (installable with `pip`). Or when using [Typer CLI](typer-cli.md){.internal-link target=_blank}.

:memo: Add first version of docsSebastián Ramírezbefore adoptionc24269f

line 51why, one step back
51

:sparkles: Re-implement completion, fixes, add PowerShell support (#66)Sebastián Ramírezbefore adoption1d3337a

line 52why, one step back
52 If you also add `shellingham` as a dependency, **Typer** will use it to auto-detect the current shell when installing completion.

:pencil: Update docs with references to --install-completionSebastián Ramírezbefore adoption9b44a9f

line 53why, one step back
53

:sparkles: Re-implement completion, fixes, add PowerShell support (#66)Sebastián Ramírezbefore adoption1d3337a

lines 54–55why, one step back
54 **Typer** will automatically create 2 *CLI options*:
55

:pencil: Update docs with references to --install-completionSebastián Ramírezbefore adoption9b44a9f

line 56why, one step back
56 * `--install-completion`: Install completion for the current shell.

:sparkles: Re-implement completion, fixes, add PowerShell support (#66)Sebastián Ramírezbefore adoption1d3337a

line 57why, one step back
57 * `--show-completion`: Show completion for the current shell, to copy it or customize the installation.

:memo: Add first version of docsSebastián Ramírezbefore adoptionc24269f

line 58why, one step back
58

:sparkles: Re-implement completion, fixes, add PowerShell support (#66)Sebastián Ramírezbefore adoption1d3337a

lines 59–62why, one step back
59 If you didn't add `shellingham` those *CLI Options* take a parameter with the name of the shell to install completion for, e.g.:
60 61 * `--install-completion bash`.62 * `--show-completion powershell`.

:sparkles: Docs for Typer CLI (#64)Sebastián Ramírezbefore adoption96731c4

line 63why, one step back
63

:sparkles: Re-implement completion, fixes, add PowerShell support (#66)Sebastián Ramírezbefore adoption1d3337a

lines 64–69why, one step back
64 Then you can tell the user to install completion after installing your CLI program and the rest will just work.
6566!!! tip67 **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` internally.6869 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.

:memo: Add first version of docsSebastián Ramírezbefore adoptionc24269f

lines 70–72why, one step back
70
71## The power of Click72

:art: Tweak external links' format #36Sebastián Ramírezbefore adoption38c19f0

line 73why, one step back
73<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.

:memo: Add first version of docsSebastián Ramírezbefore adoptionc24269f

lines 74–87why, one step back
74
75**Typer** is based on it, so you get all its benefits, plug-ins, robustness, etc.7677But you can write simpler code with the benefits of modern Python.7879<!-- 8081TODO8283### Tested8485* 100% <abbr title="The amount of code that is automatically tested">test coverage</abbr>.86* 100% <abbr title="Python type annotations, with this your editor and external tools can give you better support">type annotated</abbr> code base.87* Used in production applications. -->