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

docutils language importer warning #10179

Closed
ultmaster opened this issue Feb 9, 2022 · 2 comments · Fixed by #10186
Closed

docutils language importer warning #10179

ultmaster opened this issue Feb 9, 2022 · 2 comments · Fixed by #10186
Labels
docutils Tags upstream Docutils issues type:bug
Milestone

Comments

@ultmaster
Copy link
Contributor

Describe the bug

My sphinx build complains:

xxx.rst:: WARNING: rST localisation for language "zh" not found.

There is no way to suppress this, because the type and subtype here are both none:

def is_suppressed_warning(type: str, subtype: str, suppress_warnings: List[str]) -> bool:

The warning comes from RstLanguageImporter in docutils (v0.17.1). There is a warning-suppresser in sphinx for LanguageImporter:

@contextmanager
def patched_get_language() -> Generator[None, None, None]:

but the suppresser doesn't work for RstLanguageImporter.

I believe this is a bug. A simple fix can be patching RstLanguageImporter in patched_get_language as well.

How to Reproduce

$ git clone https://github.com/microsoft/nni
$ cd nni
$ git checkout 04781745b9986076591f43b9b7a47dc8e5b6f3de
$ pip install -r dependencies/develop.txt
$ pip install -r dependencies/required.txt
$ pip install -r dependencies/required_extra.txt
$ pip install -r dependencies/recommended.txt
$ cd docs
$ make -e SPHINXOPTS="-W --keep-going -T -D language='zh'" html

Expected behavior

The build should complete with no warning.

Your project

https://github.com/microsoft/nni/tree/04781745b9986076591f43b9b7a47dc8e5b6f3de/docs

Screenshots

image

https://msrasrg.visualstudio.com/NNIOpenSource/_build/results?buildId=32185&view=logs&j=c732a39c-9d2c-544b-001e-d0b8721ee1cc&t=978da1c7-9944-5976-065b-459f57f62524

OS

Ubuntu

Python version

3.8

Sphinx version

4.4.0

Sphinx extensions

No response

Extra tools

No response

Additional context

Note that I have custom extensions to handle i18n.

@ultmaster
Copy link
Contributor Author

ultmaster commented Feb 9, 2022

I figured a patch through extension here. This issue is resolved on my side.

PR: microsoft/nni#4522

https://github.com/microsoft/nni/blob/e1daf50ce3a61cf0e27d3dac45b4ca65e118fb6a/docs/extension/patch_docutils.py

@tk0miya tk0miya added the docutils Tags upstream Docutils issues label Feb 11, 2022
@tk0miya tk0miya added this to the 4.5.0 milestone Feb 11, 2022
@tk0miya
Copy link
Member

tk0miya commented Feb 11, 2022

Your patch looks nice. Could you send a PR for us?

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
docutils Tags upstream Docutils issues type:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants