Merge pull request #9259 from tk0miya/deprecate_app

deprecate sphinx.ext.autosummary._app
This commit is contained in:
Takeshi KOMIYA 2021-05-31 02:42:13 +09:00 committed by GitHub
commit e878299cc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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:

View File

@ -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',