Skip to content

Commit

Permalink
Merge branch 'master' into remove-group-name-from-callback
Browse files Browse the repository at this point in the history
  • Loading branch information
svlandeg authored Nov 19, 2024
2 parents 3e91df4 + 53e21fd commit f09b3c2
Show file tree
Hide file tree
Showing 61 changed files with 360 additions and 1,874 deletions.
17 changes: 17 additions & 0 deletions docs/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@

## Latest Changes

## 0.13.1

### Features

* ✨ Remove Rich tags when showing completion text. PR [#877](https://github.com/fastapi/typer/pull/877) by [@svlandeg](https://github.com/svlandeg).
* ✨ Render Rich markup as HTML in Markdown docs. PR [#847](https://github.com/fastapi/typer/pull/847) by [@svlandeg](https://github.com/svlandeg).
* ✨ Support cp850 encoding for auto-completion in PowerShell. PR [#808](https://github.com/fastapi/typer/pull/808) by [@svlandeg](https://github.com/svlandeg).
* ✨ Allow gettext translation of help message. PR [#886](https://github.com/fastapi/typer/pull/886) by [@svlandeg](https://github.com/svlandeg).

### Refactors

* 🐛 Fix printing HTML from Rich output. PR [#1055](https://github.com/fastapi/typer/pull/1055) by [@tiangolo](https://github.com/tiangolo).

### Docs

* 📝 Update markdown includes to use the new simpler format. PR [#1054](https://github.com/fastapi/typer/pull/1054) by [@tiangolo](https://github.com/tiangolo).

### Internal

* ⬆ Bump ruff from 0.7.3 to 0.7.4. PR [#1051](https://github.com/fastapi/typer/pull/1051) by [@dependabot[bot]](https://github.com/apps/dependabot).
Expand Down
4 changes: 1 addition & 3 deletions docs/tutorial/app-dir.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

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

```Python hl_lines="9"
{!../docs_src/app_dir/tutorial001.py!}
```
{* docs_src/app_dir/tutorial001.py hl[9] *}

It will give you a directory for storing configurations appropriate for your CLI program for the current user in each operating system.

Expand Down
44 changes: 2 additions & 42 deletions docs/tutorial/arguments/default.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,7 @@ That way the *CLI argument* will be optional *and also* have a default value.

We can also use `typer.Argument()` to make a *CLI argument* have a default value other than `None`:

//// tab | Python 3.7+

```Python hl_lines="5"
{!> ../docs_src/arguments/default/tutorial001_an.py!}
```

////

//// tab | Python 3.7+ non-Annotated

/// tip

Prefer to use the `Annotated` version if possible.

///

```Python hl_lines="4"
{!> ../docs_src/arguments/default/tutorial001.py!}
```

////
{* docs_src/arguments/default/tutorial001_an.py hl[5] *}

/// tip

Expand Down Expand Up @@ -72,27 +52,7 @@ Hello Camila

And we can even make the default value be dynamically generated by passing a function as the `default_factory` argument:

//// tab | Python 3.7+

```Python hl_lines="7-8 11"
{!> ../docs_src/arguments/default/tutorial002_an.py!}
```

////

//// tab | Python 3.7+ non-Annotated

/// tip

Prefer to use the `Annotated` version if possible.

///

```Python hl_lines="6-7 10"
{!> ../docs_src/arguments/default/tutorial002.py!}
```

////
{* docs_src/arguments/default/tutorial002_an.py hl[7:8,11] *}

In this case, we created the function `get_name` that will just return a random `str` each time.

Expand Down
66 changes: 3 additions & 63 deletions docs/tutorial/arguments/envvar.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,27 +10,7 @@ You can learn more about environment variables in the [Environment Variables](..

To do that, use the `envvar` parameter for `typer.Argument()`:

//// tab | Python 3.7+

```Python hl_lines="5"
{!> ../docs_src/arguments/envvar/tutorial001_an.py!}
```

////

//// tab | Python 3.7+ non-Annotated

/// tip

Prefer to use the `Annotated` version if possible.

///

```Python hl_lines="4"
{!> ../docs_src/arguments/envvar/tutorial001.py!}
```

////
{* docs_src/arguments/envvar/tutorial001_an.py hl[5] *}

In this case, the *CLI argument* `name` will have a default value of `"World"`, but will also read any value passed to the environment variable `AWESOME_NAME` if no value is provided in the command line:

Expand Down Expand Up @@ -75,27 +55,7 @@ Hello Mr. Czernobog

You are not restricted to a single environment variable, you can declare a list of environment variables that could be used to get a value if it was not passed in the command line:

//// tab | Python 3.7+

```Python hl_lines="6"
{!> ../docs_src/arguments/envvar/tutorial002_an.py!}
```

////

//// tab | Python 3.7+ non-Annotated

/// tip

Prefer to use the `Annotated` version if possible.

///

```Python hl_lines="4"
{!> ../docs_src/arguments/envvar/tutorial002.py!}
```

////
{* docs_src/arguments/envvar/tutorial002_an.py hl[6] *}

Check it:

Expand Down Expand Up @@ -130,27 +90,7 @@ Hello Mr. Anubis

By default, environment variables used will be shown in the help text, but you can disable them with `show_envvar=False`:

//// tab | Python 3.7+

```Python hl_lines="7"
{!> ../docs_src/arguments/envvar/tutorial003_an.py!}
```

////

//// tab | Python 3.7+ non-Annotated

/// tip

Prefer to use the `Annotated` version if possible.

///

```Python hl_lines="4"
{!> ../docs_src/arguments/envvar/tutorial003.py!}
```

////
{* docs_src/arguments/envvar/tutorial003_an.py hl[7] *}

Check it:

Expand Down
Loading

0 comments on commit f09b3c2

Please sign in to comment.