Skip to content

Commit

Permalink
Fix sphinx extension compat with sphinx8 (#826)
Browse files Browse the repository at this point in the history
* Add required generic type as well.
  • Loading branch information
tristanlatr authored Oct 16, 2024
1 parent 41b734b commit 4114a51
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ in development
* Replace the deprecated dependency appdirs with platformdirs.
* Fix WinError caused by the failure of the symlink creation process.
Pydoctor should now run on windows without the need to be administrator.
* Adjust the sphinx extension to support Sphinx 8.1. The entries dynamically added to the intersphinx config
from the ``pydoctor_url_path`` config option now includes a project name which defaults to 'main' (instead of putting None),
use mapping instead of a list define your own project name.


pydoctor 24.3.3
^^^^^^^^^^^^^^^
Expand Down
12 changes: 10 additions & 2 deletions pydoctor/epydoc/markup/restructuredtext.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
from __future__ import annotations
__docformat__ = 'epytext en'

from typing import Any, Iterable, List, Optional, Sequence, Set, cast
from typing import TYPE_CHECKING, Any, Iterable, List, Optional, Sequence, Set, cast
if TYPE_CHECKING:
from typing import TypeAlias

import re
from docutils import nodes

Expand Down Expand Up @@ -190,7 +193,12 @@ def report(self, error: nodes.system_message) -> None:

self._errors.append(ParseError(msg, linenum, is_fatal))

class _DocumentPseudoWriter(Writer):
if TYPE_CHECKING:
_StrWriter: TypeAlias = Writer[str]
else:
_StrWriter = Writer

class _DocumentPseudoWriter(_StrWriter):
"""
A pseudo-writer for the docutils framework, that can be used to
access the document itself. The output of C{_DocumentPseudoWriter}
Expand Down
2 changes: 1 addition & 1 deletion pydoctor/sphinx_ext/build_apidocs.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def on_builder_inited(app: Sphinx) -> None:
intersphinx_mapping = config.intersphinx_mapping
url = url_path.format(**{'rtd_version': rtd_version})
inv = (str(temp_path / 'objects.inv'),)
intersphinx_mapping[f'{key}-api-docs'] = (None, (url, inv))
intersphinx_mapping[f'{key}-api-docs'] = (key, (url, inv))

# Build the API docs in temporary path.
shutil.rmtree(temp_path, ignore_errors=True)
Expand Down

0 comments on commit 4114a51

Please sign in to comment.