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

Sphinx 7.3 raises a warning on needs_functions #1165

Open
sigma67 opened this issue Apr 18, 2024 · 5 comments
Open

Sphinx 7.3 raises a warning on needs_functions #1165

sigma67 opened this issue Apr 18, 2024 · 5 comments

Comments

@sigma67
Copy link

sigma67 commented Apr 18, 2024

When specifying needs_functions in conf.py

Warning, treated as error:
cannot cache unpickable configuration value: 'needs_functions' (because it contains a function, class, or module object)

Sphinx also states in its documentation that configuration values must be pickleable:

https://www.sphinx-doc.org/en/master/usage/configuration.html

The contents of the config namespace are pickled (so that Sphinx can find out when configuration changes), so it may not contain unpickleable values – delete them from the namespace with del if appropriate. Modules are removed automatically, so you don’t need to del your imports after use.
@sigma67
Copy link
Author

sigma67 commented Apr 18, 2024

Current workaround: set

suppress_warnings = ["config.cache"]

@danwos
Copy link
Member

danwos commented Apr 18, 2024

Assigning functions to needs_functions is not the best way, as it also deactivates incremental build.

Have you taken a look at the related documentation?
https://sphinx-needs.readthedocs.io/en/latest/configuration.html#needs-functions
There is a note, that it is better to use the Sphinx-Needs API to assign functions.
image

@danwos
Copy link
Member

danwos commented Apr 18, 2024

So for me, the Sphinx warning is correct.
But maybe Sphinx-Needs itself should throw such a warning and give the hint to use the API instead.

@chrisjsewell
Copy link
Member

So for me, the Sphinx warning is correct.

Well that's lucky, because I was the one that added this warning 😆 sphinx-doc/sphinx#12203

Note, if you are happy to live with the rebuild issues, then you can use suppress_warnings = ["config.cache"]

@sigma67
Copy link
Author

sigma67 commented Apr 18, 2024

Thanks for the quite useful suggestion and pointer to the docs.

May I suggest to remove the incorrect way from the documentation then to avoid leading users into this error?

Or at least switch the order, I guess.

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

No branches or pull requests

3 participants