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

If a project defines "language = None" in conf.py, treat it like "en" #10474

Closed
befeleme opened this issue May 24, 2022 · 1 comment
Closed

Comments

@befeleme
Copy link
Contributor

Hello, I started working on integrating Sphinx 5 to Fedora to ensure distribution packages work smoothly when the final is out.
I ran across is a side effect of the change inspired by #10062.
If a project has already "language = None" defined in their conf.py (which, it seems, used to be an issue before this commit), the new behavior will cause the documentation build to error out. The projects created after the mentioned commit seem not to be affected.
In a sample of ~40 packages, 2 have run across this issue.
A naive check using grep.app shows that for a half a million indexed GitHub projects there is around 6k which have the string in their conf.py (I removed the commented strings from the equation).
For older projects using Sphinx, this change will be disruptive and will require the same commit in the same place for each and every one of them.

The exact error:

+ python3 setup.py build_sphinx
running build_sphinx
Running Sphinx v5.0.0b1
loading translations [None]... not available for built-in messages
making output directory... done
WARNING: The config value `language' has type `NoneType'; expected `str'.

Extension error (sphinx.config):
Handler <function check_confval_types at 0x7fd1e67a6c00> for event 'config-inited' threw an exception (exception: 'NoneType' object has no attribute 'startswith')

Describe the solution you'd like
When Sphinx encounters NoneType for language, it could set the language to English and log the fact for the user (possibly asking them to make adjustments to conf.py) instead of erroring.
It's not that different than the current behavior in 5.0.0b1. When if I run sphinx-quickstart and set no language, the variable is not present at all in conf.py, although in the background my project is processed as English.

Describe alternatives you've considered
Aforementioned manual change for each affected project, which I'm afraid of.

@tk0miya
Copy link
Member

tk0miya commented May 29, 2022

We fixed the crash on #10481. But warning is still emitted. Since v5.0, language = None is not recommended. So please remove the configuration from these projects.
Thank you for reporting.

@tk0miya tk0miya closed this as completed May 29, 2022
@tk0miya tk0miya added this to the 5.0.0 milestone May 29, 2022
starlingx-github pushed a commit to starlingx/config that referenced this issue May 31, 2022
A new version of sphinx was released May 29 2022
which requires a language setting in config otherwise
a warning (treated as error) causes the sphinx operation
to fail.

Updating a file header to trigger zuul.
Updated the sphinx config file to correct the issue.

The sphinx behavioural change is mentioned here:
sphinx-doc/sphinx#10062
sphinx-doc/sphinx#10474

Closes-Bug: #1976377
Signed-off-by: Al Bailey <al.bailey@windriver.com>
Change-Id: I4d489a7bb8f579c894081bedba8ac3638a7eae1d
starlingx-github pushed a commit to starlingx/ha that referenced this issue May 31, 2022
A new version of sphinx was released May 29 2022
which requires a language setting in config otherwise
a warning (treated as error) causes the sphinx operation
to fail.

Updated the sphinx config file to correct the issue.

The sphinx behavioural change is mentioned here:
sphinx-doc/sphinx#10062
sphinx-doc/sphinx#10474

Partial-Bug: #1976377
Signed-off-by: Al Bailey <al.bailey@windriver.com>
Change-Id: I5c5c501e23744aa0dbaf4280ed5abcd27442f20f
starlingx-github pushed a commit to starlingx/upstream that referenced this issue May 31, 2022
A new version of sphinx was released May 29 2022
which requires a language setting in config otherwise
a warning (treated as error) causes the sphinx operation
to fail.

Updated the sphinx config file to correct the issue.

The sphinx behavioural change is mentioned here:
sphinx-doc/sphinx#10062
sphinx-doc/sphinx#10474

Partial-Bug: #1976377
Signed-off-by: Al Bailey <al.bailey@windriver.com>
Change-Id: I5fea877955c0d9b875c31f0b64bc8f3bced5c208
vincentkfu added a commit to vincentkfu/fio that referenced this issue May 31, 2022
Sphinx 5.0.0 no longer accepts None for language. Remove it and Sphinx
will use English as the default and no longer emit a warning.

For details see sphinx-doc/sphinx#10474

