Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔧 Update MkDocs to have titles in Markdown files instead of config #913

Merged
merged 2 commits into from
Aug 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/alternatives.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Alternatives, Inspiration and Comparisons

What inspired **Typer**, how it compares to other alternatives and what it learned from them.

## Intro
Expand Down
2 changes: 2 additions & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Development - Contributing

First, you might want to see the basic ways to [help Typer and get help](help-typer.md){.internal-link target=_blank}.

## Developing
Expand Down
2 changes: 2 additions & 0 deletions docs/features.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Features

## Design based on **FastAPI**

<a href="https://fastapi.tiangolo.com" target="_blank"><img src="https://fastapi.tiangolo.com/img/logo-margin/logo-teal.png" style="width: 20%;"></a>
Expand Down
2 changes: 2 additions & 0 deletions docs/help-typer.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Help Typer - Get Help

Are you liking **Typer**?

Would you like to help Typer, other users, and the author?
Expand Down
2 changes: 2 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Release Notes

## Latest Changes

### Features
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/app-dir.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# CLI Application Directory

You can get the application directory where you can, for example, save configuration files with `typer.get_app_dir()`:

```Python hl_lines="9"
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/arguments/default.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# CLI Arguments with Default

We can also use the same `typer.Argument()` to set a default value.

That way the *CLI argument* will be optional *and also* have a default value.
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/arguments/envvar.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# CLI Arguments with Environment Variables

You can also configure a *CLI argument* to read a value from an environment variable if it is not provided in the command line as a *CLI argument*.

To do that, use the `envvar` parameter for `typer.Argument()`:
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/arguments/help.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# CLI Arguments with Help

In the *First Steps* section you saw how to add help for a CLI app/command by adding it to a function's <abbr title="a multi-line string as the first expression inside a function (not assigned to any variable) used for documentation">docstring</abbr>.

Here's how that last example looked like:
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/arguments/index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# CLI Arguments

In the next few sections we'll see some ways to modify how *CLI arguments* work.

We'll create optional *CLI arguments*, we'll add integrated help for *CLI arguments*, etc.
2 changes: 2 additions & 0 deletions docs/tutorial/arguments/optional.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Optional CLI Arguments

We said before that *by default*:

* *CLI options* are **optional**
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/arguments/other-uses.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Other uses

`typer.Argument()` has several other use cases. Such as for data validation, to enable other features, etc.

You will see about these use cases later in the docs.
2 changes: 2 additions & 0 deletions docs/tutorial/commands/arguments.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Command CLI Arguments

The same way as with a CLI application with a single command, subcommands (or just "commands") can also have their own *CLI arguments*:

```Python hl_lines="7 12"
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/commands/callback.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Typer Callback

When you create an `app = typer.Typer()` it works as a group of commands.

And you can create multiple commands with it.
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/commands/context.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Using the Context

When you create a **Typer** application it uses Click underneath. And every Click application has a special object called a <a href="https://click.palletsprojects.com/en/8.1.x/commands/#nested-handling-and-contexts" class="external-link" target="_blank">"Context"</a> that is normally hidden.

But you can access the context by declaring a function parameter of type `typer.Context`.
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/commands/help.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Command Help

The same as before, you can add help for the commands in the docstrings and the *CLI options*.

And the `typer.Typer()` application receives a parameter `help` that you can pass with the main help text for your CLI program:
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/commands/index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Commands

We have seen how to create a CLI program with possibly several *CLI options* and *CLI arguments*.

But **Typer** allows you to create CLI programs with several commands (also known as subcommands).
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/commands/name.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Custom Command Name

By default, the command names are generated from the function name.

So, if your function is something like:
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/commands/one-or-multiple.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# One or Multiple Commands

You might have noticed that if you create a single command, as in the first example:

