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

Fix to follow the FAQ. Use the conf.py file from your currently checked out branch. #113

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Walter-Gates-Bose
Copy link

@Walter-Gates-Bose Walter-Gates-Bose commented Feb 29, 2024

This is stated as how things work in the FAQ.

Do I need to make changes to old branches or tags?
No, you don’t. sphinx-multiversion will always use the conf.py file from your currently checked out branch.

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 the Failed load config for %s from %s for me after I changed my conf.py file.

Edit: I also found that sphinx.config.Config.init_values would give the error unknown config value %r in override, ignoring when the config.py is loaded for the tags/branches to be generated (it uses logger.warning, however it prints to stderr and many CI/CD servers fail any step with output to stderr) when overriding sphinx-multiversion config values from the command line (using -D).

When sphinx-multiversion loads the config.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 to smv_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 through sphinx-multiversion to ensure it works, especially when adding a new version.

The fix I chose was to always add the sphinx-multiversion options to the sphinx.config by removing that code out of an if statement that prevented doing so when loading the config for branches/tags.

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.

1 participant