Fix to follow the FAQ. Use the conf.py
file from your currently checked out branch.
#113
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is stated as how things work in the FAQ.
Use the
conf.py
file from your currently checked out branch when loading config options from other branches/tags. This change fixed an instance of theFailed load config for %s from %s
for me after I changed myconf.py
file.Edit: I also found that
sphinx.config.Config.init_values
would give the errorunknown config value %r in override, ignoring
when theconfig.py
is loaded for the tags/branches to be generated (it useslogger.warning
, however it prints tostderr
and many CI/CD servers fail any step with output tostderr
) when overridingsphinx-multiversion
config values from the command line (using-D
).When
sphinx-multiversion
loads theconfig.py
file for the tags/branches, there is at least one value that might be useful to override;smv_outputdir_format
. In my use case, I set it tosmv_outputdir_format="{repo_name}/v{version}"
when generating for release, because I only want to generate from tags. When running CI, I want to override with-D "smv_outputdir_format={ref.name}"
because I care less about the output folder structure and more about also generating the current branch, which the release format does not support. I also generate for multiple versions of python, so I always want to run the branch generation throughsphinx-multiversion
to ensure it works, especially when adding a new version.The fix I chose was to always add the
sphinx-multiversion
options to thesphinx.config
by removing that code out of anif
statement that prevented doing so when loading the config for branches/tags.