Feature: add signature exposure for static inference - #808
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
49406c6 to
38bf8f3
Compare
38bf8f3 to
039abcd
Compare
|
Does this work @munechika-koyo ? |
|
TODO: get an editor with pylance |
|
From my understanding yes. Custom stubs would work but that is very not handy to maintain. |
|
So had a bit more digging. The solution it seems is that one would have to generate and comit the stubs to the repo in order for it to work with the static viewer properly. This is also how mpl does it. |
|
It's true that management costs might go up, but that seems like the better option for generating stubs in a runtime environment, for example, using mypy's |
|
Can you check the editor with the stubs added? (30k jeezzzz) |
|
In my environment with Anyway, there appear to be many UltraPlot/ultraplot/constructor.pyi Line 118 in f2571e1 Were they caused by automatic generation? Is it possible to fix the types for them? |
|
Most of the codebase is not type annotated yet and the automatic inference fallsback to Incomplete I think |
|
Wouldn't this solve all the issues: https://marketplace.visualstudio.com/items?itemName=KiidxAtlas.python-hover |
|
hmm annoying. |
|
I added a dynamic inspector prior to dumping the stubs to expand the stubs, does this work @munechika-koyo ? |



Ultraplot does a lot of runtime composition (lazy loading, dynamic dispatch, and shared doc merging), which makes static analysis difficult because analyzers see only source-level declarations, not the final runtime-expanded API. The lazy loader compounds this by delaying object/materialization of the public surface. On top of that, _obfuscate_parameters historically replaced visible signatures with compact (**kwargs) forms to keep docs manageable, which also removed concrete parameter metadata from inspect.signature, so tools like Pylance had less to work with for hovers/call tips.
So the concrete problem was a combo of:
This PR separates the two processes by keeping a copy for the docs themselves while using a process that static analysers like Pylance can work with.