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

🔥 Drop support for Python 3.7 #830

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 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: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
python-version: [ "3.11" ]
include:
- os: ubuntu-latest
python-version: "3.7"
python-version: "3.8"
kinuax marked this conversation as resolved.
Show resolved Hide resolved
- os: macos-latest
python-version: "3.8"
- os: windows-latest
Expand Down
32 changes: 16 additions & 16 deletions docs/tutorial/arguments/help.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ Now that you also know how to use `typer.Argument()`, let's use it to add docume

You can use the `help` parameter to add a help text for a *CLI argument*:

=== "Python 3.7+"
=== "Python 3.8+"

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

=== "Python 3.7+ non-Annotated"
=== "Python 3.8+ non-Annotated"

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down Expand Up @@ -50,13 +50,13 @@ Options:

And of course, you can also combine that `help` with the <abbr title="a multi-line string as the first expression inside a function (not assigned to any variable) used for documentation">docstring</abbr>:

=== "Python 3.7+"
=== "Python 3.8+"

```Python hl_lines="5-8"
{!> ../docs_src/arguments/help/tutorial002_an.py!}
```

=== "Python 3.7+ non-Annotated"
=== "Python 3.8+ non-Annotated"

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down Expand Up @@ -90,13 +90,13 @@ Options:

If you have a *CLI argument* with a default value, like `"World"`:

=== "Python 3.7+"
=== "Python 3.8+"

```Python hl_lines="5"
{!> ../docs_src/arguments/help/tutorial003_an.py!}
```

=== "Python 3.7+ non-Annotated"
=== "Python 3.8+ non-Annotated"

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down Expand Up @@ -128,13 +128,13 @@ Options:

But you can disable that if you want to, with `show_default=False`:

=== "Python 3.7+"
=== "Python 3.8+"

```Python hl_lines="7"
{!> ../docs_src/arguments/help/tutorial004_an.py!}
```

=== "Python 3.7+ non-Annotated"
=== "Python 3.8+ non-Annotated"

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down Expand Up @@ -173,13 +173,13 @@ Options:

You can use the same `show_default` to pass a custom string (instead of a `bool`) to customize the default value to be shown in the help text:

=== "Python 3.7+"
=== "Python 3.8+"

```Python hl_lines="9"
{!> ../docs_src/arguments/help/tutorial005_an.py!}
```

=== "Python 3.7+ non-Annotated"
=== "Python 3.8+ non-Annotated"

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down Expand Up @@ -231,13 +231,13 @@ But you can customize it with the `metavar` parameter for `typer.Argument()`.

For example, let's say you don't want to have the default of `NAME`, you want to have `username`, in lowercase, and you really want ✨ emojis ✨ everywhere:

=== "Python 3.7+"
=== "Python 3.8+"

```Python hl_lines="5"
{!> ../docs_src/arguments/help/tutorial006_an.py!}
```

=== "Python 3.7+ non-Annotated"
=== "Python 3.8+ non-Annotated"

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down Expand Up @@ -270,13 +270,13 @@ You might want to show the help information for *CLI arguments* in different pan

If you have installed Rich as described in the docs for [Printing and Colors](../printing.md){.internal-link target=_blank}, you can set the `rich_help_panel` parameter to the name of the panel where you want this *CLI argument* to be shown:

=== "Python 3.7+"
=== "Python 3.8+"

```Python hl_lines="8 12"
{!> ../docs_src/arguments/help/tutorial007_an.py!}
```

=== "Python 3.7+ non-Annotated"
=== "Python 3.8+ non-Annotated"

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down Expand Up @@ -326,13 +326,13 @@ If you want, you can make a *CLI argument* **not** show up in the `Arguments` se

You will probably not want to do this normally, but it's possible:

=== "Python 3.7+"
=== "Python 3.8+"

```Python hl_lines="5"
{!> ../docs_src/arguments/help/tutorial008_an.py!}
```

=== "Python 3.7+ non-Annotated"
=== "Python 3.8+ non-Annotated"

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down
16 changes: 8 additions & 8 deletions docs/tutorial/options/callback-and-context.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ In those cases you can use a *CLI parameter* callback function.

For example, you could do some validation before the rest of the code is executed.

=== "Python 3.7+"
=== "Python 3.8+"

```Python hl_lines="7-10 13"
{!> ../docs_src/options/callback/tutorial001_an.py!}
```

=== "Python 3.7+ non-Annotated"
=== "Python 3.8+ non-Annotated"

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down Expand Up @@ -105,13 +105,13 @@ But the main **important point** is that it is all based on values printed by yo

Let's say that when the callback is running, we want to show a message saying that it's validating the name:

=== "Python 3.7+"
=== "Python 3.8+"

```Python hl_lines="8"
{!> ../docs_src/options/callback/tutorial002_an.py!}
```

=== "Python 3.7+ non-Annotated"
=== "Python 3.8+ non-Annotated"

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down Expand Up @@ -153,13 +153,13 @@ But you can access the context by declaring a function parameter of type `typer.

The "context" has some additional data about the current execution of your program:

=== "Python 3.7+"
=== "Python 3.8+"

```Python hl_lines="7-9"
{!> ../docs_src/options/callback/tutorial003_an.py!}
```

=== "Python 3.7+ non-Annotated"
=== "Python 3.8+ non-Annotated"

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down Expand Up @@ -198,13 +198,13 @@ Hello Camila

The same way you can access the `typer.Context` by declaring a function parameter with its value, you can declare another function parameter with type `typer.CallbackParam` to get the specific Click `Parameter` object.

=== "Python 3.7+"
=== "Python 3.8+"

```Python hl_lines="7 10"
{!> ../docs_src/options/callback/tutorial004_an.py!}
```

=== "Python 3.7+ non-Annotated"
=== "Python 3.8+ non-Annotated"

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down
16 changes: 8 additions & 8 deletions docs/tutorial/options/help.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ You already saw how to add a help text for *CLI arguments* with the `help` param

Let's now do the same for *CLI options*:

=== "Python 3.7+"
=== "Python 3.8+"

```Python hl_lines="7-8"
{!> ../docs_src/options/help/tutorial001_an.py!}
```

=== "Python 3.7+ non-Annotated"
=== "Python 3.8+ non-Annotated"

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down Expand Up @@ -67,13 +67,13 @@ The same as with *CLI arguments*, you can put the help for some *CLI options* in

If you have installed Rich as described in the docs for [Printing and Colors](../printing.md){.internal-link target=_blank}, you can set the `rich_help_panel` parameter to the name of the panel you want for each *CLI option*:

=== "Python 3.7+"
=== "Python 3.8+"

```Python hl_lines="11 17"
{!> ../docs_src/options/help/tutorial002_an.py!}
```

=== "Python 3.7+ non-Annotated"
=== "Python 3.8+ non-Annotated"

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down Expand Up @@ -126,13 +126,13 @@ If you are in a hurry you can jump there, but otherwise, it would be better to c

You can tell Typer to not show the default value in the help text with `show_default=False`:

=== "Python 3.7+"
=== "Python 3.8+"

```Python hl_lines="5"
{!> ../docs_src/options/help/tutorial003_an.py!}
```

=== "Python 3.7+ non-Annotated"
=== "Python 3.8+ non-Annotated"

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down Expand Up @@ -173,13 +173,13 @@ Options:

You can use the same `show_default` to pass a custom string (instead of a `bool`) to customize the default value to be shown in the help text:

=== "Python 3.7+"
=== "Python 3.8+"

```Python hl_lines="7"
{!> ../docs_src/options/help/tutorial004_an.py!}
```

=== "Python 3.7+ non-Annotated"
=== "Python 3.8+ non-Annotated"

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down
20 changes: 10 additions & 10 deletions docs/tutorial/options/name.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ Let's say the function parameter name is `user_name` as above, but you want the

You can pass the *CLI option* name that you want to have in the following positional argument passed to `typer.Option()`:

=== "Python 3.7+"
=== "Python 3.8+"

```Python hl_lines="5"
{!> ../docs_src/options/name/tutorial001_an.py!}
```

Here you are passing the string `"--name"` as the first positional argument to `typer.Option()`.

=== "Python 3.7+ non-Annotated"
=== "Python 3.8+ non-Annotated"

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down Expand Up @@ -194,13 +194,13 @@ You can overwrite the *CLI option* name to use as in the previous example, but y

For example, extending the previous example, let's add a *CLI option* short name `-n`:

=== "Python 3.7+"
=== "Python 3.8+"

```Python hl_lines="5"
{!> ../docs_src/options/name/tutorial002_an.py!}
```

=== "Python 3.7+ non-Annotated"
=== "Python 3.8+ non-Annotated"

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down Expand Up @@ -238,13 +238,13 @@ Hello Camila

If you only declare a short name like `-n` then that will be the only *CLI option* name. And neither `--name` nor `--user-name` will be available.

=== "Python 3.7+"
=== "Python 3.8+"

```Python hl_lines="5"
{!> ../docs_src/options/name/tutorial003_an.py!}
```

=== "Python 3.7+ non-Annotated"
=== "Python 3.8+ non-Annotated"

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down Expand Up @@ -279,13 +279,13 @@ Hello Camila

Continuing with the example above, as **Typer** allows you to declare a *CLI option* as having only a short name, if you want to have the default long name plus a short name, you have to declare both explicitly:

=== "Python 3.7+"
=== "Python 3.8+"

```Python hl_lines="5"
{!> ../docs_src/options/name/tutorial004_an.py!}
```

=== "Python 3.7+ non-Annotated"
=== "Python 3.8+ non-Annotated"

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down Expand Up @@ -326,13 +326,13 @@ You can create multiple short names and use them together.

You don't have to do anything special for it to work (apart from declaring those short versions):

=== "Python 3.7+"
=== "Python 3.8+"

```Python hl_lines="6-7"
{!> ../docs_src/options/name/tutorial005_an.py!}
```

=== "Python 3.7+ non-Annotated"
=== "Python 3.8+ non-Annotated"

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down
8 changes: 4 additions & 4 deletions docs/tutorial/options/password.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
Apart from having a prompt, you can make a *CLI option* have a `confirmation_prompt=True`:

=== "Python 3.7+"
=== "Python 3.8+"

```Python hl_lines="7"
{!> ../docs_src/options/password/tutorial001_an.py!}
```

=== "Python 3.7+ non-Annotated"
=== "Python 3.8+ non-Annotated"

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down Expand Up @@ -41,13 +41,13 @@ You can achieve the same using `hide_input=True`.

And if you combine it with `confirmation_prompt=True` you can easily receive a password with double confirmation:

=== "Python 3.7+"
=== "Python 3.8+"

```Python hl_lines="8"
{!> ../docs_src/options/password/tutorial002_an.py!}
```

=== "Python 3.7+ non-Annotated"
=== "Python 3.8+ non-Annotated"

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down
Loading
Loading