-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
config-inited
event is sometimes not emitted
#10556
Comments
Could you share a reproducible example project, please? I tried to reproduce the error by pasting your code to
FYI: At present, |
OK I dug into this a little bit more, and have some more information. More context: I am actually trying to create a Sphinx Theme that inherits another theme, and sets some config values etc. The behavior I'm reporting here is part of that theme, not part of the If I put the function + connect the However, the problem persists if I put the same code in the theme's I pushed some code that is causing this problem for me (apologies for the messy theme).
Note how the Also, I tried calling setup_extension, but it wasn't working. You can see the attempt there with |
Ah hah - I think I figured out what is going on. I was trying to connect a hook to the If I instead add that theme as an extension, so: html_theme = "my_theme"
extensions = ["my_theme"] then |
Describe the bug
I am trying to modify the app config if the user has not already provided a value. I'm trying to do these two things:
conf.py
hasn't initialized it alreadyconf.py
.I'm trying to do this by registering a callback function attached to
config-inited
. However, it seems that this callback function is never being called, and so I am not sure how I'm supposed to set the config before thebuilder
is initialized.How to Reproduce
Here's a rough idea of code that I tried and that suggested to me the event wasn't being emitted. I added the THIS-SHOULD-BREAK at the end to try and get Sphinx to throw an error, but it never did.
Expected behavior
set_config_defaults
should modify the config, and these changes should propagate to theapp
build.Your project
https://github.com/pydata/pydata-sphinx-theme
Screenshots
No response
OS
Linux
Python version
3.9
Sphinx version
5.0.1
Sphinx extensions
No response
Extra tools
No response
Additional context
For activating a new extension, I also tried
app.setup_extension("extension-name")
, but this then seemed to activate the extension without setting any config values (they were allNone
), which led to errors in the build. Activating the same extension manually inconf.py
worked fine.The text was updated successfully, but these errors were encountered: