Skip to content

Commit 6615c91

Browse files
committed
build: Drop support for Python 3.8
1 parent cbdf294 commit 6615c91

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

src/mkdocstrings_handlers/python/handler.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from collections import ChainMap
1111
from contextlib import suppress
1212
from pathlib import Path
13-
from typing import TYPE_CHECKING, Any, BinaryIO, ClassVar, Iterator, Mapping, Sequence
13+
from typing import TYPE_CHECKING, Any, BinaryIO, ClassVar
1414

1515
from griffe import (
1616
AliasResolutionError,
@@ -29,6 +29,8 @@
2929
from mkdocstrings_handlers.python import rendering
3030

3131
if TYPE_CHECKING:
32+
from collections.abc import Iterator, Mapping, Sequence
33+
3234
from markdown import Markdown
3335

3436

src/mkdocstrings_handlers/python/rendering.py

+5-11
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
import warnings
1111
from functools import lru_cache, partial
1212
from pathlib import Path
13-
from typing import TYPE_CHECKING, Any, Callable, Match, Pattern, Sequence
13+
from re import Match, Pattern
14+
from typing import TYPE_CHECKING, Any, Callable
1415

1516
from griffe import (
1617
Alias,
@@ -26,6 +27,8 @@
2627
from mkdocstrings.loggers import get_logger
2728

2829
if TYPE_CHECKING:
30+
from collections.abc import Sequence
31+
2932
from griffe import Attribute, Class, Function, Module
3033
from jinja2 import Environment, Template
3134
from jinja2.runtime import Context
@@ -477,16 +480,7 @@ def do_get_template(env: Environment, obj: str | Object) -> str | Template:
477480
template = env.get_template(f"{name}.html")
478481
except TemplateNotFound:
479482
return f"{name}.html.jinja"
480-
# TODO: Remove once support for Python 3.8 is dropped.
481-
if sys.version_info < (3, 9):
482-
try:
483-
Path(template.filename).relative_to(Path(__file__).parent) # type: ignore[arg-type]
484-
except ValueError:
485-
our_template = False
486-
else:
487-
our_template = True
488-
else:
489-
our_template = Path(template.filename).is_relative_to(Path(__file__).parent) # type: ignore[arg-type]
483+
our_template = Path(template.filename).is_relative_to(Path(__file__).parent) # type: ignore[arg-type]
490484
if our_template:
491485
return f"{name}.html.jinja"
492486
# TODO: Switch to a warning log after some time.

tests/conftest.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,14 @@
33
from __future__ import annotations
44

55
from collections import ChainMap
6-
from typing import TYPE_CHECKING, Any, Iterator
6+
from typing import TYPE_CHECKING, Any
77

88
import pytest
99
from markdown.core import Markdown
1010
from mkdocs.config.defaults import MkDocsConfig
1111

1212
if TYPE_CHECKING:
13+
from collections.abc import Iterator
1314
from pathlib import Path
1415

1516
from mkdocs import config

0 commit comments

Comments
 (0)