-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Add a static stubs directory #10485
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
base: main
Are you sure you want to change the base?
Add a static stubs directory #10485
Conversation
Stubs are mostly generated from modules in shared-bindings. But in order to generate the stub the c code has to be commented with the appropriate type hints. If a module is located somewhere else (like micropython.const) and/or there are not the appropriate doc comments, no stub is generated for it. For these occassions we can create static stubs in the stubs directory that can be used in circuitpython-stubs. This also creates a stub for micropython.const and adds the static stubs directory into the makefile stubs command.
I looked into the docs build error. It's root cause is that now it's trying to pull from multiple different places for the I've tested the following solution locally and it appears to be working:
With those changes the final docs pages remain almost the exact same and seem to build successfully. The one visual difference is on this page: https://docs.circuitpython.org/en/latest/docs/library/index.html "micropython" appears as part of the link instead of in a code block. Local test build doc with these changes: There might be a way to get the code formatting back, but I am not sure. It took me a decent amount of fiddling to figure out how to link to the right place so I decided to skip trying to match the code format syntax. I could try to look for that though if it is preferred to keep that styling. |
Okay I tried out what you described and locally got it building and it seems good...but the only problem is it is now putting |
I think having it pulled in via stubs makes the docs assume that it is inside of shared-bindings. I just noticed also the URL that the micropython docs ends up at is different: Currently live:
With this PR change:
I'm not sure how to fix it. I think that it's getting picked up by this autodoc https://github.com/adafruit/circuitpython/blob/main/shared-bindings/index.rst?plain=1#L24-L28 but I don't know if it's possible / how to make an exclusion for Personally I think it's okay to have |
Okay cool. I kind of was at the same place as you with not really sure how to get it to replicate the current site layout. But if you are okay with it being in Core modules then that works for me! |
The last commit adds a redirect from the old location to the new, so dead links shouldn't be a problem. |
Stubs are mostly generated from modules in
shared-bindings
. But in order to generate the stub the c code has to be commented with the appropriate type hints. If a module is located somewhere else (likemicropython.const
) and/or there are not the appropriate doc comments, no stub is generated for it. For these occassions we can create static stubs in the stubs directory that can be used incircuitpython-stubs
.This also creates a stub for
micropython.const
and adds the static stubs directory into the makefile stubs command.Fixes #10484