features.md
This file
Path
docs/features.md
85 lines · 4.3 KiB · Markdown
Last changed by
🔧 Add pre-commit config and formatting (#392)Sebastián Ramírezbefore adoptiona1ee411
History of this fileTake it
The walk stopped after 200 commits: lines older than 72466cb point at it.
:fire: Clean exports from typer, remove unneeded Click components, add needed onesSebastián Ramírezbefore adoption72466cb
lines 1–2why, one step back1## Design based on **FastAPI**2:sparkles: Add docs for testing, password, version, context. Extra tests, include callback and autocompletion PR (#68)Sebastián Ramírezbefore adoption5a6379f
lines 3–4why, one step back3<a href="https://fastapi.tiangolo.com" target="_blank"><img src="https://fastapi.tiangolo.com/img/logo-margin/logo-teal.png" style="width: 20%;"></a>4:memo: Refactor docs with internal links #38Sebastián Ramírezbefore adoption8d6b201
line 5why, one step back5**Typer** is <a href="https://fastapi.tiangolo.com" class="external-link" target="_blank">FastAPI</a>'s little sibling.:fire: Clean exports from typer, remove unneeded Click components, add needed onesSebastián Ramírezbefore adoption72466cb
line 6why, one step back6:sparkles: Add docs for testing, password, version, context. Extra tests, include callback and autocompletion PR (#68)Sebastián Ramírezbefore adoption5a6379f
line 7why, one step back7It follows the same design and ideas. If you know **FastAPI**, you already know **Typer**... more or less.:fire: Clean exports from typer, remove unneeded Click components, add needed onesSebastián Ramírezbefore adoption72466cb
lines 8–12why, one step back89## Just Modern Python1011It's all based on standard **Python 3.6 type** declarations. No new syntax to learn. Just standard modern Python.12:memo: Refactor docs with internal links #38Sebastián Ramírezbefore adoption8d6b201
line 13why, one step back13If 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>.:fire: Clean exports from typer, remove unneeded Click components, add needed onesSebastián Ramírezbefore adoption72466cb
line 14why, one step back14:memo: Refactor docs with internal links #38Sebastián Ramírezbefore adoption8d6b201
line 15why, one step back15You will also see a 20 seconds refresher on the section [Tutorial - User Guide: First Steps](tutorial/first-steps.md){.internal-link target=_blank}.:fire: Clean exports from typer, remove unneeded Click components, add needed onesSebastián Ramírezbefore adoption72466cb
lines 16–24why, one step back1617## 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:24:art: Tweak external links' format #36Sebastián Ramírezbefore adoption38c19f0
line 25why, one step back25* in <a href="https://code.visualstudio.com/" class="external-link" target="_blank">Visual Studio Code</a>::fire: Clean exports from typer, remove unneeded Click components, add needed onesSebastián Ramírezbefore adoption72466cb
lines 26–28why, one step back262728:art: Tweak external links' format #36Sebastián Ramírezbefore adoption38c19f0
line 29why, one step back29* in <a href="https://www.jetbrains.com/pycharm/" class="external-link" target="_blank">PyCharm</a>::fire: Clean exports from typer, remove unneeded Click components, add needed onesSebastián Ramírezbefore adoption72466cb
lines 30–46why, one step back30313233You 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.46:sparkles: Re-implement completion, fixes, add PowerShell support (#66)Sebastián Ramírezbefore adoption1d3337a
line 47why, one step back47* Automatic help options for the main CLI program and all its subcommands.:fire: Clean exports from typer, remove unneeded Click components, add needed onesSebastián Ramírezbefore adoption72466cb
line 48why, one step back48* 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 49why, one step back49* 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. *:fire: Clean exports from typer, remove unneeded Click components, add needed onesSebastián Ramírezbefore adoption72466cb
line 50why, one step back50:sparkles: Docs for Typer CLI (#64)Sebastián Ramírezbefore adoption96731c4
line 51why, one step back51!!! note "* Auto completion":sparkles: Re-implement completion, fixes, add PowerShell support (#66)Sebastián Ramírezbefore adoption1d3337a
line 52why, one step back52 Auto completion works when you create a package (installable with `pip`). Or when using [Typer CLI](typer-cli.md){.internal-link target=_blank}.:fire: Clean exports from typer, remove unneeded Click components, add needed onesSebastián Ramírezbefore adoption72466cb
line 53why, one step back53:sparkles: Re-implement completion, fixes, add PowerShell support (#66)Sebastián Ramírezbefore adoption1d3337a
line 54why, one step back54 If you also add `shellingham` as a dependency, **Typer** will use it to auto-detect the current shell when installing completion.:fire: Clean exports from typer, remove unneeded Click components, add needed onesSebastián Ramírezbefore adoption72466cb
line 55why, one step back55:sparkles: Re-implement completion, fixes, add PowerShell support (#66)Sebastián Ramírezbefore adoption1d3337a
lines 56–57why, one step back56 **Typer** will automatically create 2 *CLI options*:57:fire: Clean exports from typer, remove unneeded Click components, add needed onesSebastián Ramírezbefore adoption72466cb
line 58why, one step back58 * `--install-completion`: Install completion for the current shell.:sparkles: Re-implement completion, fixes, add PowerShell support (#66)Sebastián Ramírezbefore adoption1d3337a
line 59why, one step back59 * `--show-completion`: Show completion for the current shell, to copy it or customize the installation.:fire: Clean exports from typer, remove unneeded Click components, add needed onesSebastián Ramírezbefore adoption72466cb
line 60why, one step back60:sparkles: Add docs for testing, password, version, context. Extra tests, include callback and autocompletion PR (#68)Sebastián Ramírezbefore adoption5a6379f
line 61why, one step back61 If you didn't add `shellingham` those *CLI options* take a value with the name of the shell to install completion for, e.g.:🔧 Add pre-commit config and formatting (#392)Sebastián Ramírezbefore adoptiona1ee411
line 62why, one step back62:sparkles: Re-implement completion, fixes, add PowerShell support (#66)Sebastián Ramírezbefore adoption1d3337a
lines 63–64why, one step back63 * `--install-completion bash`.64 * `--show-completion powershell`.:sparkles: Docs for Typer CLI (#64)Sebastián Ramírezbefore adoption96731c4
line 65why, one step back65:sparkles: Re-implement completion, fixes, add PowerShell support (#66)Sebastián Ramírezbefore adoption1d3337a
lines 66–68why, one step back66 Then you can tell the user to install completion after installing your CLI program and the rest will just work.6768!!! tip:sparkles: Add docs for testing, password, version, context. Extra tests, include callback and autocompletion PR (#68)Sebastián Ramírezbefore adoption5a6379f
line 69why, one step back69 **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.:sparkles: Re-implement completion, fixes, add PowerShell support (#66)Sebastián Ramírezbefore adoption1d3337a
lines 70–71why, one step back7071 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.:fire: Clean exports from typer, remove unneeded Click components, add needed onesSebastián Ramírezbefore adoption72466cb
lines 72–74why, one step back7273## The power of Click74:art: Tweak external links' format #36Sebastián Ramírezbefore adoption38c19f0
line 75why, one step back75<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.:fire: Clean exports from typer, remove unneeded Click components, add needed onesSebastián Ramírezbefore adoption72466cb
lines 76–80why, one step back7677**Typer** is based on it, so you get all its benefits, plug-ins, robustness, etc.7879But you can write simpler code with the benefits of modern Python.80white_check_mark: Add coverage instructions to tests (#72)Sebastián Ramírezbefore adoptiona89fc4e
line 81why, one step back81## Tested:fire: Clean exports from typer, remove unneeded Click components, add needed onesSebastián Ramírezbefore adoption72466cb
lines 82–84why, one step back8283* 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.white_check_mark: Add coverage instructions to tests (#72)Sebastián Ramírezbefore adoptiona89fc4e
line 85why, one step back85* Used in production applications.