Skip to content

Commit 64db408

Browse files
committed
docs/library/index: Elaborate on u-modules.
Also, remove an "only" directive in u-modules description.
1 parent 30bca45 commit 64db408

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

docs/library/index.rst

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,20 @@ Python standard libraries and micro-libraries
3636
The following standard Python libraries have been "micro-ified" to fit in with
3737
the philosophy of MicroPython. They provide the core functionality of that
3838
module and are intended to be a drop-in replacement for the standard Python
39-
library.
40-
41-
.. only:: not port_unix
42-
43-
The modules are available by their u-name, and also by their non-u-name. The
44-
non-u-name can be overridden by a file of that name in your package path.
45-
For example, ``import json`` will first search for a file ``json.py`` or
46-
directory ``json`` and load that package if it is found. If nothing is found,
47-
it will fallback to loading the built-in ``ujson`` module.
39+
library. Some modules below use a standard Python name, but prefixed with "u",
40+
e.g. ``ujson`` instead of ``json``. This is to signify that such a module is
41+
micro-library, i.e. implements only a subset of CPython module functionality.
42+
By naming them differently, a user has a choice to write a Python-level module
43+
to extend functionality for better compatibility with CPython (indeed, this is
44+
what done by micropython-lib project mentioned above).
45+
46+
On some embedded platforms, where it may be cumbersome to add Python-level
47+
wrapper modules to achieve naming compatibility with CPython, micro-modules
48+
are available both by their u-name, and also by their non-u-name. The
49+
non-u-name can be overridden by a file of that name in your package path.
50+
For example, ``import json`` will first search for a file ``json.py`` or
51+
directory ``json`` and load that package if it is found. If nothing is found,
52+
it will fallback to loading the built-in ``ujson`` module.
4853

4954
.. only:: port_unix
5055

0 commit comments

Comments
 (0)