sphinx-toolbox / sphinx-toolbox

Box of handy tools for Sphinx 🧰 📔
https://sphinx-toolbox.readthedocs.io/en/latest
MIT License
73 stars 8 forks source link

sphinx-toolbox creating a build failed #75

Open sistia01 opened 2 years ago

sistia01 commented 2 years ago

Hello!

I am tying to work with sphinx-toolbox and unfortunately I am receiving a fatal error when trying to run my build :

Handler <function validate_config at 0x7fbf73619f70> for event 'config-inited' threw an exception (exception: The 'github_username' option is required.) make: *** [html] Error 2

I've tried different variations within my conf.py and requirements.txt file but nothing has worked.

sistia01 commented 2 years ago

Here is the failed build report from Read The Docs:

Running Sphinx v3.4.3 loading translations [en]... done

Traceback (most recent call last): File "/home/docs/checkouts/readthedocs.org/user_builds/giottoteam-giotto-sphinx-website/envs/latest/lib/python3.7/site-packages/sphinx/registry.py", line 417, in load_extension mod = import_module(extname) File "/home/docs/checkouts/readthedocs.org/user_builds/giottoteam-giotto-sphinx-website/envs/latest/lib/python3.7/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 965, in _find_and_load_unlocked ModuleNotFoundError: No module named 'sphinx-toolbox'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/docs/checkouts/readthedocs.org/user_builds/giottoteam-giotto-sphinx-website/envs/latest/lib/python3.7/site-packages/sphinx/cmd/build.py", line 279, in build_main args.tags, args.verbosity, args.jobs, args.keep_going) File "/home/docs/checkouts/readthedocs.org/user_builds/giottoteam-giotto-sphinx-website/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 245, in init self.setup_extension(extension) File "/home/docs/checkouts/readthedocs.org/user_builds/giottoteam-giotto-sphinx-website/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 402, in setup_extension self.registry.load_extension(self, extname) File "/home/docs/checkouts/readthedocs.org/user_builds/giottoteam-giotto-sphinx-website/envs/latest/lib/python3.7/site-packages/sphinx/registry.py", line 421, in load_extension err) from err sphinx.errors.ExtensionError: Could not import extension sphinx-toolbox (exception: No module named 'sphinx-toolbox')

Extension error: Could not import extension sphinx-toolbox (exception: No module named 'sphinx-toolbox')

domdfcoding commented 2 years ago

Looking at your repository it doesn't look like you've told ReadTheDocs which requirements it needs to install, hence the "No module named" error.

Can you try adding the following to the end of your readthedocs.yaml file and see if it works:

python:
   install:
   - requirements: requirements.txt
sistia01 commented 2 years ago

Hi! I've added it to my readthedocs.yaml and I'm still having the same issue of a fatal error:

Running Sphinx v3.4.3 loading translations [en]... done

Traceback (most recent call last): File "/home/docs/checkouts/readthedocs.org/user_builds/giottoteam-giotto-sphinx-website/envs/latest/lib/python3.7/site-packages/sphinx/registry.py", line 417, in load_extension mod = import_module(extname) File "/home/docs/checkouts/readthedocs.org/user_builds/giottoteam-giotto-sphinx-website/envs/latest/lib/python3.7/importlib/init.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "", line 1006, in _gcd_import File "", line 983, in _find_and_load File "", line 965, in _find_and_load_unlocked ModuleNotFoundError: No module named 'sphinx_toolbox'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "/home/docs/checkouts/readthedocs.org/user_builds/giottoteam-giotto-sphinx-website/envs/latest/lib/python3.7/site-packages/sphinx/cmd/build.py", line 279, in build_main args.tags, args.verbosity, args.jobs, args.keep_going) File "/home/docs/checkouts/readthedocs.org/user_builds/giottoteam-giotto-sphinx-website/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 245, in init self.setup_extension(extension) File "/home/docs/checkouts/readthedocs.org/user_builds/giottoteam-giotto-sphinx-website/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 402, in setup_extension self.registry.load_extension(self, extname) File "/home/docs/checkouts/readthedocs.org/user_builds/giottoteam-giotto-sphinx-website/envs/latest/lib/python3.7/site-packages/sphinx/registry.py", line 421, in load_extension err) from err sphinx.errors.ExtensionError: Could not import extension sphinx_toolbox (exception: No module named 'sphinx_toolbox')

Extension error: Could not import extension sphinx_toolbox (exception: No module named 'sphinx_toolbox')

Atlinx commented 2 years ago

I'm experiencing this issue as well. I can't build sphinx locally with the extension "sphinx_toolbox" enabled.

Edit: It turns out I had to define github_username and github_repository in my conf.py. Maybe these two options should be made optional.

Edit Edit: I realized we are supposed to specify the extensions we want using "sphinx_toolbox.extension_name" instead of importing every extension by writing just "sphinx_toolbox".

rogerlga commented 1 year ago

~I'm experiencing this issue as well. I can't build sphinx locally with the extension "sphinx_toolbox" enabled.~

~Edit: It turns out I had to define github_username and github_repository in my conf.py. Maybe these two options should be made optional.~

Edit Edit: I realized we are supposed to specify the extensions we want using "sphinx_toolbox.extension_name" instead of importing every extension by writing just "sphinx_toolbox".

I'm facing the problem as Atlinx initially described above (crossed out part), with the difference that I'm already specifying the extensions as below, but still getting the error exception: 'github_username' option is required. According to my tests, the error happens when including the extension 'sphinx_toolbox.more_autodoc'.

I'm using sphinx-toolbox 3.2.0 installed via pip from PyPI.

extensions = [
    'sphinx.ext.duration',
    'sphinx_toolbox.more_autodoc',
    'sphinx_toolbox.more_autosummary',
]

The error message:

Extension error (sphinx_toolbox.github):
O manipulador <function validate_config at 0x0000023476B76C20> para evento 'config-inited' levantou uma exceção (exception: The 'github_username' option is required.)

Sorry for some parts of the message being in Portuguese, I couldn't find where to change it to English. Despite this, the important parts are in English.

Why is this happening? The 'sphinx_toolbox.github' extension is not being specified anywhere.

EDIT:

Some more tests revealed that the extension 'sphinx_toolbox.more_autodoc.sourcelink' is responsible for the error. I think this is not expected behavior.