Skip to content

codeautolink_custom_blocks breaks Sphinx's caching mechanism #76

@mgeier

Description

@mgeier

Issue

When using codeautolink_custom_blocks, which is supposed to be a dictionary containing a callable, Sphinx will re-build all HTML files every time it is running, even if no source files have changed.

Expected behavior

No re-building of HTML files if nothing changes.

Steps to reproduce

Add this to conf.py:

codeautolink_custom_blocks = {
    'python': lambda x: (x, x),
}

Run Sphinx.
Run Sphinx again. Notice that the HTML files are re-built even though nothing changed

Possible solutions

The current behavior should be kept for backwards compatibility, but probably in addition to a callable, a string could also be supported?

This could probably be implemented using sphinx.util.import_object() (for an example see https://github.com/spatialaudio/nbsphinx/blob/44829f13d18e676917fc6e7b7ae62d4bac625cd7/src/nbsphinx.py#L990-L991).

For a bit more background (I was struggling with this some time ago), see this mailing list thread: https://groups.google.com/g/sphinx-dev/c/aGfJb-TC8PI/m/zxM3l9kAAgAJ

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions