2017-07-01 15:09:40 -04:00
|
|
|
.. _micropython_lib:
|
|
|
|
|
2018-05-22 20:49:08 -04:00
|
|
|
MicroPython libraries
|
2015-06-04 18:53:26 -04:00
|
|
|
=====================
|
2014-10-30 21:37:19 -04:00
|
|
|
|
2018-05-22 19:52:01 -04:00
|
|
|
Python standard libraries and micro-libraries
|
|
|
|
---------------------------------------------
|
2017-05-14 17:26:44 -04:00
|
|
|
|
2018-05-22 20:49:08 -04:00
|
|
|
These libraries are inherited from MicroPython.
|
|
|
|
They are similar to the standard Python libraries with the same name
|
|
|
|
or with the "u" prefix dropped.
|
|
|
|
They implement a subset of or a variant of the corresponding
|
|
|
|
standard Python library.
|
2018-02-20 20:34:59 -05:00
|
|
|
|
2018-05-22 20:49:08 -04:00
|
|
|
.. warning::
|
2016-04-26 18:32:38 -04:00
|
|
|
|
2018-05-22 20:49:08 -04:00
|
|
|
Though these MicroPython-based libraries are available in CircuitPython,
|
|
|
|
their functionality may change in the future, perhaps significantly.
|
|
|
|
As CircuitPython continues to develop, new versions of these libraries will
|
|
|
|
be created that are more compliant with the standard Python libraries.
|
|
|
|
You may need to change your code later if you rely
|
|
|
|
on any non-standard functionality they currently provide.
|
|
|
|
|
2020-12-09 10:52:18 -05:00
|
|
|
CircuitPython's long-term goal is that code written in CircuitPython
|
2018-05-22 20:49:08 -04:00
|
|
|
using Python standard libraries will be runnable on CPython without changes.
|
|
|
|
|
|
|
|
Some libraries below are not enabled on CircuitPython builds with
|
2018-05-22 19:52:01 -04:00
|
|
|
limited flash memory, usually on non-Express builds:
|
|
|
|
``uerrno``, ``ure``.
|
2014-10-30 21:37:19 -04:00
|
|
|
|
2018-05-22 19:52:01 -04:00
|
|
|
Some libraries are not currently enabled in any CircuitPython build, but may be in the future:
|
|
|
|
``uio``, ``ujson``, ``uzlib``.
|
|
|
|
|
|
|
|
Some libraries are only enabled only WiFi-capable ports (ESP8266, nRF)
|
|
|
|
because they are typically used for network software:
|
|
|
|
``binascii``, ``hashlib``, ``uheapq``, ``uselect``, ``ussl``.
|
|
|
|
Not all of these are enabled on all WiFi-capable ports.
|
2018-02-20 20:34:59 -05:00
|
|
|
|
|
|
|
.. toctree::
|
|
|
|
:maxdepth: 1
|
|
|
|
|
|
|
|
builtins.rst
|
2018-05-22 19:52:01 -04:00
|
|
|
uheapq.rst
|
2018-02-20 20:34:59 -05:00
|
|
|
array.rst
|
2018-05-03 10:34:43 -04:00
|
|
|
binascii.rst
|
2018-05-14 14:31:56 -04:00
|
|
|
collections.rst
|
2018-05-22 19:52:01 -04:00
|
|
|
gc.rst
|
2018-05-06 13:23:21 -04:00
|
|
|
hashlib.rst
|
2018-05-22 19:52:01 -04:00
|
|
|
sys.rst
|
|
|
|
uerrno.rst
|
2018-02-20 20:34:59 -05:00
|
|
|
uio.rst
|
|
|
|
ujson.rst
|
|
|
|
ure.rst
|
|
|
|
uselect.rst
|
|
|
|
usocket.rst
|
|
|
|
ussl.rst
|
|
|
|
uzlib.rst
|
2016-04-26 18:14:16 -04:00
|
|
|
|
2018-05-22 19:52:01 -04:00
|
|
|
Omitted functions in the ``string`` library
|
|
|
|
-------------------------------------------
|
|
|
|
|
2018-05-22 20:49:08 -04:00
|
|
|
A few string operations are not enabled on CircuitPython
|
|
|
|
M0 non-Express builds, due to limited flash memory:
|
2018-05-22 19:52:01 -04:00
|
|
|
``string.center()``, ``string.partition()``, ``string.splitlines()``,
|
|
|
|
``string.reversed()``.
|
|
|
|
|
2016-04-26 18:14:16 -04:00
|
|
|
|
2018-05-22 19:52:01 -04:00
|
|
|
CircuitPython/MicroPython-specific libraries
|
2018-05-22 21:21:19 -04:00
|
|
|
--------------------------------------------
|
2016-04-26 18:37:45 -04:00
|
|
|
|
2018-05-22 20:49:08 -04:00
|
|
|
Functionality specific to the CircuitPython/MicroPython implementation is available in
|
2020-12-09 10:52:18 -05:00
|
|
|
the following libraries. These libraries may change significantly or be removed in future
|
2020-07-06 10:56:52 -04:00
|
|
|
versions of CircuitPython.
|
2016-04-26 18:37:45 -04:00
|
|
|
|
|
|
|
.. toctree::
|
|
|
|
:maxdepth: 1
|
|
|
|
|
2017-04-03 17:29:23 -04:00
|
|
|
btree.rst
|
2017-02-27 01:16:32 -05:00
|
|
|
framebuf.rst
|
2016-04-26 18:37:45 -04:00
|
|
|
micropython.rst
|
|
|
|
network.rst
|
|
|
|
uctypes.rst
|
|
|
|
|
2018-02-20 20:34:59 -05:00
|
|
|
Libraries specific to the ESP8266
|
|
|
|
---------------------------------
|
2016-04-26 18:37:45 -04:00
|
|
|
|
2018-02-20 20:34:59 -05:00
|
|
|
The following libraries are specific to the ESP8266.
|
2015-06-10 17:29:56 -04:00
|
|
|
|
2018-02-20 20:34:59 -05:00
|
|
|
.. toctree::
|
|
|
|
:maxdepth: 2
|
2015-05-26 17:34:31 -04:00
|
|
|
|
2018-02-20 20:34:59 -05:00
|
|
|
esp.rst
|