Skip to content

Boolean values passed to flag --define are wrongly interpreted as strings when building Sphinx docs #13273

Closed
@bartvanb

Description

@bartvanb

Describe the bug

I want to build Sphinx docs locally with --define autosummary_generate=0 to temporarily disable the autosummary extension. However, my value of 0 is not interpreted as boolean despite that the docs say I should provide 0 or 1 for booleans.

How to Reproduce

> sphinx-build docs docs/_build/html --define autosummary_generate=0
Running Sphinx v8.1.3
loading translations [en]... done
WARNING: The config value `autosummary_generate' has type `str'; expected `bool' or `list'.
loading pickled environment... The configuration has changed (1 option: 'pygments_dark_style')
done
WARNING: autosummary_generate: file not found: 0.rst

Note the WARNINGS: they show that sphinx-build does not interpret the 0 as I intended.

Relevant content conf.py:

extensions = [
    "sphinx.ext.autosummary",
]

autosummary_generate = True  # Turn on sphinx.ext.autosummary

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions