| 1 |
.. _Typer Comparison: |
| 2 |
|
| 3 |
================ |
| 4 |
Typer Comparison |
| 5 |
================ |
| 6 |
|
| 7 |
Much of Cyclopts was inspired by the excellent `Typer`_ library. |
| 8 |
Despite its popularity, Typer has some traits that I (and others) find less than ideal. |
| 9 |
Part of this stems from Typer's age, with its first release in late 2019, soon after Python 3.8's release. |
| 10 |
Because of this, most of its API was initially designed around assigning proxy default values to function parameters. |
| 11 |
This made the decorated command functions difficult to use outside of Typer. |
| 12 |
With the introduction of :obj:`~.typing.Annotated` in python3.9, type-hints were able to be directly annotated, allowing for the removal of these proxy defaults. |
| 13 |
|
| 14 |
Additionally, Typer is built on top of `Click`_. |
| 15 |
This makes it difficult for newcomers to figure out which elements are Typer-related and which elements are click-related. |
| 16 |
It's also hard to tell whether the following criticisms stem from Typer, or the underlying Click. |
| 17 |
For better-or-worse, Cyclopts uses its own internal parsing strategy, gaining complete control over the process. |
| 18 |
|
| 19 |
This section was originally written about Typer ``v0.9.0`` (May 2023). |
| 20 |
Some criticisms have been addressed in later Typer versions; updates are noted in the respective sections below. |
| 21 |
|
| 22 |
.. toctree:: |
| 23 |
:maxdepth: 1 |
| 24 |
:caption: Topics |
| 25 |
|
| 26 |
argument_vs_option/README.rst |
| 27 |
positional_or_keyword/README.rst |
| 28 |
choices/README.rst |
| 29 |
default_command/README.rst |
| 30 |
docstring/README.rst |
| 31 |
decorator_parentheses/README.rst |
| 32 |
optional_list/README.rst |
| 33 |
keyword_multiple_values/README.rst |
| 34 |
flag_negation/README.rst |
| 35 |
help_defaults/README.rst |
| 36 |
validation/README.rst |
| 37 |
union_support/README.rst |
| 38 |
version_flag/README.rst |
| 39 |
documentation/README.rst |
| 40 |
|
| 41 |
|
| 42 |
.. _Typer: https://typer.tiangolo.com |
| 43 |
.. _Click: https://click.palletsprojects.com |