Skip to content

Commit

Permalink
refactor: Drop support for Python 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Oct 11, 2024
1 parent 48ad843 commit f2d39b8
Show file tree
Hide file tree
Showing 42 changed files with 129 additions and 117 deletions.
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Changes here will be overwritten by Copier
_commit: 1.4.6
_commit: 1.4.7
_src_path: gh:pawamoy/copier-uv
author_email: dev@pawamoy.fr
author_fullname: Timothée Mazzucotelli
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,11 @@ jobs:
echo 'jobs=[
{"os": "macos-latest"},
{"os": "windows-latest"},
{"python-version": "3.9"},
{"python-version": "3.10"},
{"python-version": "3.11"},
{"python-version": "3.12"},
{"python-version": "3.13"}
{"python-version": "3.13"},
{"python-version": "3.14"}
]' | tr -d '[:space:]' >> $GITHUB_OUTPUT
else
echo 'jobs=[
Expand All @@ -100,18 +100,18 @@ jobs:
- macos-latest
- windows-latest
python-version:
- "3.8"
- "3.9"
- "3.10"
- "3.11"
- "3.12"
- "3.13"
- "3.14"
resolution:
- highest
- lowest-direct
exclude: ${{ fromJSON(needs.exclude-test-jobs.outputs.jobs) }}
runs-on: ${{ matrix.os }}
continue-on-error: ${{ matrix.python-version == '3.13' }}
continue-on-error: ${{ matrix.python-version == '3.14' }}

steps:
- name: Checkout
Expand Down
6 changes: 0 additions & 6 deletions .gitpod.dockerfile

This file was deleted.

13 changes: 0 additions & 13 deletions .gitpod.yml

This file was deleted.

2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ We provide a guide for contributors. If you are reading this locally or directly
- Development workflow: [docs/guide/contributors/workflow.md](docs/guide/contributors/workflow.md)
- Project architecture: [docs/guide/contributors/architecture.md](docs/guide/contributors/architecture.md)

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.
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.
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,14 @@ but also "signature" in a familiar way. "On reconnaît bien là sa griffe."

## Installation

With `pip`:

```bash
pip install griffe
```