Sphinx warnings cause our documentation build on GitHub Actions to fail.
Failures were observed for macOS builds which upgraded to Sphinx 5.0.0.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
vincentkfu added a commit to vincentkfu/fio that referenced this issue May 31, 2022
Sphinx 5.0.0 no longer accepts None for language. Remove it and Sphinx
will use English as the default and no longer emit a warning.

For details see sphinx-doc/sphinx#10474

Sphinx warnings cause our documentation build on GitHub Actions to fail.
Failures were observed for recent macOS builds which upgraded to Sphinx
5.0.0.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
axboe pushed a commit to axboe/fio that referenced this issue Jun 1, 2022
Sphinx 5.0.0 no longer accepts None for language. Remove it and Sphinx
will use English as the default and no longer emit a warning.

For details see sphinx-doc/sphinx#10474

Sphinx warnings cause our documentation build on GitHub Actions to fail.
Failures were observed for recent macOS builds which upgraded to Sphinx
5.0.0.

Signed-off-by: Vincent Fu <vincent.fu@samsung.com>
Link: https://lore.kernel.org/r/20220531214857.169864-1-vincent.fu@samsung.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
starlingx-github pushed a commit to starlingx/nfv that referenced this issue Jun 5, 2022
A new version of sphinx was released May 29 2022
which requires a language setting in config otherwise
a warning (treated as error) causes the sphinx operation
to fail.

Updating a file header to trigger zuul.
Updated the sphinx config file to correct the issue.

The sphinx behavioural change is mentioned here:
sphinx-doc/sphinx#10062
sphinx-doc/sphinx#10474

Note: The bug referenced below is for the config repo,
      but it affects multiple StarlingX repositories.

Closes-Bug: 1976377
Change-Id: I7bb7886f27ce6190f8e23270efc1aadb7364fc90
Signed-off-by: Heitor Matsui <HeitorVieira.Matsui@windriver.com>
coretl added a commit to coretl/bluesky that referenced this issue Jun 6, 2022
coretl added a commit to coretl/bluesky that referenced this issue Jun 6, 2022
pshiu added a commit to edx/commerce-coordinator that referenced this issue Jun 9, 2022
sphinx-quickstart previously generated `language = None` by default. As of Sphinx version 5, language will default to en.

For proof this is happening, see note on https://github.com/sphinx-doc/sphinx/blob/e1bf4dd5d5860a4c3790f41c5f5fe389dc5b4cf9/sphinx/config.py#L167-L174.

For context on why this is happening, see sphinx-doc/sphinx#10474.
pshiu added a commit to edx/commerce-coordinator that referenced this issue Jun 9, 2022
sphinx-quickstart previously generated `language = None` by default. As of Sphinx version 5, language will default to en.

For proof this is happening, see note on https://github.com/sphinx-doc/sphinx/blob/e1bf4dd5d5860a4c3790f41c5f5fe389dc5b4cf9/sphinx/config.py#L167-L174.

For context on why this is happening, see sphinx-doc/sphinx#10474.
pshiu added a commit to openedx/edx-cookiecutters that referenced this issue Jun 9, 2022
sphinx-quickstart previously generated `language = None` by default. As of Sphinx version 5, language will default to en.

This squashes warnings when making the documentation like:

    Invalid configuration value found: 'language = None'. Update your configuration to a valid langauge code. Falling back to 'en' (English).

For proof this is happening, see note on https://github.com/sphinx-doc/sphinx/blob/e1bf4dd5d5860a4c3790f41c5f5fe389dc5b4cf9/sphinx/config.py#L167-L174.

For context on why this is happening, see sphinx-doc/sphinx#10474.
pshiu added a commit to openedx/edx-cookiecutters that referenced this issue Jun 9, 2022
sphinx-quickstart previously generated `language = None` by default. As of Sphinx version 5, language will default to en.

This squashes warnings when making the documentation like:

    Invalid configuration value found: 'language = None'. Update your configuration to a valid langauge code. Falling back to 'en' (English).

For proof this is happening, see note on https://github.com/sphinx-doc/sphinx/blob/e1bf4dd5d5860a4c3790f41c5f5fe389dc5b4cf9/sphinx/config.py#L167-L174.

For context on why this is happening, see sphinx-doc/sphinx#10474.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants