Skip to content
Myr

alternatives.md

This file

Path

docs/alternatives.md

83 lines · 4.8 KiB · Markdown

Last changed by

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

History of this file

Take it

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

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

lines 1–2why, one step back
1What inspired **Typer**, how it compares to other alternatives and what it learned from them.
2

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

line 3why, one step back
3## Intro

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 4why, one step back
4

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

line 5why, one step back
5**Typer** wouldn't exist if not for the previous work of others.

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

lines 6–10why, one step back
6
7There have been many tools created before that have helped inspire its creation.89## Previous tools10

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

line 11why, one step back
11### <a href="https://docs.python.org/3/library/argparse.html" class="external-link" target="_blank">`argparse`</a>

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 12why, one step back
12

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

line 13why, one step back
13`argparse` is the Python standard library's module to write CLIs.

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 14why, one step back
14

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

line 15why, one step back
15It provides a better alternative than reading the *CLI Parameters* as a `list` of `str` and parsing everything by hand.

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 16why, one step back
16

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

lines 17–18why, one step back
17!!! check "Inspired **Typer** to"
18 Provide a better development experience than just reading *CLI Parameters* by hand.

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 19why, one step back
19

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

line 20why, one step back
20### <a href="https://www.hug.rest/" class="external-link" target="_blank">Hug</a>

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 21why, one step back
21

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

line 22why, one step back
22Hug is a library to create APIs and CLIs, it uses parameters in functions to declare the required data.

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 23why, one step back
23

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

line 24why, one step back
24It inspired a lot of the ideas in **FastAPI** and **Typer**.

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 25why, one step back
25

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

line 26why, one step back
26!!! check "Inspired **Typer** to"

:sparkles: Add docs for testing, password, version, context. Extra tests, include callback and autocompletion PR (#68)Sebastián Ramírezbefore adoption5a6379f

line 27why, one step back
27 Use function parameters to declare *CLI arguments* and *CLI options* as it simplifies a lot the development experience.

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 28why, one step back
28

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

line 29why, one step back
29### <a href="https://plac.readthedocs.io/en/latest/" class="external-link" target="_blank">Plac</a>

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 30why, one step back
30

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

line 31why, one step back
31Plac is another library to create CLIs using parameters in functions, similar to Hug.

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 32why, one step back
32

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

lines 33–34why, one step back
33!!! check "Inspired **Typer** to"
34 Provide a simple way to use a function as a command line app, without having to create a complete app, with `typer.run(some_function)`.

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 35why, one step back
35

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

line 36why, one step back
36### <a href="https://pydantic-docs.helpmanual.io/" class="external-link" target="_blank">Pydantic</a>

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 37why, one step back
37

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

line 38why, one step back
38Pydantic is a library to handle data validation using standard modern Python type annotations.

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 39why, one step back
39

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

line 40why, one step back
40It powers **FastAPI** underneath.

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 41why, one step back
41

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

line 42why, one step back
42It is not used by **Typer**, but it inspired a lot of the design (through **FastAPI**).

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 43why, one step back
43

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

lines 44–45why, one step back
44!!! check "Inspired **Typer** to"
45 Use standard Python type annotations to declare types instead of library-specific types or classes and use them for data validation and documentation.

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 46why, one step back
46

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

line 47why, one step back
47### <a href="https://click.palletsprojects.com" class="external-link" target="_blank">Click</a>

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 48why, one step back
48

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

line 49why, one step back
49Click is one of the most widely used libraries to create CLIs in Python.

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 50why, one step back
50

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

line 51why, one step back
51It's a very powerful tool and there are many CLIs built with it. It is what powers **Typer** underneath.

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 52why, one step back
52

:sparkles: Add docs for testing, password, version, context. Extra tests, include callback and autocompletion PR (#68)Sebastián Ramírezbefore adoption5a6379f

line 53why, one step back
53It also uses functions with parameters for *CLI arguments* and *CLI options*, but the declaration of the specific *CLI arguments*, *CLI options*, types, etc, is done in decorators on top of the function. This requires some code repetition (e.g. a *CLI Option* name `--verbose` and a variable name `verbose`) and synchronization between two places related to the same information (the decorator and the parameter function).

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 54why, one step back
54

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

line 55why, one step back
55It uses decorators on top of functions to modify the actual value of those functions, converting them to instances of a specific class. This is a clever trick, but code editors can't provide great support for autocompletion that way.

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 56why, one step back
56

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

line 57why, one step back
57It was built with some great ideas and design using the features available in the language at the time (Python 2.x).

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 58why, one step back
58

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

lines 59–60why, one step back
59!!! check "**Typer** uses it for"
60 Everything. 🚀

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 61why, one step back
61

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

line 62why, one step back
62 **Typer** mainly adds a layer on top of Click, making the code simpler and easier to use, with autocompletion everywhere, etc, but providing all the powerful features of Click underneath.

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 63why, one step back
63

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

line 64why, one step back
64 As someone pointed out: <em><a href="https://twitter.com/fishnets88/status/1210126833745838080" class="external-link" target="_blank">"Nice to see it is built on Click but adds the type stuff. Me gusta!"</a></em>

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 65why, one step back
65

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

lines 66–76why, one step back
66### <a href="https://github.com/click-contrib/click-completion" class="external-link" target="_blank">`click-completion`</a>
6768`click-completion` is a plug-in for Click. It was created to extend completion support for shells when Click only had support for Bash completion.6970Previous versions of **Typer** had deep integrations with `click-completion` and used it as an optional dependency. But now all the completion logic is implemented internally in **Typer** itself, the internal logic was heavily inspired and using some parts of `click-completion`.7172And now **Typer** improved it to have new features, tests, some bug fixes (for issues in plain `click-completion` and Click), and better support for shells, including modern versions of PowerShell (e.g. the default versions that come with Windows 10).7374!!! check "Inspired **Typer** to"75 Provide auto completion for all the shells.76

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

line 77why, one step back
77### <a href="https://fastapi.tiangolo.com/" class="external-link" target="_blank">FastAPI</a>

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 78why, one step back
78

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

line 79why, one step back
79I created **FastAPI** to provide an easy way to build APIs with autocompletion for everything in the code (and some other <a href="https://fastapi.tiangolo.com/features/" class="external-link" target="_blank">features</a>).

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 80why, one step back
80

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

line 81why, one step back
81**Typer** is the "FastAPI of CLIs".

:memo: :sparkles: :bug: Add docs for CLI parameters with multiple values, with tests and bug fixesSebastián Ramírezbefore adoptionbcdcfce

line 82why, one step back
82

:memo: Add docs about alternatives and inspiration (#62)Sebastián Ramírezbefore adoptiona77057f

line 83why, one step back
83It uses the same design and usage of FastAPI as much as possible. So, if you have used FastAPI, you know how to use Typer.