Skip to content

WIP: Impove docutils #14107

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

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Conversation

donBarbos
Copy link
Contributor

No description provided.

Copy link
Contributor

Diff from mypy_primer, showing the effect of this PR on open source code:

bokeh (https://github.com/bokeh/bokeh)
+ src/bokeh/sphinxext/bokeh_directive.py:29: note: In module imported here:
+ src/bokeh/sphinxext/bokeh_color.py:45: note: ... from here:
+ src/bokeh/sphinxext/bokeh_color.py:45: note: ... from here:
+ src/bokeh/sphinxext/bokeh_color.py:45: note: In module imported here:

cwltool (https://github.com/common-workflow-language/cwltool)
+ note: ... from here,
+ note: ... from here,
+ note: ... from here,
+ cwltool/software_requirements.py:23: note: ... from here:
+ note: ... from here,
+ note: ... from here,
+ note: ... from here,
+ cwltool/software_requirements.py:23: note: ... from here:
+ note: ... from here,
+ note: ... from here,
+ note: ... from here,
+ cwltool/software_requirements.py:23: note: ... from here:

alectryon (https://github.com/cpitclaudel/alectryon)
- alectryon/docutils.py:1534: error: Unused "type: ignore" comment  [unused-ignore]

sphinx (https://github.com/sphinx-doc/sphinx)
+ sphinx/directives/other.py:12: note: In module imported here:
+ sphinx/transforms/__init__.py:10: note: In module imported here:
+ sphinx/builders/html/__init__.py:23: note: In module imported here:
+ sphinx/builders/__init__.py:13: note: In module imported here:
+ sphinx/builders/latex/nodes.py: note: In class "footnotetext":
+ sphinx/builders/latex/nodes.py:20:1: error: Definition of "referenced" in base class "Element" is incompatible with definition in base class "Targetable"  [misc]
+ sphinx/writers/html5.py:11: note: In module imported here:
+ sphinx/util/docutils.py:17:1: error: Module "docutils.utils" has no attribute "unescape"  [attr-defined]
+ sphinx/util/docutils.py: note: In member "write" of class "SphinxFileOutput":
+ sphinx/util/docutils.py:453:16: error: Call to untyped function "write" in typed context  [no-untyped-call]
+ sphinx/roles.py: note: In member "create_non_xref_node" of class "XRefRole":
+ sphinx/roles.py:115:16: error: Module has no attribute "unescape"  [attr-defined]
+ sphinx/writers/html5.py:44: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/writers/html5.py: note: In class "HTML5Translator":
+ sphinx/writers/html5.py:51:39: error: Incompatible types in assignment (expression has type "set[str]", base class "HTMLTranslator" defined the type as "EllipsisType")  [assignment]
+ sphinx/writers/html5.py: note: In member "visit_comment" of class "HTML5Translator":
+ sphinx/writers/html5.py:364:5: error: Signature of "visit_comment" incompatible with supertype "HTMLTranslator"  [override]
+ sphinx/writers/html5.py:364:5: note:      Superclass:
+ sphinx/writers/html5.py:364:5: note:          def visit_comment(self, node: Element, sub: Callable[[str, str], str] = ...) -> None
+ sphinx/writers/html5.py:364:5: note:      Subclass:
+ sphinx/writers/html5.py:364:5: note:          def visit_comment(self, node: Element) -> None
+ sphinx/writers/html5.py: note: In member "visit_rubric" of class "HTML5Translator":
+ sphinx/writers/html5.py:565:28: error: Argument 1 of "visit_rubric" is incompatible with supertype "HTMLTranslator"; supertype defines the argument type as "Element"  [override]
+ sphinx/writers/html5.py:565:28: note: This violates the Liskov substitution principle
+ sphinx/writers/html5.py:565:28: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
+ sphinx/writers/html5.py: note: In member "depart_rubric" of class "HTML5Translator":
+ sphinx/writers/html5.py:582:29: error: Argument 1 of "depart_rubric" is incompatible with supertype "HTMLTranslator"; supertype defines the argument type as "Element"  [override]
+ sphinx/writers/html5.py:582:29: note: This violates the Liskov substitution principle
+ sphinx/writers/html5.py:582:29: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
+ sphinx/writers/html5.py: note: In member "visit_caption" of class "HTML5Translator":
+ sphinx/writers/html5.py:624:13: error: Call to untyped function "visit_caption" in typed context  [no-untyped-call]
+ sphinx/writers/html5.py: note: In member "depart_caption" of class "HTML5Translator":
+ sphinx/writers/html5.py:648:13: error: Call to untyped function "depart_caption" in typed context  [no-untyped-call]
+ sphinx/writers/html5.py: note: In member "visit_figure" of class "HTML5Translator":
+ sphinx/writers/html5.py:747:16: error: Call to untyped function "visit_figure" in typed context  [no-untyped-call]
+ sphinx/writers/html5.py: note: In member "visit_math" of class "HTML5Translator":
+ sphinx/writers/html5.py:967:26: error: Argument 1 of "visit_math" is incompatible with supertype "HTMLTranslator"; supertype defines the argument type as "Element"  [override]
+ sphinx/writers/html5.py:967:26: note: This violates the Liskov substitution principle
+ sphinx/writers/html5.py:967:26: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#incompatible-overrides
+ sphinx/writers/html5.py: note: In member "depart_math" of class "HTML5Translator":
+ sphinx/writers/html5.py:975:5: error: Signature of "depart_math" incompatible with supertype "HTMLTranslator"  [override]
+ sphinx/writers/html5.py:975:5: note:      Superclass:
+ sphinx/writers/html5.py:975:5: note:          def depart_math(self, node: Element) -> None
+ sphinx/writers/html5.py:975:5: note:      Subclass:
+ sphinx/writers/html5.py:975:5: note:          def depart_math(self, node: math, math_env: str = ...) -> None
+ sphinx/writers/html5.py: note: In member "visit_math_block" of class "HTML5Translator":
+ sphinx/writers/html5.py:982:5: error: Signature of "visit_math_block" incompatible with supertype "HTMLTranslator"  [override]
+ sphinx/writers/html5.py:982:5: note:      Superclass:
+ sphinx/writers/html5.py:982:5: note:          def visit_math_block(self, node: Element) -> None
+ sphinx/writers/html5.py:982:5: note:      Subclass:
+ sphinx/writers/html5.py:982:5: note:          def visit_math_block(self, node: math_block, math_env: str = ...) -> None
+ sphinx/writers/html5.py: note: In member "depart_math_block" of class "HTML5Translator":
+ sphinx/writers/html5.py:990:5: error: Signature of "depart_math_block" incompatible with supertype "HTMLTranslator"  [override]
+ sphinx/writers/html5.py:990:5: note:      Superclass:
+ sphinx/writers/html5.py:990:5: note:          def depart_math_block(self, node: Element) -> None
+ sphinx/writers/html5.py:990:5: note:      Subclass:
+ sphinx/writers/html5.py:990:5: note:          def depart_math_block(self, node: math_block, math_env: str = ...) -> None
+ sphinx/transforms/__init__.py:92: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/transforms/__init__.py: note: In member "apply" of class "ExtraTranslatableNodes":
+ sphinx/transforms/__init__.py:279:13: error: Unsupported target for indexed assignment ("Node")  [index]
+ sphinx/transforms/__init__.py: note: At top level:
- sphinx/io.py: note: In function "create_publisher":
- sphinx/io.py:189:5: error: Call to untyped function "get_settings" in typed context  [no-untyped-call]
+ sphinx/transforms/i18n.py: note: In member "apply" of class "PreserveTranslatableMessages":
+ sphinx/transforms/i18n.py:108:43: error: Only concrete class can be given where "type[translatable]" is expected  [type-abstract]
+ sphinx/builders/__init__.py: note: In member "read_doc" of class "Builder":
+ sphinx/builders/__init__.py:638:9: error: "dict[str, Any]" has no attribute "record_dependencies"  [attr-defined]
+ sphinx/builders/__init__.py:658:37: error: Argument 2 to "write_doctree" of "Builder" has incompatible type "Any | None"; expected "document"  [arg-type]
+ sphinx/builders/latex/__init__.py: note: In member "write_documents" of class "LaTeXBuilder":
+ sphinx/builders/latex/__init__.py:308:32: error: Call to untyped function "get_default_values" in typed context  [no-untyped-call]
+ sphinx/builders/html/__init__.py: note: In member "render_partial" of class "StandaloneHTMLBuilder":
+ sphinx/builders/html/__init__.py:430:16: error: Incompatible return value type (got "_WriterParts", expected "dict[str, str]")  [return-value]
- sphinx/builders/html/__init__.py: note: In member "__init__" of class "StandaloneHTMLBuilder":
+ sphinx/builders/html/__init__.py: note: In member "prepare_writing" of class "StandaloneHTMLBuilder":
- sphinx/builders/html/__init__.py:165:9: error: Call to untyped function "get_settings" in typed context  [no-untyped-call]
+ sphinx/builders/html/__init__.py:452:37: error: Call to untyped function "get_default_values" in typed context  [no-untyped-call]
+ sphinx/testing/restructuredtext.py: note: In function "parse":
+ sphinx/testing/restructuredtext.py:29:17: error: Argument 2 to "publish_doctree" has incompatible type "str"; expected "FileInput | StringInput | None"  [arg-type]
+ sphinx/ext/extlinks.py: note: In function "make_link_role":
+ sphinx/ext/extlinks.py:108:16: error: Module has no attribute "unescape"  [attr-defined]
+ sphinx/builders/texinfo.py: note: In member "write_documents" of class "TexinfoBuilder":
+ sphinx/builders/texinfo.py:126:37: error: Call to untyped function "get_default_values" in typed context  [no-untyped-call]
+ sphinx/builders/latex/transforms.py:531: error: Unused "type: ignore" comment  [unused-ignore]
+ sphinx/builders/manpage.py: note: In member "write_documents" of class "ManualPageBuilder":
+ sphinx/builders/manpage.py:61:32: error: Call to untyped function "get_default_values" in typed context  [no-untyped-call]
+ sphinx/builders/linkcheck.py: note: In member "run" of class "HyperlinkCollector":
+ sphinx/builders/linkcheck.py:216:37: error: Argument 1 to "find_uri" of "HyperlinkCollector" has incompatible type "Node"; expected "Element"  [arg-type]
+ sphinx/builders/linkcheck.py:217:36: error: Argument 2 to "_add_uri" of "HyperlinkCollector" has incompatible type "Node"; expected "Element"  [arg-type]

adamtheturtle added a commit to adamtheturtle/typeshed that referenced this pull request May 21, 2025
Required to avoid adding new ignores to Sphinx with the latest types-docutils.
See sphinx-doc/sphinx#13564.

Copied form @donBarbos's WIP at python#14107.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant