I am picking up a Python project that has the following in a setup.py
script:
from sphinx.setup_command import BuildDoc
commands["build_sphinx"] = BuildDoc
cmd_opts["build_sphinx"] = {
"project": ("setup.py", NAME),
"version": ("setup.py", about["__version__"]),
"release": ("setup.py", about["__version__"]),
"source_dir": ("setup.py", "docs"),
}
And this is to pass to setup()
from setuptools.
Now this gives me an import error, since it can't find the module.
From the Sphinx documentation we have:
# this is only necessary when not using setuptools/distribute
from sphinx.setup_command import BuildDoc
http://code.nabla.net/doc/sphinx/api/sphinx/setup_command/sphinx.setup_command.BuildDoc.html
So my question is if I can import this BuildDoc
from somewhere, or should I just use setuptools in another way like suggested by the docs, and if so how do I do it?
I will also add Poetry in the project so if there is a "Poetry with Sphinx thing", I might want that instead.
I tried looking for the BuildDoc
import.
I now get that Sphinx integration with setuptools was deprecated in Sphinx 7.0.0, is there a way to integrate still?
BuildDoc
was a python counterpart of the command line sphinx-build.
I solved this by getting rid of the setuptools at all, and just add in the makefile:
poetry run sphinx-build
Just like sinoroc mentionend! Thanks