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

cautodoc_transformations does not "pickle" nicely #52

Closed
jnikula opened this issue Jun 17, 2021 · 1 comment
Closed

cautodoc_transformations does not "pickle" nicely #52

jnikula opened this issue Jun 17, 2021 · 1 comment
Labels
extension Related to Sphinx directive extensions

Comments

@jnikula
Copy link
Owner

jnikula commented Jun 17, 2021

Sphinx automatically pickles and caches the configuration, speeding up processing if there are no changes. Unfortunately, pickled function references in cautodoc_transformations are bound to change. This leads to re-reading of the source documents:

updating environment: [config changed ('cautodoc_transformations')] 5 added, 0 changed, 0 removed
reading sources... [100%] syntax

This is quite an unfortunate unintentional consequence of the transformation mechanism.

@jnikula jnikula added the extension Related to Sphinx directive extensions label Jun 17, 2021
@jnikula
Copy link
Owner Author

jnikula commented Sep 30, 2021

One idea is to use Sphinx events for the transformations, so that you could actually write independent Sphinx extensions for the transformations. app.add_event('cautodoc-transform') and app.emit_firstresult('cautodoc-transform', comment, transform) in Hawkmoth side, and app.connect('cautodoc-transform', transformation_function) in the extension implementing the transformation.

It's a bit sad I didn't think of this before implementing the current transformations, leading to another round of deprecations and changes.

jnikula added a commit that referenced this issue Jan 24, 2023
Add hawkmoth-process-docstring event that other Sphinx extensions can
connect to, and enable extending the docstring processing using
extensions instead of cautodoc_transformations.

This is similar to the autodoc-process-docstring event [1].

Fixes #52.

[1] https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#event-autodoc-process-docstring
jnikula added a commit that referenced this issue Jan 29, 2023
Add hawkmoth-process-docstring event that other Sphinx extensions can
connect to, and enable extending the docstring processing using
extensions instead of cautodoc_transformations.

This is similar to the autodoc-process-docstring event [1].

Fixes #52.

[1] https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#event-autodoc-process-docstring
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extension Related to Sphinx directive extensions
Projects
None yet
Development

No branches or pull requests

1 participant