arbor-sim / arbor

The Arbor multi-compartment neural network simulation library.
https://arbor-sim.org
BSD 3-Clause "New" or "Revised" License
108 stars 61 forks source link

Typestub #2238

Closed Helveg closed 10 months ago

Helveg commented 10 months ago

I added a .pyi file (first 3 hours by hand, then stumbled upon pybind11-stubgen, and another hour of linting). But now I think we have a type stub?

I think using this stub and sphinx.ext.autodoc we could replace large chunks of the manually generated documentation. I also added a tiny check to confirm that everything that's in the arbor module has a counterpart in the .pyi to CI.

Helveg commented 10 months ago

@thorstenhater it seems my 2 new files in the /python folder aren't included in the installed package. Do you know how to get that picked up?

thorstenhater commented 10 months ago

See the infamous #2233, added via the same generator and fixing all the 'mishaps', including massaging order, formatting, and completeness of the C++ bindings.

I'll happily take the automation of stubbing, though ;)

autodoc has been discussed, but never used in anger, fell free to explore that idea!

Helveg commented 10 months ago

I already had the feeling this was going to be a dupe, but I couldn't stop myself ;) For automation, it seems like it mostly put ... where it didn't know what to do; what's your experience?

If so, what I could do for now, in terms of automation, is to generate a new stub, and compare them via an ast visitor, that only overwrites non-ellipsis diffs? So if we've manually set an ellipsis to some more information that that change isn't reverted?