Skip to content

Commit

Permalink
🔥 Remove support for Python 3.6 (#758)
Browse files Browse the repository at this point in the history
  • Loading branch information
tiangolo authored Mar 23, 2024
1 parent 2b29e98 commit 13404a0
Show file tree
Hide file tree
Showing 37 changed files with 180 additions and 246 deletions.
9 changes: 2 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
runs-on: ubuntu-20.04
strategy:
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
click-version:
- click-7
- click-8
Expand All @@ -27,17 +27,12 @@ jobs:
- name: Install Flit
run: pip install flit
- name: Install Dependencies
if: ${{ matrix.python-version != '3.6' }}
run: python -m flit install --symlink
- name: Install Dependencies
if: ${{ matrix.python-version == '3.6' }}
# This doesn't install the editable install, so coverage doesn't get subprocesses
run: python -m pip install ".[test]"
- name: Install Click 7
if: matrix.click-version == 'click-7'
run: pip install "click<8.0.0"
- name: Lint
if: ${{ matrix.python-version != '3.6' && matrix.click-version == 'click-8' }}
if: ${{ matrix.click-version == 'click-8' }}
run: bash scripts/lint.sh
- run: mkdir coverage
- name: Test
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
.vscode
*.pyc
__pycache__
env3.7
env3.6
.venv*
env
dist
.mypy_cache
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

---

Typer is a library for building <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.
Typer is a library for building <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 type hints.

The key features are:

Expand All @@ -46,8 +46,6 @@ And it's intended to be the FastAPI of CLIs.

## Requirements

Python 3.6+

**Typer** stands on the shoulders of a giant. Its only internal dependency is <a href="https://click.palletsprojects.com/" class="external-link" target="_blank">Click</a>.

## Installation
Expand Down Expand Up @@ -277,7 +275,7 @@ You do that with standard modern Python types.

You don't have to learn a new syntax, the methods or classes of a specific library, etc.

Just standard **Python 3.6+**.
Just standard **Python**.

For example, for an `int`:

Expand Down
2 changes: 1 addition & 1 deletion docs/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ It follows the same design and ideas. If you know **FastAPI**, you already know

## Just Modern Python

It's all based on standard **Python 3.6 type** declarations. No new syntax to learn. Just standard modern Python.
It's all based on standard **Python type** declarations. No new syntax to learn. Just standard modern Python.

If 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>.

Expand Down
6 changes: 2 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

---

Typer is a library for building <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.
Typer is a library for building <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 type hints.

The key features are:

Expand All @@ -46,8 +46,6 @@ And it's intended to be the FastAPI of CLIs.

## Requirements

Python 3.6+

**Typer** stands on the shoulders of a giant. Its only internal dependency is <a href="https://click.palletsprojects.com/" class="external-link" target="_blank">Click</a>.

## Installation
Expand Down Expand Up @@ -277,7 +275,7 @@ You do that with standard modern Python types.

You don't have to learn a new syntax, the methods or classes of a specific library, etc.

Just standard **Python 3.6+**.
Just standard **Python**.

For example, for an `int`:

Expand Down
8 changes: 4 additions & 4 deletions docs/tutorial/arguments/default.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ 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`:

=== "Python 3.6+"
=== "Python 3.7+"

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

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

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

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

=== "Python 3.6+"
=== "Python 3.7+"

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

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

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down
12 changes: 6 additions & 6 deletions docs/tutorial/arguments/envvar.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ You can also configure a *CLI argument* to read a value from an environment vari

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

=== "Python 3.6+"
=== "Python 3.7+"

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

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

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down Expand Up @@ -60,13 +60,13 @@ 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:

=== "Python 3.6+"
=== "Python 3.7+"

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

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

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

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

=== "Python 3.6+"
=== "Python 3.7+"

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

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

!!! tip
Prefer to use the `Annotated` version if possible.
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.6+"
=== "Python 3.7+"

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

=== "Python 3.6+ non-Annotated"
=== "Python 3.7+ 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.6+"
=== "Python 3.7+"

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

=== "Python 3.6+ non-Annotated"
=== "Python 3.7+ 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.6+"
=== "Python 3.7+"

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

=== "Python 3.6+ non-Annotated"
=== "Python 3.7+ 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.6+"
=== "Python 3.7+"

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

=== "Python 3.6+ non-Annotated"
=== "Python 3.7+ 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.6+"
=== "Python 3.7+"

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

=== "Python 3.6+ non-Annotated"
=== "Python 3.7+ 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.6+"
=== "Python 3.7+"

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

=== "Python 3.6+ non-Annotated"
=== "Python 3.7+ 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.6+"
=== "Python 3.7+"

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

=== "Python 3.6+ non-Annotated"
=== "Python 3.7+ 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.6+"
=== "Python 3.7+"

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

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

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down
18 changes: 9 additions & 9 deletions docs/tutorial/commands/help.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ The same as before, you can add help for the commands in the docstrings and the

And the `typer.Typer()` application receives a parameter `help` that you can pass with the main help text for your CLI program:

=== "Python 3.6+"
=== "Python 3.7+"

```Python hl_lines="4 9-11 22 26-30 43 47-51 60-62"
{!> ../docs_src/commands/help/tutorial001_an.py!}
```

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

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down Expand Up @@ -201,13 +201,13 @@ Then you can use more formatting in the docstrings and the `help` parameter for

If you set `rich_markup_mode="rich"` when creating the `typer.Typer()` app, you will be able to use <a href="https://rich.readthedocs.io/en/stable/markup.html" class="external-link" target="_blank">Rich Console Markup</a> in the docstring, and even in the help for the *CLI arguments* and options:

=== "Python 3.6+"
=== "Python 3.7+"

```Python hl_lines="4 10 14-16 21 24 27"
{!> ../docs_src/commands/help/tutorial004_an.py!}
```

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

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down Expand Up @@ -277,13 +277,13 @@ $ python main.py delete --help

If you set `rich_markup_mode="markdown"` when creating the `typer.Typer()` app, you will be able to use Markdown in the docstring:

=== "Python 3.6+"
=== "Python 3.7+"

```Python hl_lines="4 9 12-20 25 27-28"
{!> ../docs_src/commands/help/tutorial005_an.py!}
```

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

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down Expand Up @@ -363,7 +363,7 @@ If you installed <a href="https://rich.readthedocs.io/" class="external-link" ta

To set the panel for a command you can pass the argument `rich_help_panel` with the name of the panel you want to use:

=== "Python 3.6+"
=== "Python 3.7+"

```Python hl_lines="22 30 38 46"
{!> ../docs_src/commands/help/tutorial006.py!}
Expand Down Expand Up @@ -408,13 +408,13 @@ The same way, you can configure the panels for *CLI arguments* and *CLI options*

And of course, in the same application you can also set the `rich_help_panel` for commands.

=== "Python 3.6+"
=== "Python 3.7+"

```Python hl_lines="15 21 27 37"
{!> ../docs_src/commands/help/tutorial007_an.py!}
```

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

!!! tip
Prefer to use the `Annotated` version if possible.
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorial/commands/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ Commands can also have their own *CLI options*.

In fact, each command can have different *CLI arguments* and *CLI options*:

=== "Python 3.6+"
=== "Python 3.7+"

```Python hl_lines="8 14-17 27-29 38"
{!> ../docs_src/commands/options/tutorial001_an.py!}
```

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

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

0 comments on commit 13404a0

Please sign in to comment.