Sphinx 8.0.0rc1__py3-none-any.whl → 8.0.2__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of Sphinx might be problematic. Click here for more details.

Files changed (141) hide show
  1. sphinx/__init__.py +2 -2
  2. sphinx/application.py +5 -5
  3. sphinx/builders/linkcheck.py +3 -3
  4. sphinx/config.py +1 -1
  5. sphinx/environment/__init__.py +2 -1
  6. sphinx/highlighting.py +6 -0
  7. sphinx/locale/ar/LC_MESSAGES/sphinx.mo +0 -0
  8. sphinx/locale/ar/LC_MESSAGES/sphinx.po +2383 -2186
  9. sphinx/locale/bg/LC_MESSAGES/sphinx.mo +0 -0
  10. sphinx/locale/bg/LC_MESSAGES/sphinx.po +2249 -2052
  11. sphinx/locale/bn/LC_MESSAGES/sphinx.mo +0 -0
  12. sphinx/locale/bn/LC_MESSAGES/sphinx.po +2412 -2215
  13. sphinx/locale/ca/LC_MESSAGES/sphinx.mo +0 -0
  14. sphinx/locale/ca/LC_MESSAGES/sphinx.po +3029 -2832
  15. sphinx/locale/cak/LC_MESSAGES/sphinx.mo +0 -0
  16. sphinx/locale/cak/LC_MESSAGES/sphinx.po +2308 -2111
  17. sphinx/locale/cs/LC_MESSAGES/sphinx.mo +0 -0
  18. sphinx/locale/cs/LC_MESSAGES/sphinx.po +2469 -2272
  19. sphinx/locale/cy/LC_MESSAGES/sphinx.mo +0 -0
  20. sphinx/locale/cy/LC_MESSAGES/sphinx.po +2393 -2196
  21. sphinx/locale/da/LC_MESSAGES/sphinx.mo +0 -0
  22. sphinx/locale/da/LC_MESSAGES/sphinx.po +2532 -2335
  23. sphinx/locale/de/LC_MESSAGES/sphinx.mo +0 -0
  24. sphinx/locale/de/LC_MESSAGES/sphinx.po +2492 -2295
  25. sphinx/locale/de_DE/LC_MESSAGES/sphinx.mo +0 -0
  26. sphinx/locale/de_DE/LC_MESSAGES/sphinx.po +2250 -2053
  27. sphinx/locale/el/LC_MESSAGES/sphinx.mo +0 -0
  28. sphinx/locale/el/LC_MESSAGES/sphinx.po +2879 -2682
  29. sphinx/locale/en_DE/LC_MESSAGES/sphinx.mo +0 -0
  30. sphinx/locale/en_DE/LC_MESSAGES/sphinx.po +2250 -2053
  31. sphinx/locale/en_FR/LC_MESSAGES/sphinx.mo +0 -0
  32. sphinx/locale/en_FR/LC_MESSAGES/sphinx.po +2250 -2053
  33. sphinx/locale/en_GB/LC_MESSAGES/sphinx.mo +0 -0
  34. sphinx/locale/en_GB/LC_MESSAGES/sphinx.po +2989 -2792
  35. sphinx/locale/en_HK/LC_MESSAGES/sphinx.mo +0 -0
  36. sphinx/locale/en_HK/LC_MESSAGES/sphinx.po +2250 -2053
  37. sphinx/locale/eo/LC_MESSAGES/sphinx.mo +0 -0
  38. sphinx/locale/eo/LC_MESSAGES/sphinx.po +2297 -2100
  39. sphinx/locale/es/LC_MESSAGES/sphinx.mo +0 -0
  40. sphinx/locale/es/LC_MESSAGES/sphinx.po +3017 -2820
  41. sphinx/locale/es_CO/LC_MESSAGES/sphinx.mo +0 -0
  42. sphinx/locale/es_CO/LC_MESSAGES/sphinx.po +2250 -2053
  43. sphinx/locale/et/LC_MESSAGES/sphinx.mo +0 -0
  44. sphinx/locale/et/LC_MESSAGES/sphinx.po +2748 -2551
  45. sphinx/locale/eu/LC_MESSAGES/sphinx.mo +0 -0
  46. sphinx/locale/eu/LC_MESSAGES/sphinx.po +2459 -2262
  47. sphinx/locale/fa/LC_MESSAGES/sphinx.mo +0 -0
  48. sphinx/locale/fa/LC_MESSAGES/sphinx.po +2957 -2760
  49. sphinx/locale/fi/LC_MESSAGES/sphinx.mo +0 -0
  50. sphinx/locale/fi/LC_MESSAGES/sphinx.po +2321 -2124
  51. sphinx/locale/fr/LC_MESSAGES/sphinx.mo +0 -0
  52. sphinx/locale/fr/LC_MESSAGES/sphinx.po +2977 -2780
  53. sphinx/locale/fr_FR/LC_MESSAGES/sphinx.mo +0 -0
  54. sphinx/locale/fr_FR/LC_MESSAGES/sphinx.po +2250 -2053
  55. sphinx/locale/gl/LC_MESSAGES/sphinx.mo +0 -0
  56. sphinx/locale/gl/LC_MESSAGES/sphinx.po +2992 -2795
  57. sphinx/locale/he/LC_MESSAGES/sphinx.mo +0 -0
  58. sphinx/locale/he/LC_MESSAGES/sphinx.po +2375 -2178
  59. sphinx/locale/hi/LC_MESSAGES/sphinx.mo +0 -0
  60. sphinx/locale/hi/LC_MESSAGES/sphinx.po +2937 -2740
  61. sphinx/locale/hi_IN/LC_MESSAGES/sphinx.mo +0 -0
  62. sphinx/locale/hi_IN/LC_MESSAGES/sphinx.po +2250 -2053
  63. sphinx/locale/hr/LC_MESSAGES/sphinx.mo +0 -0
  64. sphinx/locale/hr/LC_MESSAGES/sphinx.po +2532 -2335
  65. sphinx/locale/hu/LC_MESSAGES/sphinx.mo +0 -0
  66. sphinx/locale/hu/LC_MESSAGES/sphinx.po +2505 -2308
  67. sphinx/locale/id/LC_MESSAGES/sphinx.mo +0 -0
  68. sphinx/locale/id/LC_MESSAGES/sphinx.po +2925 -2728
  69. sphinx/locale/is/LC_MESSAGES/sphinx.mo +0 -0
  70. sphinx/locale/is/LC_MESSAGES/sphinx.po +2307 -2110
  71. sphinx/locale/it/LC_MESSAGES/sphinx.mo +0 -0
  72. sphinx/locale/it/LC_MESSAGES/sphinx.po +2514 -2317
  73. sphinx/locale/ja/LC_MESSAGES/sphinx.mo +0 -0
  74. sphinx/locale/ja/LC_MESSAGES/sphinx.po +2970 -2773
  75. sphinx/locale/ka/LC_MESSAGES/sphinx.mo +0 -0
  76. sphinx/locale/ka/LC_MESSAGES/sphinx.po +2868 -2671
  77. sphinx/locale/ko/LC_MESSAGES/sphinx.mo +0 -0
  78. sphinx/locale/ko/LC_MESSAGES/sphinx.po +3016 -2819
  79. sphinx/locale/lt/LC_MESSAGES/sphinx.mo +0 -0
  80. sphinx/locale/lt/LC_MESSAGES/sphinx.po +2476 -2279
  81. sphinx/locale/lv/LC_MESSAGES/sphinx.mo +0 -0
  82. sphinx/locale/lv/LC_MESSAGES/sphinx.po +2477 -2280
  83. sphinx/locale/mk/LC_MESSAGES/sphinx.mo +0 -0
  84. sphinx/locale/mk/LC_MESSAGES/sphinx.po +2292 -2095
  85. sphinx/locale/nb_NO/LC_MESSAGES/sphinx.mo +0 -0
  86. sphinx/locale/nb_NO/LC_MESSAGES/sphinx.po +2479 -2282
  87. sphinx/locale/ne/LC_MESSAGES/sphinx.mo +0 -0
  88. sphinx/locale/ne/LC_MESSAGES/sphinx.po +2481 -2284
  89. sphinx/locale/nl/LC_MESSAGES/sphinx.mo +0 -0
  90. sphinx/locale/nl/LC_MESSAGES/sphinx.po +2557 -2360
  91. sphinx/locale/pl/LC_MESSAGES/sphinx.mo +0 -0
  92. sphinx/locale/pl/LC_MESSAGES/sphinx.po +2696 -2499
  93. sphinx/locale/pt/LC_MESSAGES/sphinx.mo +0 -0
  94. sphinx/locale/pt/LC_MESSAGES/sphinx.po +2250 -2053
  95. sphinx/locale/pt_BR/LC_MESSAGES/sphinx.mo +0 -0
  96. sphinx/locale/pt_BR/LC_MESSAGES/sphinx.po +2979 -2782
  97. sphinx/locale/pt_PT/LC_MESSAGES/sphinx.mo +0 -0
  98. sphinx/locale/pt_PT/LC_MESSAGES/sphinx.po +2469 -2272
  99. sphinx/locale/ro/LC_MESSAGES/sphinx.mo +0 -0
  100. sphinx/locale/ro/LC_MESSAGES/sphinx.po +2473 -2276
  101. sphinx/locale/ru/LC_MESSAGES/sphinx.mo +0 -0
  102. sphinx/locale/ru/LC_MESSAGES/sphinx.po +2746 -2549
  103. sphinx/locale/si/LC_MESSAGES/sphinx.mo +0 -0
  104. sphinx/locale/si/LC_MESSAGES/sphinx.po +2331 -2134
  105. sphinx/locale/sk/LC_MESSAGES/sphinx.mo +0 -0
  106. sphinx/locale/sk/LC_MESSAGES/sphinx.po +2966 -2769
  107. sphinx/locale/sl/LC_MESSAGES/sphinx.mo +0 -0
  108. sphinx/locale/sl/LC_MESSAGES/sphinx.po +2404 -2207
  109. sphinx/locale/sphinx.pot +2262 -2065
  110. sphinx/locale/sq/LC_MESSAGES/sphinx.mo +0 -0
  111. sphinx/locale/sq/LC_MESSAGES/sphinx.po +2972 -2775
  112. sphinx/locale/sr/LC_MESSAGES/sphinx.mo +0 -0
  113. sphinx/locale/sr/LC_MESSAGES/sphinx.po +2440 -2243
  114. sphinx/locale/sv/LC_MESSAGES/sphinx.mo +0 -0
  115. sphinx/locale/sv/LC_MESSAGES/sphinx.po +2483 -2286
  116. sphinx/locale/te/LC_MESSAGES/sphinx.mo +0 -0
  117. sphinx/locale/te/LC_MESSAGES/sphinx.po +2250 -2053
  118. sphinx/locale/tr/LC_MESSAGES/sphinx.mo +0 -0
  119. sphinx/locale/tr/LC_MESSAGES/sphinx.po +2892 -2695
  120. sphinx/locale/uk_UA/LC_MESSAGES/sphinx.mo +0 -0
  121. sphinx/locale/uk_UA/LC_MESSAGES/sphinx.po +2400 -2203
  122. sphinx/locale/ur/LC_MESSAGES/sphinx.mo +0 -0
  123. sphinx/locale/ur/LC_MESSAGES/sphinx.po +2250 -2053
  124. sphinx/locale/vi/LC_MESSAGES/sphinx.mo +0 -0
  125. sphinx/locale/vi/LC_MESSAGES/sphinx.po +2422 -2225
  126. sphinx/locale/yue/LC_MESSAGES/sphinx.mo +0 -0
  127. sphinx/locale/yue/LC_MESSAGES/sphinx.po +2250 -2053
  128. sphinx/locale/zh_HK/LC_MESSAGES/sphinx.mo +0 -0
  129. sphinx/locale/zh_HK/LC_MESSAGES/sphinx.po +2250 -2053
  130. sphinx/locale/zh_TW/LC_MESSAGES/sphinx.mo +0 -0
  131. sphinx/locale/zh_TW/LC_MESSAGES/sphinx.po +3028 -2831
  132. sphinx/locale/zh_TW.Big5/LC_MESSAGES/sphinx.mo +0 -0
  133. sphinx/locale/zh_TW.Big5/LC_MESSAGES/sphinx.po +2250 -2053
  134. sphinx/project.py +5 -4
  135. sphinx/util/_pathlib.py +132 -0
  136. sphinx/util/osutil.py +8 -5
  137. {sphinx-8.0.0rc1.dist-info → sphinx-8.0.2.dist-info}/METADATA +3 -3
  138. {sphinx-8.0.0rc1.dist-info → sphinx-8.0.2.dist-info}/RECORD +141 -140
  139. {sphinx-8.0.0rc1.dist-info → sphinx-8.0.2.dist-info}/LICENSE.rst +0 -0
  140. {sphinx-8.0.0rc1.dist-info → sphinx-8.0.2.dist-info}/WHEEL +0 -0
  141. {sphinx-8.0.0rc1.dist-info → sphinx-8.0.2.dist-info}/entry_points.txt +0 -0
sphinx/project.py CHANGED
@@ -9,6 +9,7 @@ from typing import TYPE_CHECKING
9
9
 
10
10
  from sphinx.locale import __
11
11
  from sphinx.util import logging
12
+ from sphinx.util._pathlib import _StrPath
12
13
  from sphinx.util.matching import get_matching_files
13
14
  from sphinx.util.osutil import path_stabilize
14
15
 
@@ -24,7 +25,7 @@ class Project:
24
25
 
25
26
  def __init__(self, srcdir: str | os.PathLike[str], source_suffix: Iterable[str]) -> None:
26
27
  #: Source directory.
27
- self.srcdir = Path(srcdir)
28
+ self.srcdir = _StrPath(srcdir)
28
29
 
29
30
  #: source_suffix. Same as :confval:`source_suffix`.
30
31
  self.source_suffix = tuple(source_suffix)
@@ -106,7 +107,7 @@ class Project:
106
107
  # the file does not have a docname
107
108
  return None
108
109
 
109
- def doc2path(self, docname: str, absolute: bool) -> Path:
110
+ def doc2path(self, docname: str, absolute: bool) -> _StrPath:
110
111
  """Return the filename for the document name.
111
112
 
112
113
  If *absolute* is True, return as an absolute path.
@@ -119,5 +120,5 @@ class Project:
119
120
  filename = Path(docname + self._first_source_suffix)
120
121
 
121
122
  if absolute:
122
- return self.srcdir / filename
123
- return filename
123
+ return _StrPath(self.srcdir / filename)
124
+ return _StrPath(filename)
@@ -0,0 +1,132 @@
1
+ """What follows is awful and will be gone in Sphinx 9.
2
+
3
+ Instances of _StrPath should not be constructed except in Sphinx itself.
4
+ Consumers of Sphinx APIs should prefer using ``pathlib.Path`` objects
5
+ where possible. _StrPath objects can be treated as equivalent to ``Path``,
6
+ save that ``_StrPath.replace`` is overriden with ``str.replace``.
7
+
8
+ To continue treating path-like objects as strings, use ``os.fspath``,
9
+ or explicit string coercion.
10
+
11
+ In Sphinx 9, ``Path`` objects will be expected and returned in all instances
12
+ that ``_StrPath`` is currently used.
13
+ """
14
+
15
+ from __future__ import annotations
16
+
17
+ import sys
18
+ import warnings
19
+ from pathlib import Path, PosixPath, PurePath, WindowsPath
20
+ from typing import Any
21
+
22
+ from sphinx.deprecation import RemovedInSphinx90Warning
23
+
24
+ _STR_METHODS = frozenset(str.__dict__)
25
+ _PATH_NAME = Path().__class__.__name__
26
+
27
+ _MSG = (
28
+ 'Sphinx 9 will drop support for representing paths as strings. '
29
+ 'Use "pathlib.Path" or "os.fspath" instead.'
30
+ )
31
+
32
+ # https://docs.python.org/3/library/stdtypes.html#typesseq-common
33
+ # https://docs.python.org/3/library/stdtypes.html#string-methods
34
+
35
+ if sys.platform == 'win32':
36
+ class _StrPath(WindowsPath):
37
+ def replace( # type: ignore[override]
38
+ self, old: str, new: str, count: int = -1, /,
39
+ ) -> str:
40
+ # replace exists in both Path and str;
41
+ # in Path it makes filesystem changes, so we use the safer str version
42
+ warnings.warn(_MSG, RemovedInSphinx90Warning, stacklevel=2)
43
+ return self.__str__().replace(old, new, count) # NoQA: PLC2801
44
+
45
+ def __getattr__(self, item: str) -> Any:
46
+ if item in _STR_METHODS:
47
+ warnings.warn(_MSG, RemovedInSphinx90Warning, stacklevel=2)
48
+ return getattr(self.__str__(), item)
49
+ msg = f'{_PATH_NAME!r} has no attribute {item!r}'
50
+ raise AttributeError(msg)
51
+
52
+ def __add__(self, other: str) -> str:
53
+ warnings.warn(_MSG, RemovedInSphinx90Warning, stacklevel=2)
54
+ return self.__str__() + other
55
+
56
+ def __bool__(self) -> bool:
57
+ if not self.__str__():
58
+ warnings.warn(_MSG, RemovedInSphinx90Warning, stacklevel=2)
59
+ return False
60
+ return True
61
+
62
+ def __contains__(self, item: str) -> bool:
63
+ warnings.warn(_MSG, RemovedInSphinx90Warning, stacklevel=2)
64
+ return item in self.__str__()
65
+
66
+ def __eq__(self, other: object) -> bool:
67
+ if isinstance(other, PurePath):
68
+ return super().__eq__(other)
69
+ if isinstance(other, str):
70
+ warnings.warn(_MSG, RemovedInSphinx90Warning, stacklevel=2)
71
+ return self.__str__() == other
72
+ return NotImplemented
73
+
74
+ def __hash__(self) -> int:
75
+ return super().__hash__()
76
+
77
+ def __getitem__(self, item: int | slice) -> str:
78
+ warnings.warn(_MSG, RemovedInSphinx90Warning, stacklevel=2)
79
+ return self.__str__()[item]
80
+
81
+ def __len__(self) -> int:
82
+ warnings.warn(_MSG, RemovedInSphinx90Warning, stacklevel=2)
83
+ return len(self.__str__())
84
+ else:
85
+ class _StrPath(PosixPath):
86
+ def replace( # type: ignore[override]
87
+ self, old: str, new: str, count: int = -1, /,
88
+ ) -> str:
89
+ # replace exists in both Path and str;
90
+ # in Path it makes filesystem changes, so we use the safer str version
91
+ warnings.warn(_MSG, RemovedInSphinx90Warning, stacklevel=2)
92
+ return self.__str__().replace(old, new, count) # NoQA: PLC2801
93
+
94
+ def __getattr__(self, item: str) -> Any:
95
+ if item in _STR_METHODS:
96
+ warnings.warn(_MSG, RemovedInSphinx90Warning, stacklevel=2)
97
+ return getattr(self.__str__(), item)
98
+ msg = f'{_PATH_NAME!r} has no attribute {item!r}'
99
+ raise AttributeError(msg)
100
+
101
+ def __add__(self, other: str) -> str:
102
+ warnings.warn(_MSG, RemovedInSphinx90Warning, stacklevel=2)
103
+ return self.__str__() + other
104
+
105
+ def __bool__(self) -> bool:
106
+ if not self.__str__():
107
+ warnings.warn(_MSG, RemovedInSphinx90Warning, stacklevel=2)
108
+ return False
109
+ return True
110
+
111
+ def __contains__(self, item: str) -> bool:
112
+ warnings.warn(_MSG, RemovedInSphinx90Warning, stacklevel=2)
113
+ return item in self.__str__()
114
+
115
+ def __eq__(self, other: object) -> bool:
116
+ if isinstance(other, PurePath):
117
+ return super().__eq__(other)
118
+ if isinstance(other, str):
119
+ warnings.warn(_MSG, RemovedInSphinx90Warning, stacklevel=2)
120
+ return self.__str__() == other
121
+ return NotImplemented
122
+
123
+ def __hash__(self) -> int:
124
+ return super().__hash__()
125
+
126
+ def __getitem__(self, item: int | slice) -> str:
127
+ warnings.warn(_MSG, RemovedInSphinx90Warning, stacklevel=2)
128
+ return self.__str__()[item]
129
+
130
+ def __len__(self) -> int:
131
+ warnings.warn(_MSG, RemovedInSphinx90Warning, stacklevel=2)
132
+ return len(self.__str__())
sphinx/util/osutil.py CHANGED
@@ -11,12 +11,12 @@ import sys
11
11
  import unicodedata
12
12
  from io import StringIO
13
13
  from os import path
14
+ from pathlib import Path
14
15
  from typing import TYPE_CHECKING
15
16
 
16
17
  from sphinx.locale import __
17
18
 
18
19
  if TYPE_CHECKING:
19
- from pathlib import Path
20
20
  from types import TracebackType
21
21
  from typing import Any
22
22
 
@@ -107,12 +107,15 @@ def copyfile(
107
107
 
108
108
  .. note:: :func:`copyfile` is a no-op if *source* and *dest* are identical.
109
109
  """
