Skip to content
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
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ["3.9", "3.11", "3.13"]
python-version: ["3.10", "3.12", "3.14"]
steps:
- uses: actions/checkout@v3
- uses: prefix-dev/setup-pixi@v0.8.3
- uses: prefix-dev/setup-pixi@28eb668aafebd9dede9d97c4ba1cd9989a4d0004 # v0.9.2
with:
pixi-version: v0.43.3
pixi-version: v0.63.2
cache: true
auth-host: prefix.dev
auth-token: ${{ secrets.GITHUB_TOKEN }}
auth-token: ${{ secrets.PREFIX_DEV_TOKEN }}
- name: ruff
run: |
pixi run ruff
Expand Down
2 changes: 1 addition & 1 deletion .idea/garpy.mkdocstrings.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
*Note that versions roughly correspond to the version of mkdocstrings-python that they
are compatible with.*

## 1.16.5

* Drop python 3.9 support

## 1.16.4

* Fix handling of aliases (see bug #47)
Expand Down
97 changes: 93 additions & 4 deletions pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,17 @@ classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Topic :: Software Development :: Documentation",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
]
keywords = [
"documentation-tool", "mkdocstrings", "mkdocstrings-handler", "python"
]
dynamic = ["version"]
requires-python = ">=3.9"
requires-python = ">=3.10"
dependencies = [
"mkdocstrings-python >=1.16.6,<2.0",
"griffe >=1.0",
Expand All @@ -36,7 +36,9 @@ Documentation = "https://analog-garage.github.io/mkdocstrings-python-xref/"
[project.optional-dependencies]
dev = [
"build >=1.0.0", # python-build on conda
"pip >=25.0",
"hatchling >=1.21",
"whl2conda >=25.3",
"coverage >=7.4.0",
"pytest >=8.2",
"pytest-cov >=5.0",
Expand Down
2 changes: 1 addition & 1 deletion src/mkdocstrings_handlers/python_xref/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.16.4
1.16.5
15 changes: 3 additions & 12 deletions src/mkdocstrings_handlers/python_xref/crossref.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2022-2025. Analog Devices Inc.
# Copyright (c) 2022-2026. Analog Devices Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -17,8 +17,7 @@

import ast
import re
import sys
from typing import Any, Callable, List, Optional, cast
from typing import Callable, List, Optional, cast

from griffe import Alias, Docstring, GriffeError, Object
from mkdocstrings import get_logger
Expand Down Expand Up @@ -365,7 +364,7 @@ def doc_value_offset_to_location(doc: Docstring, offset: int) -> tuple[int,int]:
try:
source = doc.source
# compute docstring without cleaning up spaces and indentation
rawvalue = str(safe_eval(source))
rawvalue = str(ast.literal_eval(source))

# adjust line offset by number of lines removed from front of docstring
lineoffset += leading_space(rawvalue).count("\n")
Expand Down Expand Up @@ -401,12 +400,4 @@ def leading_space(s: str) -> str:
return m[0]
return "" # pragma: no cover

if sys.version_info < (3, 10) or True:
# TODO: remove when 3.9 support is dropped
# In 3.9, literal_eval cannot handle comments in input
def safe_eval(s: str) -> Any:
"""Safely evaluate a string expression."""
return eval(s) #eval(s, dict(__builtins__={}), {})
else:
save_eval = ast.literal_eval

10 changes: 2 additions & 8 deletions src/mkdocstrings_handlers/python_xref/handler.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (c) 2022-2025. Analog Devices Inc.
# Copyright (c) 2022-2026. Analog Devices Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
Expand All @@ -18,7 +18,6 @@
from __future__ import annotations

import re
import sys
from dataclasses import dataclass, field, fields
from functools import partial
from pathlib import Path
Expand All @@ -37,12 +36,7 @@

logger = get_logger(__name__)

# TODO python 3.9 - remove when 3.9 support is dropped
_dataclass_options = {"frozen": True}
if sys.version_info >= (3, 10):
_dataclass_options["kw_only"] = True

@dataclass(**_dataclass_options)
@dataclass(frozen=True, kw_only=True)
class PythonRelXRefOptions(PythonOptions):
check_crossrefs: bool = True
check_crossrefs_exclude: list[str | re.Pattern] = field(default_factory=list)
Expand Down
Loading