Skip to content
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

Remove deprecated items for Sphinx 6.0 #10471

Merged
merged 3 commits into from Jun 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGES
Expand Up @@ -6507,7 +6507,7 @@ Features added
* HTML builder:

- Added ``pyramid`` theme.
- #559: `html_add_permalinks` is now a string giving the
- #559: ``html_add_permalinks`` is now a string giving the
text to display in permalinks.
- #259: HTML table rows now have even/odd CSS classes to enable
"Zebra styling".
Expand Down
55 changes: 0 additions & 55 deletions LICENSE
Expand Up @@ -107,61 +107,6 @@ smartypants.py license::
such damage.
----------------------------------------------------------------------

The included JQuery JavaScript library is available under the MIT
license:

----------------------------------------------------------------------
Copyright (c) 2008 John Resig, https://jquery.com/

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
----------------------------------------------------------------------

The included Underscore JavaScript library is available under the MIT
license:

----------------------------------------------------------------------
Copyright (c) 2009 Jeremy Ashkenas, DocumentCloud

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

-------------------------------------------------------------------------------

The included implementation of NumpyDocstring._parse_numpydoc_see_also_section
was derived from code under the following license:

Expand Down
4 changes: 2 additions & 2 deletions doc/conf.py
Expand Up @@ -44,8 +44,8 @@
epub_post_files = [('usage/installation.xhtml', 'Installing Sphinx'),
('develop.xhtml', 'Sphinx development')]
epub_exclude_files = ['_static/opensearch.xml', '_static/doctools.js',
'_static/jquery.js', '_static/searchtools.js',
'_static/underscore.js', '_static/basic.css',
'_static/searchtools.js',
'_static/basic.css',
'_static/language_data.js',
'search.html', '_static/websupport.js']
epub_fix_images = False
Expand Down
50 changes: 0 additions & 50 deletions doc/usage/configuration.rst
Expand Up @@ -1017,20 +1017,6 @@ that use Sphinx's HTMLWriter class.

.. versionadded:: 1.8

.. confval:: html_codeblock_linenos_style

The style of line numbers for code-blocks.

* ``'table'`` -- display line numbers using ``<table>`` tag
* ``'inline'`` -- display line numbers using ``<span>`` tag (default)

.. versionadded:: 3.2
.. versionchanged:: 4.0

It defaults to ``'inline'``.

.. deprecated:: 4.0

.. confval:: html_context

A dictionary of values to pass into the template engine's context for all
Expand Down Expand Up @@ -1181,24 +1167,6 @@ that use Sphinx's HTMLWriter class.
.. deprecated:: 1.6
To disable smart quotes, use rather :confval:`smartquotes`.

.. confval:: html_add_permalinks

Sphinx will add "permalinks" for each heading and description environment as
paragraph signs that become visible when the mouse hovers over them.

This value determines the text for the permalink; it defaults to ``"¶"``.
Set it to ``None`` or the empty string to disable permalinks.

.. versionadded:: 0.6
Previously, this was always activated.

.. versionchanged:: 1.1
This can now be a string to select the actual text of the link.
Previously, only boolean values were accepted.

.. deprecated:: 3.5
This has been replaced by :confval:`html_permalinks`

.. confval:: html_permalinks

If true, Sphinx will add "permalinks" for each heading and description
Expand Down Expand Up @@ -2768,24 +2736,6 @@ Options for the C domain

.. versionadded:: 4.0.3

.. confval:: c_allow_pre_v3

A boolean (default ``False``) controlling whether to parse and try to
convert pre-v3 style type directives and type roles.

.. versionadded:: 3.2
.. deprecated:: 3.2
Use the directives and roles added in v3.

.. confval:: c_warn_on_allowed_pre_v3

A boolean (default ``True``) controlling whether to warn when a pre-v3
style type directive/role is parsed and converted.

.. versionadded:: 3.2
.. deprecated:: 3.2
Use the directives and roles added in v3.

.. _cpp-config:

Options for the C++ domain
Expand Down
28 changes: 0 additions & 28 deletions sphinx/application.py
Expand Up @@ -6,7 +6,6 @@
import os
import pickle
import sys
import warnings
from collections import deque
from io import StringIO
from os import path
Expand All @@ -22,7 +21,6 @@
import sphinx
from sphinx import locale, package_dir
from sphinx.config import Config
from sphinx.deprecation import RemovedInSphinx60Warning
from sphinx.domains import Domain, Index
from sphinx.environment import BuildEnvironment
from sphinx.environment.collectors import EnvironmentCollector
Expand Down Expand Up @@ -1050,26 +1048,6 @@ def add_css_file(self, filename: str, priority: int = 500, **kwargs: Any) -> Non
if hasattr(self.builder, 'add_css_file'):
self.builder.add_css_file(filename, priority=priority, **kwargs) # type: ignore

def add_stylesheet(self, filename: str, alternate: bool = False, title: str = None
) -> None:
"""An alias of :meth:`add_css_file`.
.. deprecated:: 1.8
"""
logger.warning('The app.add_stylesheet() is deprecated. '
'Please use app.add_css_file() instead.')

attributes = {} # type: Dict[str, Any]
if alternate:
attributes['rel'] = 'alternate stylesheet'
else:
attributes['rel'] = 'stylesheet'

if title:
attributes['title'] = title

self.add_css_file(filename, **attributes)

def add_latex_package(self, packagename: str, options: str = None,
after_hyperref: bool = False) -> None:
r"""Register a package to include in the LaTeX source code.
Expand Down Expand Up @@ -1286,12 +1264,6 @@ def set_html_assets_policy(self, policy):
raise ValueError('policy %s is not supported' % policy)
self.registry.html_assets_policy = policy

@property
def html_themes(self) -> Dict[str, str]:
warnings.warn('app.html_themes is deprecated.',
RemovedInSphinx60Warning)
return self.registry.html_themes


class TemplateBridge:
"""
Expand Down
37 changes: 1 addition & 36 deletions sphinx/builders/html/__init__.py
Expand Up @@ -23,7 +23,7 @@
from sphinx import version_info as sphinx_version
from sphinx.application import Sphinx
from sphinx.builders import Builder
from sphinx.config import ENUM, Config
from sphinx.config import Config
from sphinx.deprecation import RemovedInSphinx70Warning, deprecated_alias
from sphinx.domains import Domain, Index, IndexEntry
from sphinx.environment.adapters.asset import ImageAdapter
Expand Down Expand Up @@ -328,11 +328,6 @@ def init_js_files(self) -> None:
self.script_files = []
self.add_js_file('documentation_options.js', id="documentation_options",
data_url_root='', priority=200)
# Remove frameworks and compatability module below in Sphinx 6.0
# xref RemovedInSphinx60Warning
self.add_js_file('jquery.js', priority=200)
self.add_js_file('underscore.js', priority=200)
self.add_js_file('_sphinx_javascript_frameworks_compat.js', priority=200)
self.add_js_file('doctools.js', priority=200)

for filename, attrs in self.app.registry.js_files:
Expand Down Expand Up @@ -1290,32 +1285,6 @@ def validate_html_favicon(app: Sphinx, config: Config) -> None:
config.html_favicon = None # type: ignore


class _stable_repr_object():

def __repr__(self):
return '<object>'


UNSET = _stable_repr_object()


def migrate_html_add_permalinks(app: Sphinx, config: Config) -> None:
"""Migrate html_add_permalinks to html_permalinks*."""
html_add_permalinks = config.html_add_permalinks
if html_add_permalinks is UNSET:
return

# RemovedInSphinx60Warning
logger.warning(__('html_add_permalinks has been deprecated since v3.5.0. '
'Please use html_permalinks and html_permalinks_icon instead.'))
if not html_add_permalinks:
config.html_permalinks = False # type: ignore[attr-defined]
return

config.html_permalinks_icon = html.escape( # type: ignore[attr-defined]
html_add_permalinks
)

# for compatibility
import sphinxcontrib.serializinghtml # NOQA

Expand Down Expand Up @@ -1352,7 +1321,6 @@ def setup(app: Sphinx) -> Dict[str, Any]:
app.add_config_value('html_sidebars', {}, 'html')
app.add_config_value('html_additional_pages', {}, 'html')
app.add_config_value('html_domain_indices', True, 'html', [list])
app.add_config_value('html_add_permalinks', UNSET, 'html')
app.add_config_value('html_permalinks', True, 'html')
app.add_config_value('html_permalinks_icon', '¶', 'html')
app.add_config_value('html_use_index', True, 'html')
Expand All @@ -1375,8 +1343,6 @@ def setup(app: Sphinx) -> Dict[str, Any]:
app.add_config_value('html_search_scorer', '', None)
app.add_config_value('html_scaled_image_link', True, 'html')
app.add_config_value('html_baseurl', '', 'html')
app.add_config_value('html_codeblock_linenos_style', 'inline', 'html', # RemovedInSphinx60Warning # NOQA
ENUM('table', 'inline'))
app.add_config_value('html_math_renderer', None, 'env')
app.add_config_value('html4_writer', False, 'html')

