Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAINT: drop Python 3.7 & 3.8 support due to EOL #28

Merged
merged 2 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 4 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,16 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python",
"Topic :: Documentation",
"Topic :: Utilities",
"Typing :: Typed",
]
dependencies = [
"Sphinx>=4.4",
"colorama",
"docutils",
'importlib-metadata; python_version <"3.8.0"',
'typing-extensions; python_version <"3.8.0"',
"sphinx",
]
description = "Relink type hints in your Sphinx API"
dynamic = ["version"]
Expand All @@ -42,13 +38,13 @@ keywords = [
license = {text = "BSD 3-Clause License"}
maintainers = [{email = "[email protected]"}]
name = "sphinx-api-relink"
requires-python = ">=3.7"
requires-python = ">=3.9"

[project.optional-dependencies]
dev = ["sphinx-api-relink[sty]"]
sty = [
"mypy",
"pre-commit >=1.4.0",
"pre-commit",
"ruff",
"sphinx-api-relink[types]",
]
Expand Down Expand Up @@ -130,7 +126,7 @@ typeCheckingMode = "strict"
preview = true
show-fixes = true
src = ["src"]
target-version = "py37"
target-version = "py39"

[tool.ruff.format]
docstring-code-format = true
Expand Down
4 changes: 2 additions & 2 deletions src/sphinx_api_relink/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import os
import re
import sys
from functools import lru_cache
from functools import cache

from colorama import Fore, Style

Expand Down Expand Up @@ -141,7 +141,7 @@ def set_intersphinx_version_remapping(
__VERSION_REMAPPING.update(version_remapping)


@lru_cache(maxsize=None)
@cache
def print_once(message: str, *, color: str = Fore.RED) -> None:
colored_text = f"{color}{message}{Style.RESET_ALL}"
print(colored_text) # noqa: T201
8 changes: 4 additions & 4 deletions src/sphinx_api_relink/linkcode.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import inspect
import subprocess
import sys
from functools import lru_cache
from functools import cache, lru_cache
from os.path import dirname, relpath
from typing import TYPE_CHECKING, Any, Callable, TypedDict
from urllib.parse import quote
Expand Down Expand Up @@ -66,13 +66,13 @@ def _get_path(domain: str, info: LinkcodeInfo, debug: bool) -> str | None:
return f"{path}#{linenumbers}"


@lru_cache(maxsize=None)
@cache
def _get_package(module_name: str) -> ModuleType:
package_name = module_name.split(".")[0]
return __get_module(package_name)


@lru_cache(maxsize=None)
@cache
def __get_module(module_name: str) -> ModuleType:
module = sys.modules.get(module_name)
if module is None:
Expand Down Expand Up @@ -158,7 +158,7 @@ def _get_latest_tag() -> str | None:
return None


@lru_cache(maxsize=None)
@cache
def _url_exists(url: str) -> bool:
try:
response = requests.head(url, timeout=5)
Expand Down
Loading