MicroPython libraries¶
Python standard libraries and micro-libraries¶
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.
Warning
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.
CircuitPython’s goal long-term goalis that code written in CircuitPython using Python standard libraries will be runnable on CPython without changes.
Some libraries below are not enabled on CircuitPython builds with
limited flash memory, usually on non-Express builds:
uerrno
, ure
.
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.
- Builtin functions and exceptions
uheapq
– heap queue algorithmarray
– arrays of numeric databinascii
– binary/ASCII conversionscollections
– collection and container typesgc
– control the garbage collectorhashlib
– hashing algorithmssys
– system specific functionsuerrno
– system error codesuio
– input/output streamsujson
– JSON encoding and decodingure
– simple regular expressionsuselect
– wait for events on a set of streamsusocket
– socket moduleussl
– SSL/TLS moduleuzlib
– zlib decompression
Omitted functions in the string
library¶
A few string operations are not enabled on CircuitPython
M0 non-Express builds, due to limited flash memory:
string.center()
, string.partition()
, string.splitlines()
,
string.reversed()
.
CircuitPython/MicroPython-specific libraries¶
Functionality specific to the CircuitPython/MicroPython implementation is available in the following libraries. These libraries may change signficantly or be removed in future versions of CircuitPython.
Libraries specific to the ESP8266¶
The following libraries are specific to the ESP8266.