Skip to content

Commit 5275922

Browse files
Merge pull request #54 from analog-garage/update-python
Drop python 3.9 support (#46)
2 parents 17a1e97 + 074a14f commit 5275922

File tree

8 files changed

+112
-32
lines changed

8 files changed

+112
-32
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ jobs:
99
fail-fast: true
1010
matrix:
1111
os: [ubuntu-latest, macos-latest, windows-latest]
12-
python-version: ["3.9", "3.11", "3.13"]
12+
python-version: ["3.10", "3.12", "3.14"]
1313
steps:
1414
- uses: actions/checkout@v3
15-
- uses: prefix-dev/setup-pixi@v0.8.3
15+
- uses: prefix-dev/setup-pixi@28eb668aafebd9dede9d97c4ba1cd9989a4d0004 # v0.9.2
1616
with:
17-
pixi-version: v0.43.3
17+
pixi-version: v0.63.2
1818
cache: true
1919
auth-host: prefix.dev
20-
auth-token: ${{ secrets.GITHUB_TOKEN }}
20+
auth-token: ${{ secrets.PREFIX_DEV_TOKEN }}
2121
- name: ruff
2222
run: |
2323
pixi run ruff

.idea/garpy.mkdocstrings.iml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
*Note that versions roughly correspond to the version of mkdocstrings-python that they
44
are compatible with.*
55

6+
## 1.16.5
7+
8+
* Drop python 3.9 support
9+
610
## 1.16.4
711

812
* Fix handling of aliases (see bug #47)

pixi.lock

Lines changed: 93 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,17 @@ classifiers = [
1313
"Development Status :: 5 - Production/Stable",
1414
"Intended Audience :: Developers",
1515
"Topic :: Software Development :: Documentation",
16-
"Programming Language :: Python :: 3.9",
1716
"Programming Language :: Python :: 3.10",
1817
"Programming Language :: Python :: 3.11",
1918
"Programming Language :: Python :: 3.12",
2019
"Programming Language :: Python :: 3.13",
20+
"Programming Language :: Python :: 3.14",
2121
]
2222
keywords = [
2323
"documentation-tool", "mkdocstrings", "mkdocstrings-handler", "python"
2424
]
2525
dynamic = ["version"]
26-
requires-python = ">=3.9"
26+
requires-python = ">=3.10"
2727
dependencies = [
2828
"mkdocstrings-python >=1.16.6,<2.0",
2929
"griffe >=1.0",
@@ -36,7 +36,9 @@ Documentation = "https://analog-garage.github.io/mkdocstrings-python-xref/"
3636
[project.optional-dependencies]
3737
dev = [
3838
"build >=1.0.0", # python-build on conda
39+
"pip >=25.0",
3940
"hatchling >=1.21",
41+
"whl2conda >=25.3",
4042
"coverage >=7.4.0",
4143
"pytest >=8.2",
4244
"pytest-cov >=5.0",
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.16.4
1+
1.16.5

src/mkdocstrings_handlers/python_xref/crossref.py

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2022-2025. Analog Devices Inc.
1+
# Copyright (c) 2022-2026. Analog Devices Inc.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -17,8 +17,7 @@
1717

1818
import ast
1919
import re
20-
import sys
21-
from typing import Any, Callable, List, Optional, cast
20+
from typing import Callable, List, Optional, cast
2221

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

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

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

src/mkdocstrings_handlers/python_xref/handler.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Copyright (c) 2022-2025. Analog Devices Inc.
1+
# Copyright (c) 2022-2026. Analog Devices Inc.
22
#
33
# Licensed under the Apache License, Version 2.0 (the "License");
44
# you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@
1818
from __future__ import annotations
1919

2020
import re
21-
import sys
2221
from dataclasses import dataclass, field, fields
2322
from functools import partial
2423
from pathlib import Path
@@ -37,12 +36,7 @@
3736

3837
logger = get_logger(__name__)
3938

40-
# TODO python 3.9 - remove when 3.9 support is dropped
41-
_dataclass_options = {"frozen": True}
42-
if sys.version_info >= (3, 10):
43-
_dataclass_options["kw_only"] = True
44-
45-
@dataclass(**_dataclass_options)
39+
@dataclass(frozen=True, kw_only=True)
4640
class PythonRelXRefOptions(PythonOptions):
4741
check_crossrefs: bool = True
4842
check_crossrefs_exclude: list[str | re.Pattern] = field(default_factory=list)

0 commit comments

Comments
 (0)