Skip to content
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

Update handling of u-modules in 1.20.1 and up #407

Closed
Josverl opened this issue Jul 4, 2023 · 2 comments
Closed

Update handling of u-modules in 1.20.1 and up #407

Josverl opened this issue Jul 4, 2023 · 2 comments

Comments

@Josverl
Copy link
Owner

Josverl commented Jul 4, 2023

This was implemented in #9069 and #11740:

  • All built-in modules (and asyncio) were renamed to remove the u-prefix.
  • There's a new mechanism for forcing a built-in based on sys.path.
  • import umodule still also works as a backwards-compatible way of forcing a built-in.

Originally posted by @jimmo in micropython/micropython#9018 (comment)

@jimmo
Copy link

jimmo commented Jul 5, 2023

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.

@Josverl
Copy link
Owner Author

Josverl commented Jul 11, 2023

Looking forward to seeing the initial versions

@Josverl Josverl closed this as completed Feb 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants