pyodide / webtypy

Python type definitions for web APIs
Mozilla Public License 2.0
13 stars 3 forks source link

Consider splitting __init__.pyi into several files #6

Open rth opened 1 year ago

rth commented 1 year ago

Right now __init__.pyi is 14k lines of code which is massive, and doesn't even load in GitHub properly for me.

If possible it could be good to split it into submodules (all of which are imported from __init__.pyi). PEP 561 doesn't say anything about it, but in practice for instance the typeshed package does this so it probably works fine. Though there might be something about using from a import b as b for it to work.

simonegiacomelli commented 1 year ago

I agree on principle. Do you have other use cases for this feature (beside opening the file in GitHub)? I searched about this topic and found that there are files of 60 megabytes of pyi.

The principal consumer of these files are usually the IDE and the people that generates the stubs to manually check on them (the huge mentioned files are generated, luckily for them :) I believe that the typeshed stubs are in that shapes because stubgen (the tool used to generate those stubs) mimics the source package organisation (it's my current best guess).

rth commented 1 year ago

No strong opinion, it was just a though. Not having one huge file would probably just make it easier overall to work with it (reviewing diffs, understanding what are the links between objects without scrolling forever etc).

But clearly, it's not critical now, so also feel free to close.