From 21ab1d8051d365a2b41cda4eaea78c433738ebea Mon Sep 17 00:00:00 2001 From: Robert Date: Sat, 7 Mar 2026 14:54:06 +0100 Subject: [PATCH 1/2] Changed mypy python version to 3.13 + Fixed mypy in a test + Re-enabled mypy in CI --- .github/workflows/lint.yml | 5 ++--- pyproject.toml | 2 +- test/test_default_html.py | 5 +++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index bc3e1ed..3e276a2 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -38,9 +38,8 @@ jobs: - name: Format with Ruff run: ruff format . --diff -# - name: Type check with MyPy -# run: mypy -# Skip MyPy check for now, see https://github.com/sphinx-doc/sphinx-argparse/issues/85 + - name: Type check with MyPy + run: mypy twine: name: "Check packing with Twine" diff --git a/pyproject.toml b/pyproject.toml index cf8fe7b..e2f411e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -96,7 +96,7 @@ multi_line_output = 3 [tool.mypy] files = ["sphinxarg", "test"] -python_version = "3.10" +python_version = "3.13" exclude = '''(?x)( ^test/roots | ^docs )''' [[tool.mypy.overrides]] diff --git a/test/test_default_html.py b/test/test_default_html.py index 01eb275..27dc351 100644 --- a/test/test_default_html.py +++ b/test/test_default_html.py @@ -1,6 +1,7 @@ """Test the HTML builder and check output against XPath.""" import posixpath +from typing import Any import pytest from sphinx.util.inventory import InventoryFile @@ -90,8 +91,8 @@ def test_index_is_optional(app, cached_etree_parse): assert command_index_file.exists() is False -def get_inv_command_uri(inv: dict, field: str) -> str: - command = inv.get('commands:command') +def get_inv_command_uri(inv: dict[str, dict[str, Any]], field: str) -> str: + command = inv['commands:command'] value = command.get(field, None) assert value is not None if isinstance(value, tuple): From 2bf228b901938f6da5682a6e177e930617bf6d59 Mon Sep 17 00:00:00 2001 From: Robert Date: Sat, 7 Mar 2026 15:00:16 +0100 Subject: [PATCH 2/2] Fixed mypy warning from CI --- sphinxarg/ext.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/sphinxarg/ext.py b/sphinxarg/ext.py index 2e79880..847a187 100644 --- a/sphinxarg/ext.py +++ b/sphinxarg/ext.py @@ -5,7 +5,7 @@ import os import sys from argparse import ArgumentParser -from typing import TYPE_CHECKING, ClassVar, cast +from typing import TYPE_CHECKING, cast from docutils import nodes from docutils.frontend import get_default_settings @@ -892,9 +892,7 @@ class ArgParseDomain(Domain): 'command': XRefRole(), } indices = [] - initial_data: ClassVar[ - dict[str, list[_ObjectDescriptionTuple] | dict[str, list[_ObjectDescriptionTuple]]] - ] = { + initial_data = { 'commands': [], 'commands-by-group': {}, }