Skip to content

Commit f2d39b8

Browse files
committed
refactor: Drop support for Python 3.8
1 parent 48ad843 commit f2d39b8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+129
-117
lines changed

.copier-answers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier
2-
_commit: 1.4.6
2+
_commit: 1.4.7
33
_src_path: gh:pawamoy/copier-uv
44
author_email: [email protected]
55
author_fullname: Timothée Mazzucotelli

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,11 +75,11 @@ jobs:
7575
echo 'jobs=[
7676
{"os": "macos-latest"},
7777
{"os": "windows-latest"},
78-
{"python-version": "3.9"},
7978
{"python-version": "3.10"},
8079
{"python-version": "3.11"},
8180
{"python-version": "3.12"},
82-
{"python-version": "3.13"}
81+
{"python-version": "3.13"},
82+
{"python-version": "3.14"}
8383
]' | tr -d '[:space:]' >> $GITHUB_OUTPUT
8484
else
8585
echo 'jobs=[
@@ -100,18 +100,18 @@ jobs:
100100
- macos-latest
101101
- windows-latest
102102
python-version:
103-
- "3.8"
104103
- "3.9"
105104
- "3.10"
106105
- "3.11"
107106
- "3.12"
108107
- "3.13"
108+
- "3.14"
109109
resolution:
110110
- highest
111111
- lowest-direct
112112
exclude: ${{ fromJSON(needs.exclude-test-jobs.outputs.jobs) }}
113113
runs-on: ${{ matrix.os }}
114-
continue-on-error: ${{ matrix.python-version == '3.13' }}
114+
continue-on-error: ${{ matrix.python-version == '3.14' }}
115115

116116
steps:
117117
- name: Checkout

.gitpod.dockerfile

Lines changed: 0 additions & 6 deletions
This file was deleted.

.gitpod.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ We provide a guide for contributors. If you are reading this locally or directly
1010
- Development workflow: [docs/guide/contributors/workflow.md](docs/guide/contributors/workflow.md)
1111
- Project architecture: [docs/guide/contributors/architecture.md](docs/guide/contributors/architecture.md)
1212

13-
However we strongly recommend reading the online version at https://mkdocstrings.github.io/griffe/guide/contributors/, as some content is dynamically generated when building the documentation pages.
13+
We strongly recommend reading the online version at https://mkdocstrings.github.io/griffe/guide/contributors/, as some content is dynamically generated when building the documentation pages.

README.md

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,14 @@ but also "signature" in a familiar way. "On reconnaît bien là sa griffe."
1919

2020
## Installation
2121

22-
With `pip`:
23-
2422
```bash
2523
pip install griffe
2624
```
2725

