Closed ivirshup closed 1 year ago
You already set typehints_defaults = 'braces'
, so what you describe doesn’t happen anymore. Fixed in https://github.com/scverse/scanpy/pull/2204
Checking it out locally, that PR causes the issue to come back. I think the typehints_formatter
parameter causes the problem – though maybe typehints_default
would too.
Moving my comment from there here:
looks like a Sphinx bug, as even setting it manually doesn’t change things.
Maybe pickling the function leads to it having a different object id…
The only ways to fix this:
- set the value to a string like
'scanpydoc.elegant_typehints:typehints_formatter'
and implement importing that object in sphinx-autodoc-typehint- make it so sphinx compares function-valued settings in a way that doesn’t bust the cache.
So not something fixable here per se
I figured out a way, fixed in #79
scanpydoc.elegant_typehint
seems to be modifying the config after it's been loaded, making sphinx think it has changed. This causes full rebuilds every time, which is quite painful for minor changes. This is reported via:Because of this, I've disabled
scanpydoc.elegant_typehint
in scanpy (theislab/scanpy#2199).I'm not entirely sure how to fix this. I hoped that just moving the assignment of
typehints_formatter
would have done the trick, but it does not.