mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Merge pull request #9259 from tk0miya/deprecate_app
deprecate sphinx.ext.autosummary._app
This commit is contained in:
commit
e878299cc6
1
CHANGES
1
CHANGES
@ -15,6 +15,7 @@ Deprecated
|
||||
* The ``app`` argument of ``sphinx.environment.BuildEnvironment`` becomes
|
||||
required
|
||||
* ``sphinx.application.Sphinx.html_theme``
|
||||
* ``sphinx.ext.autosummary._app``
|
||||
* ``sphinx.util.docstrings.extract_metadata()``
|
||||
|
||||
Features added
|
||||
|
@ -32,6 +32,11 @@ The following is a list of deprecated interfaces.
|
||||
- 6.0
|
||||
- ``sphinx.registry.SphinxComponentRegistry.html_themes``
|
||||
|
||||
* - ``sphinx.ext.autosummary._app``
|
||||
- 4.1
|
||||
- 6.0
|
||||
- N/A
|
||||
|
||||
* - ``sphinx.util.docstrings.extract_metadata()``
|
||||
- 4.1
|
||||
- 6.0
|
||||
|
@ -72,7 +72,8 @@ import sphinx
|
||||
from sphinx import addnodes
|
||||
from sphinx.application import Sphinx
|
||||
from sphinx.config import Config
|
||||
from sphinx.deprecation import RemovedInSphinx50Warning
|
||||
from sphinx.deprecation import (RemovedInSphinx50Warning, RemovedInSphinx60Warning,
|
||||
deprecated_alias)
|
||||
from sphinx.environment import BuildEnvironment
|
||||
from sphinx.environment.adapters.toctree import TocTree
|
||||
from sphinx.ext.autodoc import INSTANCEATTR, Documenter
|
||||
@ -165,9 +166,13 @@ def autosummary_table_visit_html(self: HTMLTranslator, node: autosummary_table)
|
||||
|
||||
|
||||
# -- autodoc integration -------------------------------------------------------
|
||||
|
||||
# current application object (used in `get_documenter()`).
|
||||
_app: Sphinx = None
|
||||
deprecated_alias('sphinx.ext.autosummary',
|
||||
{
|
||||
'_app': None,
|
||||
},
|
||||
RemovedInSphinx60Warning,
|
||||
{
|
||||
})
|
||||
|
||||
|
||||
class FakeApplication:
|
||||
|
@ -25,11 +25,14 @@ def register_application_for_autosummary(app: "Sphinx") -> None:
|
||||
"""
|
||||
if 'sphinx.ext.autosummary' in sys.modules:
|
||||
from sphinx.ext import autosummary
|
||||
autosummary._app = app
|
||||
if hasattr(autosummary, '_objects'):
|
||||
autosummary._objects['_app'] = app # type: ignore
|
||||
else:
|
||||
autosummary._app = app # type: ignore
|
||||
|
||||
|
||||
def setup(app: "Sphinx") -> Dict[str, Any]:
|
||||
app.connect('builder-inited', register_application_for_autosummary)
|
||||
app.connect('builder-inited', register_application_for_autosummary, priority=100)
|
||||
|
||||
return {
|
||||
'version': 'builtin',
|
||||
|
Loading…
Reference in New Issue
Block a user