Run `.mpy` files from cpython?
It would be great if there was one unified way to write faster python extensions. For various reasons we can't really port cython to micropython, but what aboutproviding some way for cpython to run mpy extensions? #5083 seems very powerful.
Is there any way to do that? Perhaps is would be easier to provide some sort of bridge between micropython and cpython?
Document all functions, classes and methods
Following on from #577, there was the suggestion to properly document subtle differences between uPy and CPython, ie differences between the standard Python library, and how Micro Python implements it.
So far, only the pyb module is documented. This is because it's something completely new (not in normal Python) and so of course needs documentation.
I was initially not going to document standard Python features, because that's a huge duplication of effort. We could just link to the CPython documentation and be done.
But, revisiting this, I think it would be best to document all of the functions, classes and methods in uPy, be they new or existing already in Python. This is for 2 main reasons:
- Not all Python features are implemented, and it'll be this way in uPy for some time. It's crazy to expect a user to figure out what is and is not implemented just by typing the name of something and seeing if they get a
NameErroror not. They should also not have to look into the source code to see what's implemented. Further, if one particular feature is implemented (eg file.readline) and another related one not (eg file.readlines), then we can document that the latter is not implemented, but they can use the former. - Some features are subtly different to CPython, either in semantics, or just because they are partially implemented (eg some builtins not taking keyword arguments). These need to be documented so users don't waste time figuring it out by trial and error.
I think the best way to address the above 2 points is to just document all functions, classes, methods and modules in uPy. It's not difficult to do: just add relevant comments in the code (start them with ///, see stmhal/i2c.c for an example). Then they can be automatically extracted and turned into a web page.
We should also document the core uPy language itself. But here I think we can say "it's the same as CPython, except for the following things". Eg, at the moment you can't have default keyword only args, and subclassing builtins is only partially implemented.