Skip to content

Warning "cannot cache unpickable configuration value" when config contains a reference to a function #12300

Closed
@theOehrly

Description

@theOehrly

Describe the bug

When the configuration contains a reference to a function, the warning "cannot cache unpickable configuration value" is show. If warnings are treated as errors, this of course fails the configuration build.

This problem was introduced in v7.3.0. It seems to only occur on a clean build (at least in the case that I observed). This is still problematic because CI workflows commonly do clean builds and then fail.

For the reason why function references are used in the configuration, I'll refer to #11777 where there is a more detailed explanation of the reasons.
The steps for reproduction are the same as in that issue, albeit with a different outcome/error.

How to Reproduce

pip install sphinx sphinx-gallery
sphinx-quickstart --sep --project test --author me -l en -r 0.0.1
mkdir examples
echo "" > examples/readme.txt

Add the following content to the end of the default conf.py in the source directory:

extensions = [
    'sphinx_gallery.gen_gallery',
]


def example_func():
    return


sphinx_gallery_conf = {
   'reset_modules': (example_func, ),
}

Run make html and notice "WARNING: cannot cache unpickable configuration value: 'sphinx_gallery_conf'" in the output.
This problem only occurs on a clean build (at least in this case), so it is necessary to run make clean before reproducing the problem again.

Environment Information

Platform:              win32; (Windows-10-10.0.19044-SP0)
Python version:        3.12.1 (tags/v3.12.1:2305ca5, Dec  7 2023, 22:03:25) [MSC v.1937 64 bit (AMD64)])
Python implementation: CPython
Sphinx version:        7.3.0
Docutils version:      0.21.1
Jinja2 version:        3.1.3
Pygments version:      2.17.2

Sphinx extensions

extensions = [
    'sphinx_gallery.gen_gallery',
]

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    awaiting:responseWaiting for a response from the author of this issue

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions