Skip to content

Commit

Permalink
build: Drop support for Python 3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
pawamoy committed Oct 12, 2024
1 parent cbdf294 commit 6615c91
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
4 changes: 3 additions & 1 deletion src/mkdocstrings_handlers/python/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from collections import ChainMap
from contextlib import suppress
from pathlib import Path
from typing import TYPE_CHECKING, Any, BinaryIO, ClassVar, Iterator, Mapping, Sequence
from typing import TYPE_CHECKING, Any, BinaryIO, ClassVar

from griffe import (
AliasResolutionError,
Expand All @@ -29,6 +29,8 @@
from mkdocstrings_handlers.python import rendering

if TYPE_CHECKING:
from collections.abc import Iterator, Mapping, Sequence

from markdown import Markdown


Expand Down
16 changes: 5 additions & 11 deletions src/mkdocstrings_handlers/python/rendering.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
import warnings
from functools import lru_cache, partial
from pathlib import Path
from typing import TYPE_CHECKING, Any, Callable, Match, Pattern, Sequence
from re import Match, Pattern
from typing import TYPE_CHECKING, Any, Callable

from griffe import (
Alias,
Expand All @@ -26,6 +27,8 @@
from mkdocstrings.loggers import get_logger

if TYPE_CHECKING:
from collections.abc import Sequence

from griffe import Attribute, Class, Function, Module
from jinja2 import Environment, Template
from jinja2.runtime import Context
Expand Down Expand Up @@ -477,16 +480,7 @@ def do_get_template(env: Environment, obj: str | Object) -> str | Template:
template = env.get_template(f"{name}.html")
except TemplateNotFound:
return f"{name}.html.jinja"
# TODO: Remove once support for Python 3.8 is dropped.
if sys.version_info < (3, 9):
try:
Path(template.filename).relative_to(Path(__file__).parent) # type: ignore[arg-type]
except ValueError:
our_template = False
else:
our_template = True
else:
our_template = Path(template.filename).is_relative_to(Path(__file__).parent) # type: ignore[arg-type]
our_template = Path(template.filename).is_relative_to(Path(__file__).parent) # type: ignore[arg-type]
if our_template:
return f"{name}.html.jinja"
# TODO: Switch to a warning log after some time.
Expand Down
3 changes: 2 additions & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
from __future__ import annotations

from collections import ChainMap
from typing import TYPE_CHECKING, Any, Iterator
from typing import TYPE_CHECKING, Any

import pytest
from markdown.core import Markdown
from mkdocs.config.defaults import MkDocsConfig

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

from mkdocs import config
Expand Down

0 comments on commit 6615c91

Please sign in to comment.