➖ Drop support for Python 3.8 (#1463)
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 GitHub · parent 2108ffc · Browse files · 3 files·+14 added−42 removed
This commit
State
Before adoption: this commit came in with the history the project adopted, so no landing records it.
Trailers
- Co-authored-by: Yurii Motov <yurii.motov.monte@gmail.com>
Diff stats
3 files+14 added−42 removed
- other:+14 added−42 removed
Provenance
- Commit
6c28962- Tree
fd8d11b- Author
Sebastián Ramírez <tiangolo@gmail.com>- Committer
GitHub <noreply@github.com>- Parent
2108ffc
3 files changed+14 added−42 removed
modified:.github/workflows/test.yml+2 added-4 removed
20 unmodified lines2122232425262526272825 unmodified lines5455565760585960616218 unmodified lines8182838487858687888938 unmodified lines20 unmodified lines matrix: os: [ ubuntu-latest, windows-latest, macos-latest ] python-version: [ "3.14" ] include: - os: macos-latest python-version: "3.8" - os: windows-latest python-version: "3.9" - os: ubuntu-latest python-version: "3.10"25 unmodified lines pyproject.toml - name: Install Dependencies run: uv pip install -r requirements-tests.txt - name: Lint if: matrix.python-version != '3.7' && matrix.python-version != '3.8' && matrix.python-version != '3.9' if: matrix.python-version != '3.9' run: bash scripts/lint.sh - run: mkdir coverage - run: bash ./scripts/test-files.sh - name: Test18 unmodified lines run: echo "$GITHUB_CONTEXT" - uses: actions/checkout@v6 - uses: actions/setup-python@v6 with: python-version: '3.8' python-version: '3.13' - name: Setup uv uses: astral-sh/setup-uv@v7 with: version: "0.4.15"38 unmodified linesmodified:typer/_typing.py+11 added-31 removed
1 # Copied from pydantic 1.9.2 (the latest version to support python 3.6.)2 # https://github.com/pydantic/pydantic/blob/v1.9.2/pydantic/typing.py3-# Reduced drastically to only include Typer-specific 3.8+ functionality3+# Reduced drastically to only include Typer-specific 3.9+ functionality4 # mypy: ignore-errors5 6 import sys7 from typing import (8+ Annotated,9 Any,10 Callable,11+ Literal,12 Optional,13 Tuple,14 Type,15 Union,16+ get_args,17+ get_origin,18+ get_type_hints,19 )20 16-if sys.version_info >= (3, 9):17- from typing import Annotated, Literal, get_args, get_origin, get_type_hints18-else:19- from typing_extensions import (20- Annotated,21- Literal,22- get_args,23- get_origin,24- get_type_hints,25- )26-21 if sys.version_info < (3, 10):22 23 def is_union(tp: Optional[Type[Any]]) -> bool:24 return tp is Union25 unmodified lines50 51 NONE_TYPES: Tuple[Any, Any, Any] = (None, NoneType, Literal[None])52 53 60-if sys.version_info[:2] == (3, 8):61- # We can use the fast implementation for 3.8 but there is a very weird bug62- # where it can fail for `Literal[None]`.63- # We just need to redefine a useless `Literal[None]` inside the function body to fix this54+def is_none_type(type_: Any) -> bool:55+ for none_type in NONE_TYPES:56+ if type_ is none_type:57+ return True58+ return False59 65- def is_none_type(type_: Any) -> bool:66- Literal[None] # fix edge case67- for none_type in NONE_TYPES:68- if type_ is none_type:69- return True70- return False60 72-else:73-74- def is_none_type(type_: Any) -> bool:75- for none_type in NONE_TYPES:76- if type_ is none_type:77- return True78- return False79-80-61 def is_callable_type(type_: Type[Any]) -> bool:62 return type_ is Callable or get_origin(type_) is Callable63 64 21 unmodified linesmodified:typer/rich_utils.py+1 added-7 removed
1 # Extracted and modified from https://github.com/ewels/rich-click2 3 import inspect4 import io5-import sys5 from collections import defaultdict6 from gettext import gettext as _7 from os import getenv9-from typing import Any, DefaultDict, Dict, Iterable, List, Optional, Union8+from typing import Any, DefaultDict, Dict, Iterable, List, Literal, Optional, Union9 10 import click11 from rich import box12 from rich.align import Align10 unmodified lines23 from rich.theme import Theme24 from rich.traceback import Traceback25 from typer.models import DeveloperExceptionConfig26 28-if sys.version_info >= (3, 9):29- from typing import Literal30-else:31- from typing_extensions import Literal32-27 # Default styles28 STYLE_OPTION = "bold cyan"29 STYLE_SWITCH = "bold green"30 STYLE_NEGATIVE_OPTION = "bold magenta"721 unmodified lines