Skip to content
Standard library for MicroPython and compatible programming languages
Branch: master
Clone or download
pfalcon uasyncio: Add cancel_io() to cancel any polled events for stream.
The effect of this call should be equivalent to the combined call to
remove_reader() & remove_writer(). The current implementation actually
optimizes it and just resets polled events flags to 0, in the hope that
entry still may be used.
Latest commit fbe1506 Apr 21, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
__future__
_libc all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
_markupbase
abc abc: Release 0.0.2. Nov 24, 2018
argparse argparse: Release 0.4.1. Feb 6, 2019
array all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
ast all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
asyncio
asyncio_slow asyncio_slow: Rename examples as such. Sep 30, 2017
atexit atexit: Add placeholder module. Aug 24, 2018
audioop audioop: Add placeholder module. Oct 5, 2018
base64 all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
bdb bdb: Add placeholder module. Sep 7, 2018
binascii
binhex all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
bisect bisect: Re-release as 3.3.3. Sep 7, 2018
bz2
calendar all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
cgi all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
cgitb cgitb: Add placeholder module. Aug 24, 2018
chunk chunk: Add placeholder module. Sep 7, 2018
cmd all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
code
codecs all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
codeop all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
collections.defaultdict
collections.deque
collections collections: Release 0.1.3. Nov 24, 2018
colorsys
compileall compileall: Add placeholder module. Aug 24, 2018
concurrent.futures all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
configparser configparser: Add placeholder module. Sep 7, 2018
contextlib all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
copy copy: Declare dependency on types module. Oct 30, 2018
copyreg copyreg: Add placeholder module. Oct 6, 2018
cpython-ffi cpython-ffi: Release 0.1. Feb 22, 2019
cpython-micropython cpython-micropython: Monkey-patch CPython builtin modules for uPy sem… Dec 15, 2018
cpython-uasyncio cpython-uasyncio: Release 0.2.2, use non-upip setup.py. Aug 18, 2018
cpython-uctypes cpython-uctypes: Release 0.1. Feb 22, 2019
cpython-uerrno cpython-uerrno: Release 0.1. Sep 29, 2018
cpython-uhashlib cpython-uhashlib: Add test. Aug 20, 2018
cpython-uio cpython-uio: Release 0.2. Dec 15, 2018
cpython-ujson cpython-ujson: Release 0.2. Dec 18, 2018
cpython-uos
cpython-upip cpython-upip: Symlink upip and upip_utarfile. Dec 15, 2018
cpython-usocket cpython-usocket: Release 0.1. Dec 15, 2018
cpython-ussl cpython-ussl: Release 0.1. Dec 15, 2018
cpython-utarfile cpython-utarfile: Release 0.2. Dec 15, 2018
cpython-utime cpython-utime: Release 0.3. Mar 6, 2019
cpython-uzlib
crypt crypt: Add placeholder module. Aug 24, 2018
csv all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
curses.ascii
curses all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
datetime all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
dbm all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
decimal
difflib all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
dis dis: Add example which dumps code objects of saved bytecode module. Dec 31, 2018
dummy_threading all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
email.charset
email.encoders
email.errors all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
email.feedparser all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
email.header all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
email.internal all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
email.message
email.parser all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
email.utils
ensurepip ensurepip: Add placeholder module. Oct 13, 2018
enum enum: Add placeholder module. Aug 24, 2018
errno all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
faulthandler faulthandler: Add placeholder module. Oct 5, 2018
fcntl all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
ffilib all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
filecmp
fileinput fileinput: Add placeholder module. Sep 27, 2018
fnmatch all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
formatter
fpectl
fractions all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
framebuf framebuf: Add example. Dec 27, 2018
ftplib all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
functools all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
gc gc: Add placeholder module. Sep 7, 2018
getopt
getpass all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
gettext all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
glob
grp grp: Add placeholder module. Sep 28, 2018
gzip
hashlib hashlib: Release 2.4.0-5. Aug 19, 2018
heapq all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
hmac all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
html.entities
html.parser all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
html
http.client all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
http.cookiejar all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
http.cookies all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
imaplib all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
imghdr
imp
importlib all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
inspect all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
io all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
ipaddress all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
itertools itertools: Release 0.3. Feb 7, 2019
json json: Convert to metadata.txt, release 3.3.3-1. Nov 10, 2018
keyword keyword: Release 3.3.3-1. Nov 10, 2018
lib2to3 lib2to3: Add placeholder module. Oct 12, 2018
linecache all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
locale all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
logging logging: Release 0.5.2: use README.rst. Mar 1, 2019
lzma lzma: Add placeholder module. Sep 26, 2018
machine all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
mailbox all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
mailcap
marshal marshal: Add placeholder module. Aug 1, 2018
math all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
mimetypes all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
mmap mmap: Release 0.1. Oct 18, 2018
modulefinder modulefinder: Add placeholder module. Oct 4, 2018
mpylib mpylib: Release 0.3. Apr 7, 2019
multiprocessing all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
netrc netrc: Add placeholder module. Sep 28, 2018
nis nis: Add placeholder module. Sep 29, 2018
nntplib
numbers all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
opcode opcode: Release 0.2. Apr 15, 2019
operator all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
optparse all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
os.path all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
os os: Release 0.8. Jan 25, 2019
ossaudiodev ossaudiodev: Add placeholder module. Sep 29, 2018
parser parser: Add placeholder module. Aug 22, 2018
pathlib all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
pdb all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
pickle all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
pickletools all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
pipes
pkg_resources
pkgutil all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
platform all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
plistlib
poplib
posix posix: Add placeholder module. Sep 7, 2018
posixpath all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
pprint
profile all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
pstats pstats: Add placeholder module. Oct 4, 2018
pty all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
pwd all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
py_compile py_compile: Add basic test. Mar 1, 2019
pyb pyb: Add LED blink example. Apr 5, 2015
pyclbr pyclbr: Add placeholder module. Oct 5, 2018
pydoc pydoc: Add placeholder module. Oct 10, 2018
pystone all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
pystone_lowmem all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
queue all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
quopri all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
random all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
re-pcre re-pcre: Release 0.4. Mar 10, 2019
re re: Add placeholder module. Aug 20, 2018
readline all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
reprlib
resource resource: Add placeholder module. Aug 25, 2018
runpy all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
sched all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
secrets
select all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
selectors
shelve
shlex all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
shutil all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
signal all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
site site: Release 0.1. Dec 12, 2018
smtplib all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
sndhdr
socket socket: Release 0.5.3. Oct 1, 2018
socketserver all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
spwd
sqlite3
ssl all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
stat all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
statistics all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
string string: Release 0.2. Feb 6, 2019
stringprep
struct
subprocess all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
sunau
symbol
symtable
sys all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
sysconfig
syslog
tabnanny
tarfile all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
telnetlib all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
tempfile all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
termios termios: Add placeholder module. Sep 7, 2018
test.pystone all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
test.support
test test: test_pep380.py: Update to pass on MicroPython. Jul 7, 2015
textwrap all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
threading all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
time
timeit all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
token token: Release 3.4.3. Feb 6, 2019
tokenize tokenize: Add placeholder module. Sep 4, 2018
trace all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
traceback all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
tty all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
turtle turtle: Add placeholder module. Oct 28, 2018
turtledemo turtledemo: Add placeholder module. Nov 1, 2018
types types: Release 3.3.3-2. Dec 22, 2018
typing typing: Release 0.2.2. Feb 17, 2019
uaiohttpclient uaiohttpclient: Release 0.7.1. Jan 25, 2019
uargparse uargparse: Release 0.4. Feb 6, 2019
uasyncio.core uasyncio.core: test_cancel_sleep: Test for cancelling uasyncio.sleep(… Feb 2, 2019
uasyncio.queues all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
uasyncio.synchro
uasyncio.udp all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
uasyncio.websocket.server all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
uasyncio uasyncio: Add cancel_io() to cancel any polled events for stream. Apr 21, 2019
ucontextlib all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
uctypeslib uctypeslib: Release 0.5. Oct 16, 2018
uctypeslib2
ucurses all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
udnspkt all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
ulogging ulogging: Release 0.3. Nov 17, 2018
umqtt.robust
umqtt.simple all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
unicodedata all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
unittest unittest: test_unittest: Typo fix. Mar 3, 2019
upip upip: Release 1.2.6. Nov 28, 2018
upysh all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
urequests urequests: Release 0.9.1, formatting fix on PyPI. Oct 13, 2018
urllib.parse all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
urllib.urequest
urllib
usdl2 usdl2: Release 0.2. Nov 2, 2018
usdl2_image usdl2_image: Add example. Aug 28, 2018
utarfile all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
uu all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
uuid uuid: Provide UUID class and uuid4() implementation using os.urandom(). Oct 30, 2018
uurequests uurequests: Release 0.8.1, formatting fix on PyPI. Oct 13, 2018
uwwwauth uwwwauth: Add test. Nov 28, 2018
venv venv: Release 0.1. Jan 25, 2019
warnings all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
wave wave: Add placeholder module. Sep 26, 2018
weakref all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
webbrowser
wsgiref wsgiref: Add placeholder module. Oct 5, 2018
xdrlib xdrlib: Add placeholder module. Sep 29, 2018
xml.dom.minidom all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
xml.dom.pulldom all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
xml.dom
xml.etree.ElementTree xml.etree.ElementTree: Release 0.1.1. Aug 4, 2018
xml.parsers.expat xml.parsers.expat: Add placeholder module. Aug 5, 2018
xml.sax all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
xml xml: Add placeholder module. Aug 24, 2018
xmlrpc.client xmlrpc.client: Release 0.1. Aug 4, 2018
xmlrpc.server xmlrpc.server: Add placeholder module. Aug 5, 2018
xmlrpc xmlrpc: Add placeholder module. Aug 24, 2018
xmltok
xmltok2 xmltok2: Release 0.2. Aug 1, 2018
zipapp zipapp: Add placeholder module. Oct 16, 2018
zipfile all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
zipimport zipimport: Add placeholder module. Oct 16, 2018
zlib all: Update metadata for new URL, mailing list, maintainership. Jul 30, 2018
.gitignore .gitignore: Ignore local development files. May 31, 2014
CONTRIBUTING.md CONTRIBUTING: Use master repo link. Oct 13, 2018
LICENSE LICENSE: Elaborate information. Dec 15, 2018
Makefile Makefile install: Add --no-run-if-empty to xargs. May 11, 2014
README.md README: Mention uargparse. Feb 6, 2019
make_metadata.py make_metadata: Prevent syntax errors in depends and extra_modules. Oct 30, 2018
optimize_upip.py optimize_upip.py: Rework inclusion/exclusion logic. May 5, 2017
sdist_upip.py

README.md

micropython-lib

micropython-lib is a project to develop a non-monolothic standard library for "advanced" MicroPython fork (https://github.com/pfalcon/micropython). Each module or package is available as a separate distribution package from PyPI. Each module comes from one of the following sources (and thus each module has its own licensing terms):

  • written from scratch specifically for MicroPython
  • ported from CPython
  • ported from some other Python implementation, e.g. PyPy
  • some modules actually aren't implemented yet and are dummy
  • some modules are extensions and are not part of CPython's standard library

Note that the main target of micropython-lib is a "Unix" port of the aforementioned fork of MicroPython. Actual system requirements vary per module. Majority of modules are compatible with the upstream MicroPython, though some may require additional functionality/optimizations present in the "advanced" fork. Modules not related to I/O may also work without problems on bare-metal ports, not just on "Unix" port (e.g. pyboard).

Usage

micropython-lib packages are published on PyPI (Python Package Index), the standard Python community package repository: http://pypi.python.org/ . On PyPI, you can search for MicroPython related packages and read additional package information. By convention, all micropython-lib package names are prefixed with "micropython-" (the reverse is not true - some package starting with "micropython-" aren't part of micropython-lib and were released by 3rd parties).

Browse available packages via this URL. (Note: this may also include 3rd-party modules which are not part of micropython-lib.)

To install packages from PyPI for usage on your local system, use the upip tool, which is MicroPython's native package manager, similar to pip, which is used to install packages for CPython. upip is bundled with MicroPython "Unix" port (i.e. if you build "Unix" port, you automatically have upip tool). Following examples assume that micropython binary is available on your PATH:

$ micropython -m upip install micropython-pystone
...
$ micropython
>>> import pystone
>>> pystone.main()
Pystone(1.2) time for 50000 passes = 0.534
This machine benchmarks at 93633 pystones/second

Run micropython -m upip --help for more information about upip.

CPython backports

While micropython-lib focuses on MicroPython, sometimes it may be beneficial to run MicroPython code using CPython, e.g. to use code coverage, debugging, etc. tools available for it. To facilitate such usage, micropython-lib also provides reimplementations ("backports") of MicroPython modules which run on CPython. This first of all applies to the builtin MicroPython "u" modules, but as time goes on, backports of micropython-lib's own modules can be provided. Backport modules are in the directories named cpython-* of this repository. On PyPI, these named micropython-cpython-*.

These modules should be installed with CPython's pip3 tool. Example session:

$ pip3 install --user micropython-cpython-uhashlib
...
$ python3
...
>>> import uhashlib
>>> uhashlib.sha1(b"test").hexdigest()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'sha1' object has no attribute 'hexdigest'
# MicroPython's uhashlib doesn't have hexdigest(), use ubinascii.hexlify(.digest())
>>> uhashlib.sha1(b"test").digest()
b'\xa9J\x8f\xe5\xcc\xb1\x9b\xa6\x1cL\x08s\xd3\x91\xe9\x87\x98/\xbb\xd3'

Development

To install modules during development, use make install. By default, all available packages will be installed. To install a specific module, add the MOD=<module> parameter to the end of the make install command.

Contributing

micropython-lib is a community project and can be implemented "fully" only by contributions from interested parties. The contributions are expected to adhere to Contribution Guidelines.

Links

If you would like to trace evolution of MicroPython packaging support, you may find following links useful (note that they may contain outdated information):

Guidelines for packaging MicroPython modules for PyPI:

Credits

micropython-lib is developed and maintained by Paul Sokolovsky (@pfalcon) with the help of MicroPython community.

List of modules specific to micropython-lib

While micropython-lib's primary way is to provide implementation of Python standard library, micropython-lib goes further and hosts some extension modules which are deemed to be worth being a part of "MicroPython standard library". This section lists them to easy discovery:

  • uaiohttpclient - HTTP client for uasyncio
  • uargparse - small subset of argparse module
  • uasyncio - asynchronous scheduling and I/O, roughly based on CPython's asyncio
  • uasycio.core - just a scheduler part of uasyncio
  • ucurses - small subset of curses module
  • udnspkt - DNS packet handling (Sans I/O approach)
  • ulogging - small subset of logging module
  • upip - MicroPython package manager, modelled after "pip" tool
  • upysh - minimalistic filesystem shell using Python syntax
  • utarfile - small subset of tarfile module
  • xmltok2 - small/simple XML tokenizer
You can’t perform that action at this time.