With [`pipx`](https://github.com/pipxproject/pipx):
With [`uv`](https://docs.astral.sh/uv/):

```bash
python3.8 -m pip install --user pipx
pipx install griffe
uv tool install griffe
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion config/ruff.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
target-version = "py38"
target-version = "py39"
line-length = 120

[lint]
Expand Down
4 changes: 3 additions & 1 deletion duties.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@
from functools import partial
from importlib.metadata import version as pkgversion
from pathlib import Path
from typing import TYPE_CHECKING, Iterator
from typing import TYPE_CHECKING

from duty import duty, tools

if TYPE_CHECKING:
from collections.abc import Iterator

from duty.context import Context


Expand Down
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,7 @@ description = "Signatures for entire Python programs. Extract the structure, the
authors = [{name = "Timothée Mazzucotelli", email = "dev@pawamoy.fr"}]
license = {text = "ISC"}
readme = "README.md"
# YORE: EOL 3.8: Remove `3.8` with `3.9` within line.
requires-python = ">=3.8"
requires-python = ">=3.9"
keywords = ["api", "signature", "breaking-changes", "static-analysis", "dynamic-analysis"]
dynamic = ["version"]
classifiers = [
Expand All @@ -18,8 +17,6 @@ classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
# YORE: EOL 3.8: Remove line.
"Programming Language :: Python :: 3.8",
# YORE: EOL 3.9: Remove line.
"Programming Language :: Python :: 3.9",
# YORE: EOL 3.10: Remove line.
Expand All @@ -30,6 +27,8 @@ classifiers = [
"Programming Language :: Python :: 3.12",
# YORE: EOL 3.13: Remove line.
"Programming Language :: Python :: 3.13",
# YORE: EOL 3.14: Remove line.
"Programming Language :: Python :: 3.14",
"Topic :: Documentation",
"Topic :: Software Development",
"Topic :: Software Development :: Documentation",
Expand Down Expand Up @@ -87,7 +86,7 @@ dev-dependencies = [
# maintenance
"build>=1.2",
"git-changelog>=2.5",
"twine>=5.0; python_version < '3.13'",
"twine>=5.1",

# ci
"duty>=1.4",
Expand Down Expand Up @@ -120,5 +119,6 @@ dev-dependencies = [
"mkdocs-redirects>=1.2",
"mkdocstrings[python]>=0.25",
"pydeps>=1.12",
# YORE: EOL 3.10: Remove line.
"tomli>=2.0; python_version < '3.11'",
]
7 changes: 4 additions & 3 deletions scripts/gen_credits.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,12 @@
import os
import sys
from collections import defaultdict
from collections.abc import Iterable
from importlib.metadata import distributions
from itertools import chain
from pathlib import Path
from textwrap import dedent
from typing import Dict, Iterable, Union
from typing import Union

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

PackageMetadata = Dict[str, Union[str, Iterable[str]]]
Metadata = Dict[str, PackageMetadata]
PackageMetadata = dict[str, Union[str, Iterable[str]]]
Metadata = dict[str, PackageMetadata]


def _merge_fields(metadata: dict) -> PackageMetadata:
Expand Down
5 changes: 4 additions & 1 deletion scripts/insiders.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,16 @@
from datetime import date, datetime, timedelta
from itertools import chain
from pathlib import Path
from typing import Iterable, cast
from typing import TYPE_CHECKING, cast
from urllib.error import HTTPError
from urllib.parse import urljoin
from urllib.request import urlopen

import yaml

if TYPE_CHECKING:
from collections.abc import Iterable

logger = logging.getLogger(f"mkdocs.logs.{__name__}")


Expand Down
7 changes: 5 additions & 2 deletions scripts/make.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,12 @@
import sys
from contextlib import contextmanager
from pathlib import Path
from typing import Any, Callable, Iterator
from typing import TYPE_CHECKING, Any, Callable

PYTHON_VERSIONS = os.getenv("PYTHON_VERSIONS", "3.8 3.9 3.10 3.11 3.12 3.13").split()
if TYPE_CHECKING:
from collections.abc import Iterator

PYTHON_VERSIONS = os.getenv("PYTHON_VERSIONS", "3.9 3.10 3.11 3.12 3.13 3.14").split()

_commands = []

Expand Down
3 changes: 2 additions & 1 deletion src/_griffe/agents/inspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from inspect import Parameter as SignatureParameter
from inspect import Signature, cleandoc, getsourcelines
from inspect import signature as getsignature
from typing import TYPE_CHECKING, Any, Sequence
from typing import TYPE_CHECKING, Any

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

if TYPE_CHECKING:
from collections.abc import Sequence
from pathlib import Path

from _griffe.enumerations import Parser
Expand Down
5 changes: 4 additions & 1 deletion src/_griffe/agents/nodes/ast.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
from __future__ import annotations

from ast import AST
from typing import Iterator
from typing import TYPE_CHECKING

from _griffe.exceptions import LastNodeError

if TYPE_CHECKING:
from collections.abc import Iterator


def ast_kind(node: AST) -> str:
"""Return the kind of an AST node.
Expand Down
7 changes: 5 additions & 2 deletions src/_griffe/agents/nodes/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,14 @@

import ast
from itertools import zip_longest
from typing import Iterable, List, Optional, Tuple, Union
from typing import TYPE_CHECKING, Optional, Union

from _griffe.enumerations import ParameterKind

ParametersType = List[Tuple[str, Optional[ast.AST], ParameterKind, Optional[Union[str, ast.AST]]]]
if TYPE_CHECKING:
from collections.abc import Iterable

ParametersType = list[tuple[str, Optional[ast.AST], ParameterKind, Optional[Union[str, ast.AST]]]]
"""Type alias for the list of parameters of a function."""


Expand Down
6 changes: 4 additions & 2 deletions src/_griffe/agents/nodes/runtime.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,14 @@
import inspect
import sys
from functools import cached_property
from typing import Any, ClassVar, Sequence
from typing import TYPE_CHECKING, Any, ClassVar

from _griffe.enumerations import ObjectKind
from _griffe.logger import logger

if TYPE_CHECKING:
from collections.abc import Sequence

_builtin_module_names = {_.lstrip("_") for _ in sys.builtin_module_names}
_cyclic_relationships = {
("os", "nt"),
Expand All @@ -19,7 +22,6 @@


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


Expand Down
8 changes: 1 addition & 7 deletions src/_griffe/agents/nodes/values.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,11 @@
from __future__ import annotations

import ast
import sys
from ast import unparse
from typing import TYPE_CHECKING

from _griffe.logger import logger

# YORE: EOL 3.8: Replace block with line 4.
if sys.version_info < (3, 9):
from astunparse import unparse
else:
from ast import unparse

if TYPE_CHECKING:
from pathlib import Path

Expand Down
5 changes: 3 additions & 2 deletions src/_griffe/c3linear.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@

from __future__ import annotations

from collections import deque
from itertools import islice
from typing import Deque, TypeVar
from typing import TypeVar

_T = TypeVar("_T")


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

@property
Expand Down
4 changes: 3 additions & 1 deletion src/_griffe/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import sys
from datetime import datetime, timezone
from pathlib import Path
from typing import IO, TYPE_CHECKING, Any, Callable, Sequence
from typing import IO, TYPE_CHECKING, Any, Callable

import colorama

Expand All @@ -34,6 +34,8 @@
from _griffe.logger import logger

if TYPE_CHECKING:
from collections.abc import Sequence

from _griffe.extensions.base import Extension, Extensions


Expand Down
3 changes: 2 additions & 1 deletion src/_griffe/collections.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@

from __future__ import annotations

from typing import TYPE_CHECKING, Any, ItemsView, KeysView, ValuesView
from typing import TYPE_CHECKING, Any

from _griffe.mixins import DelMembersMixin, GetMembersMixin, SetMembersMixin

if TYPE_CHECKING:
from collections.abc import ItemsView, KeysView, ValuesView
from pathlib import Path

from _griffe.models import Module
Expand Down
4 changes: 3 additions & 1 deletion src/_griffe/diff.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

import contextlib
from pathlib import Path
from typing import TYPE_CHECKING, Any, Iterable, Iterator
from typing import TYPE_CHECKING, Any

from colorama import Fore, Style

Expand All @@ -20,6 +20,8 @@
from _griffe.logger import logger

if TYPE_CHECKING:
from collections.abc import Iterable, Iterator

from _griffe.models import Alias, Attribute, Class, Function, Object

_POSITIONAL = frozenset((ParameterKind.positional_only, ParameterKind.positional_or_keyword))
Expand Down
Loading

0 comments on commit f2d39b8

Please sign in to comment.