```Python hl_lines="3 6 12"
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/commands/options.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Command CLI Options

Commands can also have their own *CLI options*.

In fact, each command can have different *CLI arguments* and *CLI options*:
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/first-steps.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# First Steps

## The simplest example

The simplest **Typer** file could look like this:
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Tutorial - User Guide

## Python types

If you need a refresher 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>.
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/launch.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Launching Applications

You can launch applications from your CLI program with `typer.launch()`.

It will launch the appropriate application depending on the URL or file type you pass it:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# CLI Arguments with Multiple Values

*CLI arguments* can also receive multiple values.

You can define the type of a *CLI argument* using `typing.List`.
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/multiple-values/index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Multiple Values

There are several ways to declare multiple values for *CLI options* and *CLI arguments*.

We'll see them in the next short sections.
2 changes: 2 additions & 0 deletions docs/tutorial/multiple-values/multiple-options.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Multiple CLI Options

You can declare a *CLI option* that can be used multiple times, and then get all the values.

For example, let's say you want to accept several users in a single execution.
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/multiple-values/options-with-multiple-values.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# CLI Options with Multiple Values

You can also declare a *CLI option* that takes several values of different types.

You can set the number of values and types to anything you want, but it has to be a fixed number of values.
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/options-autocompletion.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# CLI Option autocompletion

As you have seen, apps built with **Typer** have completion in your shell that works when you create a Python package or using the `typer` command.

It normally completes *CLI options*, *CLI arguments*, and subcommands (that you will learn about later).
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/options/callback-and-context.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# CLI Option Callback and Context

In some occasions you might want to have some custom logic for a specific *CLI parameter* (for a *CLI option* or *CLI argument*) that is executed with the value received from the terminal.

In those cases you can use a *CLI parameter* callback function.
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/options/help.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# CLI Options with Help

You already saw how to add a help text for *CLI arguments* with the `help` parameter.

Let's now do the same for *CLI options*:
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/options/index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# CLI Options

In the next short sections we will see how to modify *CLI options* using `typer.Option()`.

`typer.Option()` works very similarly to `typer.Argument()`, but has some extra features that we'll see next.
2 changes: 2 additions & 0 deletions docs/tutorial/options/name.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# CLI Option Name

By default **Typer** will create a *CLI option* name from the function parameter.

So, if you have a function with:
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/options/password.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Password CLI Option and Confirmation Prompt

Apart from having a prompt, you can make a *CLI option* have a `confirmation_prompt=True`:

//// tab | Python 3.7+
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/options/prompt.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# CLI Option Prompt

It's also possible to, instead of just showing an error, ask for the missing value with `prompt=True`:

//// tab | Python 3.7+
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/options/required.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Required CLI Options

We said before that *by default*:

* *CLI options* are **optional**
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/options/version.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Version CLI Option, `is_eager`

You could use a callback to implement a `--version` *CLI option*.

It would show the version of your CLI program and then it would terminate it. Even before any other *CLI parameter* is processed.
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/package.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Building a Package

When you create a CLI program with **Typer** you probably want to create your own Python package.

That's what allows your users to install it and have it as an independent program that they can use in their terminal.
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/parameter-types/bool.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Boolean CLI Options

We have seen some examples of *CLI options* with `bool`, and how **Typer** creates `--something` and `--no-something` automatically.

But we can customize those names.
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/parameter-types/custom-types.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Custom Types

You can easily use your own custom types in your **Typer** applications.

The way to do it is by providing a way to <abbr title="convert from some plain format, like the input text in the CLI, into Python objects">parse</abbr> input into your own types.
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/parameter-types/datetime.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# DateTime

You can specify a *CLI parameter* as a Python <a href="https://docs.python.org/3/library/datetime.html" class="external-link" target="_blank">`datetime`</a>.

Your function will receive a standard Python `datetime` object, and again, your editor will give you completion, etc.
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/parameter-types/enum.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Enum - Choices

To define a *CLI parameter* that can take a value from a predefined set of values you can use a standard Python <a href="https://docs.python.org/3/library/enum.html" class="external-link" target="_blank">`enum.Enum`</a>:

```Python hl_lines="1 6 7 8 9 12 13"
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/parameter-types/file.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# File

Apart from `Path` *CLI parameters* you can also declare some types of "files".

/// tip
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/parameter-types/index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# CLI Parameter Types

You can use several data types for the *CLI options* and *CLI arguments*, and you can add data validation requirements too.

## Data conversion
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/parameter-types/number.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Number

You can define numeric validations with `max` and `min` values for `int` and `float` *CLI parameters*:

//// tab | Python 3.7+
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/parameter-types/path.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Path

You can declare a *CLI parameter* to be a standard Python <a href="https://docs.python.org/3/library/pathlib.html#basic-use" class="external-link" target="_blank">`pathlib.Path`</a>.

This is what you would do for directory paths, file paths, etc:
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/parameter-types/uuid.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# UUID

/// info

A UUID is a <a href="https://en.wikipedia.org/wiki/Universally_unique_identifier" class="external-link" target="_blank">"Universally Unique Identifier"</a>.
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/printing.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Printing and Colors

You can use the normal `print()` to show information on the screen:

```Python hl_lines="5"
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/progressbar.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Progress Bar

If you are executing an operation that can take some time, you can inform it to the user. 🤓

## Progress Bar
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/prompt.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Ask with Prompt

When 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).

But if you absolutely need to ask for interactive information without using a *CLI option*, you can use `typer.prompt()`:
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/subcommands/add-typer.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Add Typer

We'll start with the core idea.

To add a `typer.Typer()` app inside of another.
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/subcommands/callback-override.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Sub-Typer Callback Override

When creating a **Typer** app you can define a callback function, it always executes and defines the *CLI arguments* and *CLI options* that go before a command.

When adding a Typer app inside of another, the sub-Typer can also have its own callback.
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/subcommands/index.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SubCommands - Command Groups

You read before how to create a program with [Commands](../commands/index.md){.internal-link target=_blank}.

Now we'll see how to create a *CLI program* with commands that have their own subcommands. Also known as command groups.
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/subcommands/name-and-help.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SubCommand Name and Help

When adding a Typer app to another we have seen how to set the `name` to use for the command.

For example to set the command to `users`:
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/subcommands/nested-subcommands.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Nested SubCommands

We'll now see how these same ideas can be extended for deeply nested commands.

Let's imagine that the same *CLI program* from the previous examples now needs to handle `lands`.
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/subcommands/single-file.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# SubCommands in a Single File

In some cases, it's possible that your application code needs to live on a single file.

You can still use the same ideas:
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/terminating.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Terminating

There are some cases where you might want to terminate a command at some point, and stop all subsequent execution.

It could be that your code determined that the program completed successfully, or it could be an operation aborted.
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/testing.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Testing

Testing **Typer** applications is very easy with <a href="https://docs.pytest.org/en/latest/" class="external-link" target="_blank">pytest</a>.

Let's say you have an application `app/main.py` with:
Expand Down
2 changes: 2 additions & 0 deletions docs/tutorial/using-click.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# Using Click

/// warning

This is a more advanced topic, if you are starting with **Typer**, feel free to skip it.
Expand Down
Loading
Loading