Skip to content
Myr

:memo: Refactor docs with internal links

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Sebastián Ramírez · committed by Sebastián Ramírez · parent 62fd577 · Browse files · 11 files+28 added−18 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

11 files+28 added−18 removed

  • other:+28 added−18 removed

11 files+28 added−18 removed

modified:docs/css/custom.css+11 added-1 removed
modified:docs/tutorial/subcommands/callback-override.md+1 added-1 removed
modified:docs/tutorial/subcommands/index.md+1 added-1 removed
modified:docs/tutorial/arguments.md+2 added-2 removed
33 unmodified lines
34</div>3536### An alternative *CLI argument* declaration3738In the <a href="https://typer.tiangolo.com/tutorial/first-steps/#add-a-cli-argument" class="external-link" target="_blank">First Steps</a> you saw how to add a *CLI argument*:38In the [First Steps](first-steps.md#add-a-cli-argument){.internal-link target=_blank} you saw how to add a *CLI argument*:3940```Python hl_lines="4"41{!./src/first_steps/tutorial002.py!}42```
147 unmodified lines
190For that reason, Typer (actually Click underneath) doesn't attempt to automatically document *CLI arguments*.191192And you should document them as part of the CLI app documentation, normally in a <abbr title="a multi-line string as the first expression inside a function (not assigned to any variable) used for documentation">docstring</abbr>.193194Check the last example from the <a href="https://typer.tiangolo.com/tutorial/first-steps/#document-your-cli-app" class="external-link" target="_blank">First Steps</a>:194Check the last example from the [First Steps](first-steps.md#document-your-cli-app){.internal-link target=_blank}:195196```Python hl_lines="5 6 7 8 9"197{!./src/first_steps/tutorial006.py!}198```
10 unmodified lines
modified:docs/tutorial/first-steps.md+2 added-2 removed
387 unmodified lines
388 It's quite technical... and somewhat pedantic.389390 One refers to the variable name in a function *declaration*. Like:391 392 ```Python392 ```393 def bring_person(name: str, lastname: str = ""):394 pass395 ```396397 The other refers to the value passed when *calling* a function. Like:398399 ```Python399 ```400 person = bring_person("Camila", lastname="Gutiérrez")401 ```402403 ...but you will probably see them used interchangeably in most of the places (including here).
35 unmodified lines
modified:docs/tutorial/index.md+1 added-1 removed
1## Python types23If you need a refreshed about how to use Python type hints, check the first part of <a href="https://fastapi.tiangolo.com/python-types/" target="_blank">FastAPI's Python types intro</a>.3If you need a refreshed about how to use Python type hints, check the first part of <a href="https://fastapi.tiangolo.com/python-types/" class="external-link" target="_blank">FastAPI's Python types intro</a>.45You can also check the <a href="https://mypy.readthedocs.io/en/latest/cheat_sheet_py3.html" class="external-link" target="_blank">mypy cheat sheet</a>.67In short (very short), you can declare a function with parameters like:
69 unmodified lines
modified:docs/tutorial/prompt.md+2 added-2 removed
1When you need to ask the user for info interactively you should normally use <a href="https://typer.tiangolo.com/tutorial/options/prompt/" class="external-link" target="_blank">*CLI Option*s with Prompt</a>, because they allow using the CLI program in a non-interactive way (for example, a Bash script could use it).1When you need to ask the user for info interactively you should normally use [*CLI Option*s with Prompt](options/prompt.md){.internal-link target=_blank}, because they allow using the CLI program in a non-interactive way (for example, a Bash script could use it).23But if you absolutely need to ask for interactive information without using a *CLI option*, you can use `typer.prompt()`:45```Python hl_lines="5"
15 unmodified lines
21</div>2223## Confirm2425There's also an alternative to ask for confirmation. Again, if possible, you should use a <a href="https://typer.tiangolo.com/tutorial/options/prompt/" class="external-link" target="_blank">*CLI Option* with a confirmation prompt</a>:25There's also an alternative to ask for confirmation. Again, if possible, you should use a [*CLI Option* with a confirmation prompt](options/prompt.md){.internal-link target=_blank}:2627```Python hl_lines="5"28{!./src/prompt/tutorial002.py!}29```
49 unmodified lines
modified:docs/contributing.md+1 added-1 removed
1First, you might want to see the basic ways to <a href="https://typer.tiangolo.com/help-typer/" target="_blank">help Typer and get help</a>.1First, you might want to see the basic ways to [help Typer and get help](help-typer.md){.internal-link target=_blank}.23Coming soon...45<!-- ## Developing
120 unmodified lines
modified:docs/features.md+3 added-3 removed
1## Design based on **FastAPI**23**Typer** is <a href="https://fastapi.tiangolo.com" target="_blank">FastAPI</a>'s little sibling.3**Typer** is <a href="https://fastapi.tiangolo.com" class="external-link" target="_blank">FastAPI</a>'s little sibling.45It 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.1011If 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/" target="_blank">Python types intro</a>.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>.1213You will also see a 20 seconds refresher on the section [Tutorial - User Guide: First Steps](tutorial/first-steps.md).13You will also see a 20 seconds refresher on the section [Tutorial - User Guide: First Steps](tutorial/first-steps.md){.internal-link target=_blank}.1415## Editor support1617**Typer** was designed to be easy and intuitive to use, to ensure the best development experience. With autocompletion everywhere.
60 unmodified lines
modified:docs/index.md+2 added-2 removed
24 unmodified lines
25---2627Typer is library to build <abbr title="command line interface, programs executed from a terminal">CLI</abbr> applications that users will love using and developers will love creating. Based on Python 3.6+ type hints.2829**Typer** is <a href="https://fastapi.tiangolo.com" target="_blank">FastAPI</a>'s little sibling. And it's intended to be the FastAPI of CLIs.29**Typer** is <a href="https://fastapi.tiangolo.com" class="external-link" target="_blank">FastAPI</a>'s little sibling. And it's intended to be the FastAPI of CLIs.3031The key features are:3233* **Intuitive to write**: Great editor support. <abbr title="also known as auto-complete, autocompletion, IntelliSense">Completion</abbr> everywhere. Less time debugging. Designed to be easy to use and learn. Less time reading docs.
208 unmodified lines
242**You get**: great editor support, including **completion** and **type checks** everywhere.243244**Your users get**: automatic **`--help`**, (optional) **autocompletion** in their terminal (Bash, Zsh, Fish, PowerShell).245246For a more complete example including more features, see the <a href="https://typer.tiangolo.com/tutorial/intro/">Tutorial - User Guide</a>.246For a more complete example including more features, see the <a href="https://typer.tiangolo.com/tutorial/">Tutorial - User Guide</a>.247248## Optional Dependencies249250Typer uses <a href="https://click.palletsprojects.com/" class="external-link" target="_blank">Click</a> internally. That's the only dependency.
24 unmodified lines
modified:README.md+2 added-2 removed
24 unmodified lines
25---2627Typer is library to build <abbr title="command line interface, programs executed from a terminal">CLI</abbr> applications that users will love using and developers will love creating. Based on Python 3.6+ type hints.2829**Typer** is <a href="https://fastapi.tiangolo.com" target="_blank">FastAPI</a>'s little sibling. And it's intended to be the FastAPI of CLIs.29**Typer** is <a href="https://fastapi.tiangolo.com" class="external-link" target="_blank">FastAPI</a>'s little sibling. And it's intended to be the FastAPI of CLIs.3031The key features are:3233* **Intuitive to write**: Great editor support. <abbr title="also known as auto-complete, autocompletion, IntelliSense">Completion</abbr> everywhere. Less time debugging. Designed to be easy to use and learn. Less time reading docs.
208 unmodified lines
242**You get**: great editor support, including **completion** and **type checks** everywhere.243244**Your users get**: automatic **`--help`**, (optional) **autocompletion** in their terminal (Bash, Zsh, Fish, PowerShell).245246For a more complete example including more features, see the <a href="https://typer.tiangolo.com/tutorial/intro/">Tutorial - User Guide</a>.246For a more complete example including more features, see the <a href="https://typer.tiangolo.com/tutorial/">Tutorial - User Guide</a>.247248## Optional Dependencies249250Typer uses <a href="https://click.palletsprojects.com/" class="external-link" target="_blank">Click</a> internally. That's the only dependency.
24 unmodified lines