Skip to content

Accept sphinx-build -D boolean strings as bools - #730

Open
Cherith1222 wants to merge 2 commits into
executablebooks:mainfrom
Cherith1222:fix/417-cli-bool
Open

Cherith1222 wants to merge 2 commits into
executablebooks:mainfrom
Cherith1222:fix/417-cli-bool

Conversation

@Cherith1222

Copy link
Copy Markdown

sphinx-build -D passes every override as a string. These notebook options are registered as Any with a boolean default, so Sphinx only accepts 0 and 1. -D nb_execution_allow_errors=True was therefore rejected, and False would not stay false if it were coerced with bool().

The usual spellings (true/false, yes/no, on/off, 1/0) are converted to real bools for the boolean notebook options, including the deprecated names. Sphinx caches an override string while logging the config object, so the converted value is written back onto the config.

Fixes #417.

This pull request was drafted with assistance from Cursor. The account owner confirmed it before it was submitted.

sphinx-build -D passes True as a string, and Sphinx only converts 0 and 1 for bool defaults. A cached override string is replaced as well.

AI-assisted (Cursor). The account owner confirmed this can be submitted.
pre-commit checks myst_nb together, and Sphinx types add_js_file priority as int. Cast the stored string options so that check passes.

AI-assisted (Cursor).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Parsing bool config from cmd

1 participant