8000 Move deprecation warning control to ``sphinx.deprecation`` · sphinx-doc/sphinx@4daa038 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4daa038

Browse files
committed
Move deprecation warning control to sphinx.deprecation
1 parent 8e46d49 commit 4daa038

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

sphinx/__init__.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,17 @@
11
"""The Sphinx documentation toolchain."""
22

3-
from __future__ import annotations
4-
5-
__version__ = '8.3.0'
6-
__display_version__ = __version__ # used for command line version
7-
83
# Keep this file executable as-is in Python 3!
94
# (Otherwise getting the version out of it when packaging is impossible.)
105

11-
import os
6+
from __future__ import annotations
7+
128
import warnings
139

1410
from sphinx.util._pathlib import _StrPath
1511

16-
# by default, all DeprecationWarning under sphinx package will be emit.
17-
# Users can avoid this by using environment variable: PYTHONWARNINGS=
18-
if 'PYTHONWARNINGS' not in os.environ:
19-
from sphinx.deprecation import RemovedInNextVersionWarning
12+
__version__ = '8.3.0'
13+
__display_version__ = __version__ # used for command line version
2014

21-
warnings.filterwarnings('default', category=RemovedInNextVersionWarning)
2215
warnings.filterwarnings(
2316
'ignore',
2417
'The frontend.Option class .*',

sphinx/deprecation.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from __future__ import annotations
44

5+
import os
56
import warnings
67

78

@@ -16,6 +17,12 @@ class RemovedInSphinx10Warning(PendingDeprecationWarning):
1617
RemovedInNextVersionWarning = RemovedInSphinx90Warning
1718

1819

20+
# By default, all Sphinx deprecation warnings will be emitted.
21+
# To avoid this, set the environment variable: PYTHONWARNINGS=
22+
if 'PYTHONWARNINGS' not in os.environ:
23+
warnings.filterwarnings('default', category=RemovedInNextVersionWarning)
24+
25+
1926
def _deprecation_warning(
2027
module: str,
2128
attribute: str,

0 commit comments

Comments
 (0)
0