Expand All @@ -1387,7 +1353,6 @@ def setup(app: Sphinx) -> Dict[str, Any]:
# event handlers
app.connect('config-inited', convert_html_css_files, priority=800)
app.connect('config-inited', convert_html_js_files, priority=800)
app.connect('config-inited', migrate_html_add_permalinks, priority=800)
app.connect('config-inited', validate_html_extra_path, priority=800)
app.connect('config-inited', validate_html_static_path, priority=800)
app.connect('config-inited', validate_html_logo, priority=800)
Expand Down
2 changes: 1 addition & 1 deletion sphinx/cmd/quickstart.py
Expand Up @@ -376,7 +376,7 @@ def write_file(fpath: str, content: str, newline: str = None) -> None:
if template._has_custom_template('quickstart/master_doc.rst_t'):
msg = ('A custom template `master_doc.rst_t` found. It has been renamed to '
'`root_doc.rst_t`. Please rename it on your project too.')
print(colorize('red', msg)) # RemovedInSphinx60Warning
print(colorize('red', msg))
write_file(masterfile, template.render('quickstart/master_doc.rst_t', d))
else:
write_file(masterfile, template.render('quickstart/root_doc.rst_t', d))
Expand Down
6 changes: 3 additions & 3 deletions sphinx/deprecation.py
Expand Up @@ -6,15 +6,15 @@
from typing import Any, Dict, Type


class RemovedInSphinx60Warning(DeprecationWarning):
class RemovedInSphinx70Warning(DeprecationWarning):
pass


class RemovedInSphinx70Warning(PendingDeprecationWarning):
class RemovedInSphinx80Warning(PendingDeprecationWarning):
pass


RemovedInNextVersionWarning = RemovedInSphinx60Warning
RemovedInNextVersionWarning = RemovedInSphinx70Warning


def deprecated_alias(modname: str, objects: Dict[str, object],
Expand Down
42 changes: 2 additions & 40 deletions sphinx/directives/patches.py
@@ -1,16 +1,14 @@
import os
import warnings
from os import path
from typing import TYPE_CHECKING, Any, Dict, List, Sequence, Tuple, cast
from typing import TYPE_CHECKING, Any, Dict, List, Sequence, cast

from docutils import nodes
from docutils.nodes import Node, make_id, system_message
from docutils.nodes import Node, make_id
from docutils.parsers.rst import directives
from docutils.parsers.rst.directives import images, tables
from docutils.parsers.rst.roles import set_classes

from sphinx import addnodes
from sphinx.deprecation import RemovedInSphinx60Warning
from sphinx.directives import optional_int
from sphinx.domains.math import MathDomain
from sphinx.locale import __
Expand Down Expand Up @@ -78,24 +76,6 @@ def run(self) -> Sequence[Node]:
return result


class RSTTable(tables.RSTTable):
"""The table directive which sets source and line information to its caption.

Only for docutils-0.13 or older version."""

def run(self) -> List[Node]:
warnings.warn('RSTTable is deprecated.',
RemovedInSphinx60Warning)
return super().run()

def make_title(self) -> Tuple[nodes.title, List[system_message]]:
title, message = super().make_title()
if title:
set_source_info(self, title)

return title, message


class CSVTable(tables.CSVTable):
"""The csv-table directive which searches a CSV file from Sphinx project's source
directory when an absolute path is given via :file: option.
Expand All @@ -118,24 +98,6 @@ def run(self) -> List[Node]:
return super().run()


class ListTable(tables.ListTable):
"""The list-table directive which sets source and line information to its caption.

Only for docutils-0.13 or older version."""

def run(self) -> List[Node]:
warnings.warn('ListTable is deprecated.',
RemovedInSphinx60Warning)
return super().run()

def make_title(self) -> Tuple[nodes.title, List[system_message]]:
title, message = super().make_title()
if title:
set_source_info(self, title)

return title, message


class Code(SphinxDirective):
"""Parse and mark up content of a code block.

Expand Down