28-
With [`pipx`](https://github.com/pipxproject/pipx):
26+
With [`uv`](https://docs.astral.sh/uv/):
2927

3028
```bash
31-
python3.8 -m pip install --user pipx
32-
pipx install griffe
29+
uv tool install griffe
3330
```
3431

3532
## Usage

config/ruff.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
target-version = "py38"
1+
target-version = "py39"
22
line-length = 120
33

44
[lint]

duties.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88
from functools import partial
99
from importlib.metadata import version as pkgversion
1010
from pathlib import Path
11-
from typing import TYPE_CHECKING, Iterator
11+
from typing import TYPE_CHECKING
1212

1313
from duty import duty, tools
1414

1515
if TYPE_CHECKING:
16+
from collections.abc import Iterator
17+
1618
from duty.context import Context
1719

1820

pyproject.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ description = "Signatures for entire Python programs. Extract the structure, the
88
authors = [{name = "Timothée Mazzucotelli", email = "[email protected]"}]
99
license = {text = "ISC"}
1010
readme = "README.md"
11-
# YORE: EOL 3.8: Remove `3.8` with `3.9` within line.
12-
requires-python = ">=3.8"
11+
requires-python = ">=3.9"
1312
keywords = ["api", "signature", "breaking-changes", "static-analysis", "dynamic-analysis"]
1413
dynamic = ["version"]
1514
classifiers = [
@@ -18,8 +17,6 @@ classifiers = [
1817
"Programming Language :: Python",
1918
"Programming Language :: Python :: 3",
2019
"Programming Language :: Python :: 3 :: Only",
21-
# YORE: EOL 3.8: Remove line.
22-
"Programming Language :: Python :: 3.8",
2320
# YORE: EOL 3.9: Remove line.
2421
"Programming Language :: Python :: 3.9",
2522
# YORE: EOL 3.10: Remove line.
@@ -30,6 +27,8 @@ classifiers = [
3027
"Programming Language :: Python :: 3.12",
3128
# YORE: EOL 3.13: Remove line.
3229
"Programming Language :: Python :: 3.13",
30+
# YORE: EOL 3.14: Remove line.
31+
"Programming Language :: Python :: 3.14",
3332
"Topic :: Documentation",
3433
"Topic :: Software Development",
3534
"Topic :: Software Development :: Documentation",
@@ -87,7 +86,7 @@ dev-dependencies = [
8786
# maintenance
8887
"build>=1.2",
8988
"git-changelog>=2.5",
90-
"twine>=5.0; python_version < '3.13'",
89+
"twine>=5.1",
9190

9291
# ci
9392
"duty>=1.4",
@@ -120,5 +119,6 @@ dev-dependencies = [
120119
"mkdocs-redirects>=1.2",
121120
"mkdocstrings[python]>=0.25",
122121
"pydeps>=1.12",
122+
# YORE: EOL 3.10: Remove line.
123123
"tomli>=2.0; python_version < '3.11'",
124124
]

scripts/gen_credits.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55
import os
66
import sys
77
from collections import defaultdict
8+
from collections.abc import Iterable
89
from importlib.metadata import distributions
910
from itertools import chain
1011
from pathlib import Path
1112
from textwrap import dedent
12-
from typing import Dict, Iterable, Union
13+
from typing import Union
1314

1415
from jinja2 import StrictUndefined
1516
from jinja2.sandbox import SandboxedEnvironment
@@ -28,8 +29,8 @@
2829
project_name = project["name"]
2930
devdeps = [dep for dep in pyproject["tool"]["uv"]["dev-dependencies"] if not dep.startswith("-e")]
3031

31-
PackageMetadata = Dict[str, Union[str, Iterable[str]]]
32-
Metadata = Dict[str, PackageMetadata]
32+
PackageMetadata = dict[str, Union[str, Iterable[str]]]
33+
Metadata = dict[str, PackageMetadata]
3334

3435

3536
def _merge_fields(metadata: dict) -> PackageMetadata:

scripts/insiders.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,16 @@
1010
from datetime import date, datetime, timedelta
1111
from itertools import chain
1212
from pathlib import Path
13-
from typing import Iterable, cast
13+
from typing import TYPE_CHECKING, cast
1414
from urllib.error import HTTPError
1515
from urllib.parse import urljoin
1616
from urllib.request import urlopen
1717

1818
import yaml
1919

20+
if TYPE_CHECKING:
21+
from collections.abc import Iterable
22+
2023
logger = logging.getLogger(f"mkdocs.logs.{__name__}")
2124

2225

scripts/make.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,12 @@
99
import sys
1010
from contextlib import contextmanager
1111
from pathlib import Path
12-
from typing import Any, Callable, Iterator
12+
from typing import TYPE_CHECKING, Any, Callable
1313

14-
PYTHON_VERSIONS = os.getenv("PYTHON_VERSIONS", "3.8 3.9 3.10 3.11 3.12 3.13").split()
14+
if TYPE_CHECKING:
15+
from collections.abc import Iterator
16+
17+
PYTHON_VERSIONS = os.getenv("PYTHON_VERSIONS", "3.9 3.10 3.11 3.12 3.13 3.14").split()
1518

1619
_commands = []
1720

src/_griffe/agents/inspector.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from inspect import Parameter as SignatureParameter
88
from inspect import Signature, cleandoc, getsourcelines
99
from inspect import signature as getsignature
10-
from typing import TYPE_CHECKING, Any, Sequence
10+
from typing import TYPE_CHECKING, Any
1111

1212
from _griffe.agents.nodes.runtime import ObjectNode
1313
from _griffe.collections import LinesCollection, ModulesCollection
@@ -19,6 +19,7 @@
1919
from _griffe.models import Alias, Attribute, Class, Docstring, Function, Module, Parameter, Parameters
2020

2121
if TYPE_CHECKING:
22+
from collections.abc import Sequence
2223
from pathlib import Path
2324

2425
from _griffe.enumerations import Parser

src/_griffe/agents/nodes/ast.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,13 @@
33
from __future__ import annotations
44

55
from ast import AST
6-
from typing import Iterator
6+
from typing import TYPE_CHECKING
77

88
from _griffe.exceptions import LastNodeError
99

10+
if TYPE_CHECKING:
11+
from collections.abc import Iterator
12+
1013

1114
def ast_kind(node: AST) -> str:
1215
"""Return the kind of an AST node.

src/_griffe/agents/nodes/parameters.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@
44

55
import ast
66
from itertools import zip_longest
7-
from typing import Iterable, List, Optional, Tuple, Union
7+
from typing import TYPE_CHECKING, Optional, Union
88

99
from _griffe.enumerations import ParameterKind
1010

11-
ParametersType = List[Tuple[str, Optional[ast.AST], ParameterKind, Optional[Union[str, ast.AST]]]]
11+
if TYPE_CHECKING:
12+
from collections.abc import Iterable
13+
14+
ParametersType = list[tuple[str, Optional[ast.AST], ParameterKind, Optional[Union[str, ast.AST]]]]
1215
"""Type alias for the list of parameters of a function."""
1316

1417

src/_griffe/agents/nodes/runtime.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@
55
import inspect
66
import sys
77
from functools import cached_property
8-
from typing import Any, ClassVar, Sequence
8+
from typing import TYPE_CHECKING, Any, ClassVar
99

1010
from _griffe.enumerations import ObjectKind
1111
from _griffe.logger import logger
1212

13+
if TYPE_CHECKING:
14+
from collections.abc import Sequence
15+
1316
_builtin_module_names = {_.lstrip("_") for _ in sys.builtin_module_names}
1417
_cyclic_relationships = {
1518
("os", "nt"),
@@ -19,7 +22,6 @@
1922

2023

2124
def _same_components(a: str, b: str, /) -> bool:
22-
# YORE: EOL 3.8: Replace `lstrip` with `removeprefix` within line.
2325
return [cpn.lstrip("_") for cpn in a.split(".")] == [cpn.lstrip("_") for cpn in b.split(".")]
2426

2527

src/_griffe/agents/nodes/values.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,11 @@
33
from __future__ import annotations
44

55
import ast
6-
import sys
6+
from ast import unparse
77
from typing import TYPE_CHECKING
88

99
from _griffe.logger import logger
1010

11-
# YORE: EOL 3.8: Replace block with line 4.
12-
if sys.version_info < (3, 9):
13-
from astunparse import unparse
14-
else:
15-
from ast import unparse
16-
1711
if TYPE_CHECKING:
1812
from pathlib import Path
1913

src/_griffe/c3linear.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@
77

88
from __future__ import annotations
99

10+
from collections import deque
1011
from itertools import islice
11-
from typing import Deque, TypeVar
12+
from typing import TypeVar
1213

1314
_T = TypeVar("_T")
1415

1516

16-
class _Dependency(Deque[_T]):
17+
class _Dependency(deque[_T]):
1718
"""A class representing a (doubly-ended) queue of items."""
1819

1920
@property

src/_griffe/cli.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import sys
2020
from datetime import datetime, timezone
2121
from pathlib import Path
22-
from typing import IO, TYPE_CHECKING, Any, Callable, Sequence
22+
from typing import IO, TYPE_CHECKING, Any, Callable
2323

2424
import colorama
2525

@@ -34,6 +34,8 @@
3434
from _griffe.logger import logger
3535

3636
if TYPE_CHECKING:
37+
from collections.abc import Sequence
38+
3739
from _griffe.extensions.base import Extension, Extensions
3840

3941

src/_griffe/collections.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33

44
from __future__ import annotations
55

6-
from typing import TYPE_CHECKING, Any, ItemsView, KeysView, ValuesView
6+
from typing import TYPE_CHECKING, Any
77

88
from _griffe.mixins import DelMembersMixin, GetMembersMixin, SetMembersMixin
99

1010
if TYPE_CHECKING:
11+
from collections.abc import ItemsView, KeysView, ValuesView
1112
from pathlib import Path
1213

1314
from _griffe.models import Module

src/_griffe/diff.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
import contextlib
1212
from pathlib import Path
13-
from typing import TYPE_CHECKING, Any, Iterable, Iterator
13+
from typing import TYPE_CHECKING, Any
1414

1515
from colorama import Fore, Style
1616

@@ -20,6 +20,8 @@
2020
from _griffe.logger import logger
2121

2222
if TYPE_CHECKING:
23+
from collections.abc import Iterable, Iterator
24+
2325
from _griffe.models import Alias, Attribute, Class, Function, Object
2426

2527
_POSITIONAL = frozenset((ParameterKind.positional_only, ParameterKind.positional_or_keyword))

0 commit comments

Comments
 (0)