Commit Graph

703 Commits

Author SHA1 Message Date
Adam Turner
4032070e81
Run pyupgrade (#11070) 2023-01-02 00:01:14 +00:00
Adam Turner
14a9289d78 Use PEP 604 types 2023-01-01 20:48:39 +00:00
Adam Turner
26f79b0d2d Use PEP 595 types 2023-01-01 20:48:38 +00:00
Adam Turner
f4c8a0a68e Insert `from __future__ import annotations` 2023-01-01 20:48:37 +00:00
Daniel Eades
1abb24e309 remove blanket 'noqas' 2022-12-16 16:50:24 +01:00
Adam Turner
cd3f2e4350 Update typing ignores for mypy 0.990 2022-11-13 20:36:24 +00:00
Adam Turner
51927bb6e4 Merge branch '5.x' 2022-09-27 16:02:52 +01:00
Stephen Finucane
9ab21ce51a Combine 'compile_xxx' and 'build_xxx' functions
These are only called from the one location and we already use 'build'
to do both building and writing. Given that we intend to simplify the
handling of the 'filenames' argument, this makes our lives there much
easier.

Signed-off-by: Stephen Finucane <stephen@that.guru>
2022-09-26 17:50:57 +01:00
Adam Turner
f01d50d695 Merge branch '5.x'
# Conflicts:
#	CHANGES
#	doc/conf.py
#	sphinx/__init__.py
#	sphinx/builders/html/__init__.py
#	sphinx/domains/python.py
#	tests/test_build_html.py
2022-09-25 21:36:30 +01:00
Arthur Milchior
65081218ce
Docstring clarifications (#9877)
Co-authored-by: Jakob Lykke Andersen <jakobandersen@users.noreply.github.com>
Co-authored-by: Takeshi KOMIYA <i.tkomiya@gmail.com>
Co-authored-by: Adam Turner <9087854+AA-Turner@users.noreply.github.com>
2022-09-24 15:30:57 +01:00
Adam Turner
14c9b40f15 Merge branch '5.x'
# Conflicts:
#	setup.py
#	sphinx/application.py
#	sphinx/environment/__init__.py
#	sphinx/ext/autodoc/directive.py
#	tests/test_build_html.py
2022-09-09 09:58:24 +01:00
danieleades
5e9550c78e
Fix more strict static typing errors (#10681) 2022-08-28 21:17:14 +01:00
Adam Turner
94024e6efa Merge branch '5.x'
# Conflicts:
#	sphinx/ext/autodoc/__init__.py
#	sphinx/writers/html5.py
2022-07-18 22:49:56 +01:00
danieleades
a504ac6100
Improve static typing strictness (#10569) 2022-07-18 22:08:16 +01:00
Adam Turner
1e3ade55fe Merge branch '5.x' 2022-07-10 23:05:23 +01:00
Jeremy Maitin-Shepard
66f9ee4afd Make -P (pdb) work better with exceptions triggered from events
Previously, if an exception was raised from an event listener, and the
`-P` option was specified, the debugger would be started not for the
original error but for the `ExtensionError` wrapping it that was
raised by `EventManager.emit`.  That made it difficult to debug the
error.

With this change, when `-P` is specified, wrapping of errors in
`ExtensionError` is disabled, which allows pdb to debug the original
error.
2022-07-04 18:48:44 -07:00
Adam Turner
ac0fc4b781
Remove more deprecated items in Sphinx 6.0 (#10562) 2022-06-26 15:01:09 +01:00
Adam Turner
7e38d2dad8 Merge branch '5.x'
# Conflicts:
#	.github/workflows/builddoc.yml
#	.github/workflows/lint.yml
#	sphinx/registry.py
2022-06-16 21:46:54 +01:00
Adam Turner
ce31e1c0c7
Remove deprecated items for Sphinx 6.0 (#10471) 2022-06-16 21:05:37 +01:00
Adam Turner
6ef22d2613
Increase static typing strictness (#10530) 2022-06-16 19:50:01 +01:00
Takeshi KOMIYA
83a6a1eb13 Close #10483: Fix type annotations for Sphinx.__init__() 2022-05-30 03:07:57 +09:00
Takeshi KOMIYA
6065ab676c Fix #10110: sphinx-build: Emit builder-finished before shutdown
The error on the builder-finished event has been ignored for the
calculation of the exit code.  This emits the event earilier step to be
calculated correctly.
2022-05-15 23:17:35 +09:00
Takeshi KOMIYA
aa1bc83c2a Merge branch '4.x' 2022-03-19 22:58:15 +09:00
Adam Turner
6bb7b891a1 Remove copyright and licence fields 2022-02-20 03:06:23 +00:00
Adam Turner
5694e0ce60 Fix module docstring indentation 2022-02-20 00:35:13 +00:00
Adam Turner
4f5a3269a6 Fix module docstring first line 2022-02-20 00:11:08 +00:00
Adam Turner
6b8bccec59 Remove module titles in docstrings 2022-02-19 23:17:29 +00:00
Takeshi KOMIYA
e4e58a4f27 Close #10062: Change the default language to 'en'
Change the default language to `'en'` if any language is not set in
`conf.py`.
2022-01-12 02:45:52 +09:00
Takeshi KOMIYA
f38bd8e952 Merge branch '4.3.x' into 4.x 2022-01-01 20:02:10 +09:00
Takeshi KOMIYA
b84771dcd2 A happy new year! 2022-01-01 18:45:03 +09:00
Takeshi KOMIYA
b5bf745f68 Close #10013: html: Allow to change the loading method of JavaScript 2021-12-25 23:41:02 +09:00
Takeshi KOMIYA
e8b3c9cf18 refactor: docs: Use :param: fields for add_js_file() and add_css_file() 2021-12-25 18:42:36 +09:00
Takeshi KOMIYA
4c7df3f09a
Merge pull request #9793 from samdoran/enable-parallel-on-macos
Set multiprocessing start method to `fork`
2021-12-11 11:23:34 +09:00
Takeshi KOMIYA
203094b4c3 Close #9618: i18n: Add gettext_allow_fuzzy_translations 2021-11-10 01:32:02 +09:00
Sam Doran
83225767cb Set multiprocessing start method to fork
Since the current code requires forking, set it explicitly rather than disabling
parallelization on macOS.
2021-10-28 12:38:56 -04:00
Takeshi KOMIYA
1fbca49970 Close #9683: Revert the removal of `add_stylesheet()` API
It will be kept until the Sphinx-6.0 release.

Note: Now it emits a warning instead of DeprecationWarning to let the
users know the deprecation.
2021-10-03 16:34:57 +09:00
Louis Maddox
10dba797f2 Address flake8 errors in whitespace linting 2021-07-23 21:53:46 +01:00
Louis Maddox
efb6848ea9
Improvements to sphinx.application docstrings 2021-07-18 18:24:39 +01:00
Manuel Kaufmann
f312792023
Merge branch '4.x' into humitos/add-html-assets-in-all-pages 2021-06-14 17:04:09 +02:00
Manuel Kaufmann
c818a70528 Rename variable to html_assets_policy 2021-06-14 16:50:26 +02:00
James McKinney
654f11e90c
fix: Fix typo in add_directive docstring 2021-06-05 12:38:00 -04:00
Takeshi KOMIYA
abe5ab4fa7
Merge pull request #9242 from tk0miya/refactor_env2
refactor: Make the app argument for BuildEnvironment required
2021-05-22 02:22:42 +09:00
Takeshi KOMIYA
63fbfb02f1 refactor: Make the app argument for BuildEnvironment required
At present, some attributes of env object are considered as optional
because they have been initialized by None on the constructor.  But
they have always been fullfilled actually.

To be clear the type hints of the env object, this makes the `app`
argument for the BuildEnvironment class required.  It can ensure the
attributes of env object are not optional.
2021-05-22 02:09:49 +09:00
Takeshi KOMIYA
549f09e048
Merge pull request #9239 from igo95862/https-links
Upgrade URLs to use HTTPS
2021-05-19 22:59:19 +09:00
Takeshi KOMIYA
e5f6c77263 refactor: Do config file existence check in Config.read() 2021-05-16 23:48:42 +09:00
igo95862
e67c9e5df1
doc: Upgrade docutils.sourceforge.io links to HTTPS
Also change any docutils.sourceforge.net link to io
top level domain.
2021-05-16 15:53:49 +03:00
Takeshi KOMIYA
5078069eb1 Deprecate app.html_themes
The register is much better to store the HTML themes instead of the
application object.  So this migrates it to the registry object.
2021-05-12 01:36:14 +09:00
Takeshi KOMIYA
2ee634bfda refactor: Add Optional to type annotations 2021-05-10 02:01:24 +09:00
Manuel Kaufmann
d01e776c81 Add Sphinx.add_html_assets_in_all_pages
This new method in the `Sphinx` object allows extensions to communicate to
Sphinx that it's preferred to include HTML assets in all the pages. However,
it's extensions developers' responsability to follow this config and decide
whether or not include the assets required.

Extensions developers' can check `Sphinx.html_assets_in_all_pages` together with
any other logic they may have to decide if the assets will be included in the
rendered page or not.

Closes #9115
2021-05-06 15:21:12 +02:00
Takeshi KOMIYA
fe6d95e429
Merge branch 'master' into patch-1 2021-04-10 00:32:26 +09:00
Martin Hasoň
7327e56dff
Depart method for node is optional 2021-04-09 12:44:10 +02:00
Takeshi KOMIYA
3ad1e5e7d1
Merge pull request #9064 from tk0miya/refactor_type_annotation
refactor: Add Optional to type annotations
2021-04-08 21:42:21 +09:00
Takeshi KOMIYA
d3f0de4e12 refactor: Add Optional to type annotations 2021-04-08 01:56:50 +09:00
Takeshi KOMIYA
eb68c237dd refactor: Use PEP-526 based variable annotation 2021-04-08 01:54:17 +09:00
Takeshi KOMIYA
1b0d4672a4 refactor: use raw Type for type annotations 2021-04-04 14:47:43 +09:00
igo95862
c57cb0b5ed doc: Link autodoc tutorial in add_autodocumenter docstring
Uses :ref: link because :doc: does not work.
2021-03-09 17:57:30 +03:00
Takeshi KOMIYA
d25c3ad241 Update type annotations 2021-02-09 22:49:01 +09:00
Takeshi KOMIYA
c9480f9943 Merge branch '3.x' 2021-01-28 00:56:46 +09:00
Takeshi KOMIYA
84ef92226f doc: Apply :params: to some APIs in app class 2021-01-26 01:19:47 +09:00
Takeshi KOMIYA
0ad32905bf Merge branch '3.x' 2021-01-24 16:39:43 +09:00
Takeshi KOMIYA
851716cd1a
Merge pull request #8744 from tk0miya/refactor_doc4
doc: Apply :params: to some APIs in app class
2021-01-24 14:39:21 +09:00
Takeshi KOMIYA
502c4ee5fb Merge branch '3.x' 2021-01-24 14:32:13 +09:00
Takeshi KOMIYA
59036b1e65
Update sphinx/application.py 2021-01-24 14:16:26 +09:00
Takeshi KOMIYA
a2d6ee6108 doc: Apply :params: to some APIs in app class 2021-01-24 01:11:04 +09:00
Takeshi KOMIYA
f873a5890f Fix #8054: Add explanation for types argument of add_config_value() 2021-01-24 00:44:20 +09:00
Takeshi KOMIYA
5460ea103b Merge branch '3.x' 2021-01-08 01:23:17 +09:00
Takeshi KOMIYA
af4e615a8a Close #6241: html: Allow to add JS/CSS files to the specific page
Allow to add JS/CSS files to the specific page when an extension calls
`app.add_js_file()` or `app.add_css_file()` on `html-page-context`
event.
2021-01-07 02:12:07 +09:00
Takeshi KOMIYA
5b392e3951 refactor: Move CSS tags in basic/layout.html to `css_files` variable
To make CSS customizable, all CSS files in basic/layout.html has their
priority: 200.  Therefore, extensions and users can insert their own
custom CSS files before or just after them.

As a side effect, the CSS tags in basic/layout.html are removed.  These
CSS files will be rendered via `css_files` template variable.

refs: #8634, c5f0398010
2021-01-03 02:41:17 +09:00
Takeshi KOMIYA
a9c7dd7037 Merge branch '3.x' 2021-01-03 00:20:27 +09:00
Takeshi KOMIYA
7739b7d7dd doc: Add explanation about stable sort of html_*_files 2021-01-03 00:17:19 +09:00
Takeshi KOMIYA
c5f0398010 Close #8634: html: Allow to change the order of JS/CSS
`Sphinx.add_js_file()` and `Sphinx.add_css_file()` take `priority`
argument to change the order of JS/CSS files.
2021-01-02 02:06:34 +09:00
Takeshi KOMIYA
4b452338f9 Merge branch '3.x' 2021-01-01 13:57:19 +09:00
Takeshi KOMIYA
f996859420 A happy new year!
.. note::

   $ find sphinx tests LICENSE doc/conf.py -type f -exec sed -i '' -e 's/2007\-20../2007-2021/' {} \;
   $ git co sphinx/locale/**/*.js sphinx/templates/epub3/mimetype
2021-01-01 13:40:48 +09:00
Takeshi KOMIYA
3a4ae2092a Merge branch '3.x' 2020-11-21 01:01:36 +09:00
Takeshi KOMIYA
ce53ccefba Fix #8398: Fix type annotation for "confdir" of Sphinx.__init__()
None is allowed to the argument. So it should be "Optional[str]" instead
of "str".
2020-11-13 02:22:15 +09:00
Takeshi KOMIYA
a3af1e860b Merge branch '3.3.x' into 3.x 2020-11-12 23:40:41 +09:00
Takeshi KOMIYA
279e547860 Merge branch '3.x' 2020-11-12 02:50:43 +09:00
François Freitag
0949735210
Sort imports with isort
Keep imports alphabetically sorted and their order homogeneous across
Python source files.

The isort project has more feature and is more active than the
flake8-import-order plugin.

Most issues caught were simply import ordering from the same module.
Where imports were purposefully placed out of order, tag with
isort:skip.
2020-11-11 13:19:05 +01:00
Dmitry Shachnev
f92989ca6f Put system locale path after the paths specified by configuration
In Debian, we ship the translation data for Sphinx in the default search
path, /usr/share/locale/. When a .mo file is present there, it takes
priority over the translation files specified by the configuration, so
overriding does not work. This makes test_customize_system_message fail.
2020-11-09 21:37:01 +03:00
Takeshi KOMIYA
445b9515c1 Merge branch '3.x' 2020-10-24 18:12:45 +09:00
Takeshi KOMIYA
c82d1c76e1
Merge pull request #8281 from tk0miya/8073_update_directive_example
docs: Fix an example for add_directive()
2020-10-06 00:49:17 +09:00
Takeshi KOMIYA
ca87e47b7d
Merge pull request #8280 from tk0miya/refactor_add_source_parser
refactor: Change signature of app.add_source_parser()
2020-10-06 00:48:37 +09:00
Takeshi KOMIYA
598b85da75 Merge branch '3.x' into master 2020-10-04 22:41:44 +09:00
Takeshi KOMIYA
7b395f6b25 docs: Fix an example for add_directive() 2020-10-04 14:22:02 +09:00
Takeshi KOMIYA
129e09c6e3 refactor: Change signature of app.add_source_parser()
To make compatible with old versions, app.add_source_parser() have taken
two types of arguments.  But the compatibility was no longer needed
since 3.0.  So it would be better to use clearer signature.
2020-10-04 14:15:43 +09:00
Takeshi KOMIYA
7f7a207626 docs: Add documentation for "override" flag of app API 2020-10-04 14:13:03 +09:00
Takeshi KOMIYA
37235c71e0 Fix #6640: i18n: Failed to override system message translation
Our document describes that users can override system messages via
their own message catalog named `sphinx.mo` under the locale_dirs.
But it has not been used since its beginning of i18n mechanism because
the priority of users' message catalog is lower than system's.

This makes the priority of users' message catalog higher than system's.
2020-10-04 13:31:37 +09:00
Dominic Davis-Foster
05ad7e8020 Fix typo in warning emitted from Sphinx.add_lexer() 2020-08-25 13:48:17 +01:00
Takeshi KOMIYA
44f4b2ad97 Merge tag 'v3.1.0' 2020-07-05 00:10:47 +09:00
Brandon Houghton
cb9dd0a0b4
Fix reported dir when throwing ApplicationError
if path.exists(self.outdir) and not path.isdir(self.outdir), error reported self.srcdir which should be self.outdir
2020-06-03 15:33:58 -04:00
Takeshi KOMIYA
068b9b5738 Merge branch '3.x' 2020-06-04 00:18:30 +09:00
Takeshi KOMIYA
d501b94311 latex: Allow to add LaTeX package after hyperref loaded via API 2020-05-24 01:51:46 +09:00
Takeshi KOMIYA
3206e3154a Add allowed_exceptions parameter to Sphinx.emit() (refs: #7683)
It allows handlers to raise specified exceptions.
2020-05-17 19:18:10 +09:00
Takeshi KOMIYA
3c7d35d2a2 Merge branch '3.x' 2020-05-17 19:12:56 +09:00
Álvaro Mondéjar
62b44e6456 Fix double space inconsistences in code, CHANGES and translations. 2020-05-09 14:44:39 +02:00
Takeshi KOMIYA
41b4a77dea Add stacklevel parameter to warnings.warn() call 2020-05-03 23:34:35 +09:00
Takeshi KOMIYA
a86346aca6 Remove deprecated features marked as RemovedInSphinx40Warning 2020-04-29 15:12:39 +09:00
Takeshi KOMIYA
c7e590818a Merge branch '3.x' 2020-03-21 17:53:22 +09:00
Takeshi KOMIYA
86c32fe0f1 Fix #7345: sphinx-build: Sphinx crashes if output directory exists as a file 2020-03-21 14:47:02 +09:00
Takeshi KOMIYA
6682f89871 Fix #7282: i18n: messages using ngettext() does not translated 2020-03-14 19:52:26 +09:00