Comments (2)
As discussed in Discord with @Josverl, but for anyone else who might be following this, I've been working this week on converting the "source of truth" for the built-in MicroPython modules to stub files, using the micropython-stubber generated stubs as a starting point.
This is inspired by the Pybricks project, where their Sphinx documentation is generated from their stubs. See e.g. https://github.com/pybricks/pybricks-api/blob/master/src/pybricks/hubs.py which generates https://docs.pybricks.com/en/stable/hubs/index.html
So going forward, the main MicroPython repo will include stub files containing full type annotations, positional/kw arg indicators, overloads, and doc strings (now updated to be in "Google" format as supported by the Sphinx "napoleon" plugin), as well as annotations about which ports/boards/configurations given modules/classes/methods are supported on. I am also looking at including an "added in version" annotation. Initially this will include stdlib & micropython-specific built-ins (i.e. everything we currently have documentation for), and will eventually grow to include all of micropython-lib.
These stubs should be able to be used directly, but also as a machine-readable input to a project like this that publishes stubs for general use. For example, Pybricks also do this (using "jedi") to convert "Google" to "NumPy" docstrings. One thing you could do for example is filter the stubs to only include what's relevant for a given port/board.
I'll post a WIP PR in the next week or so and update this issue. It's slow progress, 5 modules done, ~85 to go.
from micropython-stubber.
Looking forward to seeing the initial versions
from micropython-stubber.
Related Issues (20)
- automatic releases
- getinfo: determine boardname of firmware HOT 1
- mypy updates fail to create stubs of (older) uasyncio version HOT 1
- SoftI2C is asking for an id parameter and it should not HOT 12
- Generating lvgl stubs using documentation HOT 8
- Update micopython-lib matching for v1.12.0 or newer
- Check/Update latest stubs version numbering
- Fix bare const using __builtins__.py - pyright/pylance HOT 2
- Document how to generate stubs for a branch or fork of MicroPython? HOT 12
- Try rich-click for nicer UX
- improve typing for 'underdocumented' `__init__` methods
- from _typeshed import Incomplete
- fix class SoftSPI(SPI) error as SPI defined later ( reorder / different syntax) HOT 1
- Merge docstring for Literals from the documentation into the stub files
- Consider the "Any trick"
- stubber build: Incorrect package versions When specifying multiple versions to be build at the same time
- BTLE low-level constants defined as 'Incomplete' HOT 6
- Should constant values be included in stub files
- Find simple way to add more documentation by the community
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from micropython-stubber.