110
- if not path.exists(source):
111
- msg = f'{os.fsdecode(source)} does not exist'
110
+ # coerce to Path objects
111
+ source = Path(source)
112
+ dest = Path(dest)
113
+ if not source.exists():
114
+ msg = f'{source} does not exist'
112
115
  raise FileNotFoundError(msg)
113
116
 
114
117
  if (
115
- not (dest_exists := path.exists(dest)) or
118
+ not (dest_exists := dest.exists()) or
116
119
  # comparison must be done using shallow=False since
117
120
  # two different files might have the same size
118
121
  not filecmp.cmp(source, dest, shallow=False)
@@ -125,7 +128,7 @@ def copyfile(
125
128
 
126
129
  msg = __('Aborted attempted copy from %s to %s '
127
130
  '(the destination path has existing data).')
128
- logger.warning(msg, os.fsdecode(source), os.fsdecode(dest),
131
+ logger.warning(msg, source, dest,
129
132
  type='misc', subtype='copy_overwrite')
130
133
  return
131
134
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: Sphinx
3
- Version: 8.0.0rc1
3
+ Version: 8.0.2
4
4
  Summary: Python documentation generator
5
5
  Author-email: Georg Brandl <georg@python.org>
6
6
  Requires-Python: >=3.10
@@ -52,7 +52,7 @@ Requires-Dist: Pygments>=2.17
52
52
  Requires-Dist: docutils>=0.20,<0.22
53
53
  Requires-Dist: snowballstemmer>=2.2
54
54
  Requires-Dist: babel>=2.13
55
- Requires-Dist: alabaster~=0.7.14
55
+ Requires-Dist: alabaster>=0.7.14
56
56
  Requires-Dist: imagesize>=1.3
57
57
  Requires-Dist: requests>=2.30.0
58
58
  Requires-Dist: packaging>=23.0
@@ -60,7 +60,7 @@ Requires-Dist: tomli>=2; python_version < '3.11'
60
60
  Requires-Dist: colorama>=0.4.6; sys_platform == 'win32'
61
61
  Requires-Dist: sphinxcontrib-websupport ; extra == "docs"
62
62
  Requires-Dist: flake8>=6.0 ; extra == "lint"
63
- Requires-Dist: ruff==0.5.4 ; extra == "lint"
63
+ Requires-Dist: ruff==0.5.5 ; extra == "lint"
64
64
  Requires-Dist: mypy==1.11.0 ; extra == "lint"
65
65
  Requires-Dist: sphinx-lint>=0.9 ; extra == "lint"
66
66
  Requires-Dist: types-colorama==0.4.15.20240311 ; extra == "lint"