bypass sphinx conf.py from CLI

Stephen Finucane stephenfin at redhat.com
Thu Feb 3 10:54:09 UTC 2022


On Wed, 2022-02-02 at 22:09 +0000, Jeremy Stanley wrote:
> On 2022-02-02 20:49:05 +0000 (+0000), Stone, Ronald wrote:
> > The StarlingX docs team is implementing the default
> > sphinxcontrib.spelling spelling extension for use from tox via a
> > virtualenv set up for this purpose. We do not want
> > sphinxcontrib.spelling loaded into other tox jobs that won't use
> > it. This means that it cannot be loaded from the standard conf.py.
> > Instead I am bypassing conf.py and setting parameters from the
> > sphinx-build command in the appropriate tox job:
> [...]
> 
> Have you considered creating a separate doc/source/conf-spelling.py
> and passing that via sphinx-build's -c option instead?

Also remember that the 'conf.py' is a Python file so you can encode logic in it.
tox injects environment variables when running [1]. It would be easy to check
for the presence of e.g. 'TOX_ENV_NAME' and add the extension as necessary.

Stephen

[1] https://tox.wiki/en/latest/config.html#injected-environment-variables




More information about the openstack-discuss mailing list