DO NOT USE - THIS IN AN OLD VERSION. Use pycom-micropython-sigfox instead.
C C++ Python Objective-C Makefile HTML Other
Failed to load latest commit information.
.github docs/: move .github directory to root directory Nov 15, 2016
bare-arm py: Be more specific with MP_DECLARE_CONST_FUN_OBJ macros. Oct 21, 2016
cc3200 py: Be more specific with MP_DECLARE_CONST_FUN_OBJ macros. Oct 21, 2016
docs docs/pycom_esp32: Update expansion board pin-out image. Feb 6, 2017
drivers esp32: Use proper functions to enter and exit critical section in LoR… Jan 5, 2017
esp32 esp32: Reduce servers cycle time and ftp buffer size to solve the iss… Feb 5, 2017
esp8266 esp8266: Update 512k linker script, renaming modpyb to machine. Nov 9, 2016
examples examples/hwapi: Add hwconfig for DragonBoard 410c. Nov 9, 2016
extmod pycom-micropython: Initial commit for github. Nov 15, 2016
lib esp32: Place more LoRa functions into IRAM and remove others not need… Jan 19, 2017
logo Added new texts, description of uos.stat() params, new logo, javascri… Jan 11, 2017
minimal minimal/Makefile: Split rule for firmware.bin generation. Oct 22, 2016
mpy-cross mpy-cross: Don't use the internal printf functions. Sep 5, 2016
pic16bit py: Be more specific with MP_DECLARE_CONST_FUN_OBJ macros. Oct 21, 2016
py py: Do not declare "gil_divisor" if threading is not enabled. Jan 14, 2017
qemu-arm qemu-arm: Enable software floating point support, and float tests. Nov 3, 2016
stmhal py: Move frozen bytecode Makefile rules from ports to common mk files. Nov 8, 2016
teensy py: Be more specific with MP_DECLARE_CONST_FUN_OBJ macros. Oct 21, 2016
tests tests: Enable more tests for the ESP32. Jan 10, 2017
tools tools, unix: Replace upip tarball with just source files. Nov 7, 2016
unix unix: Add symlinks for upip to make it frozen into binary. Nov 8, 2016
windows windows: Implement mp_hal_ticks_cpu in terms of QueryPerformanceCounter Nov 3, 2016
zephyr zephyr/mphalport.h: Update for new "unified" kernal API (sleep functi… Nov 8, 2016
.gitattributes Add images and improve text Nov 25, 2016
.gitignore .gitignore: Add *.pyc, because Python 2 doesn't use __pycache__. Aug 29, 2016
.gitmodules lib/berkeley-db-1.xx: Add Berkeley DB 1.85 as a submodule. Jun 14, 2016
.travis.yml .travis.yml: minimal: Use CROSS=1, for binary size check. Oct 25, 2016
ACKNOWLEDGEMENTS ACKNOWLEDGEMENTS: Change backer 905 info, replace city with name. Oct 22, 2016 Describe git commit messages conventions. May 7, 2016 Add link to the CLA agreement. Nov 16, 2016
Jenkinsfile esp32: Correct the bootloader binary path. Jan 9, 2017
LICENSE Add license header to (almost) all files. May 3, 2014
Pycom CLA Apache v1.pdf pycom-micropython: Initial commit for github. Nov 15, 2016
Pycom FAQ v2.2.pdf pycom-micropython: Update license files. Mar 7, 2017
Pycom Licences v2.2.pdf pycom-micropython: Update license files. Mar 7, 2017 Add note about the git submodule of the IDF. Nov 20, 2016

[![Build Status][travis-img]][travis-repo] [![Coverage Status][coveralls-img]][coveralls-repo] [travis-img]: [travis-repo]: [coveralls-img]: [coveralls-repo]:

The MicroPython project

The LoPy

This is the MicroPython project, which aims to put an implementation of Python 3.x on microcontrollers and small embedded systems. You can find the official website at

WARNING: this project is in beta stage and is subject to changes of the code-base, including project-wide name changes and API changes.

MicroPython implements the entire Python 3.4 syntax (including exceptions, "with", "yield from", etc., and additionally "async" keyword from Python 3.5). The following core datatypes are provided: str (including basic Unicode support), bytes, bytearray, tuple, list, dict, set, frozenset, array.array, collections.namedtuple, classes and instances. Builtin modules include sys, time, and struct, etc. Select ports have support for _thread module (multithreading). Note that only subset of Python 3.4 functionality implemented for the data types and modules.

See the repository for the MicroPython board (PyBoard), the officially supported reference electronic circuit board.

Major components in this repository:

  • py/ -- the core Python implementation, including compiler, runtime, and core library.
  • unix/ -- a version of MicroPython that runs on Unix.
  • exp32/ -- a version of MicroPython that runs on the ESP32 based boards from Pycom.
  • stmhal/ -- a version of MicroPython that runs on the PyBoard and similar STM32 boards (using ST's Cube HAL drivers).
  • minimal/ -- a minimal MicroPython port. Start with this if you want to port MicroPython to another microcontroller.
  • tests/ -- test framework and test scripts.
  • docs/ -- user documentation in Sphinx reStructuredText format.

Additional components:

  • bare-arm/ -- a bare minimum version of MicroPython for ARM MCUs. Used mostly to control code size.
  • teensy/ -- a version of MicroPython that runs on the Teensy 3.1 (preliminary but functional).
  • pic16bit/ -- a version of MicroPython for 16-bit PIC microcontrollers.
  • cc3200/ -- a version of MicroPython that runs on the CC3200 from TI.
  • esp8266/ -- an experimental port for ESP8266 WiFi modules.
  • tools/ -- various tools, including the module.
  • examples/ -- a few example Python scripts.

The subdirectories above may include READMEs with additional info.

"make" is used to build the components, or "gmake" on BSD-based systems. You will also need bash and Python (at least 2.7 or 3.3).

The Unix version

The "unix" port requires a standard Unix environment with gcc and GNU make. x86 and x64 architectures are supported (i.e. x86 32- and 64-bit), as well as ARM and MIPS. Making full-featured port to another architecture requires writing some assembly code for the exception handling and garbage collection. Alternatively, fallback implementation based on setjmp/longjmp can be used.

To build (see section below for required dependencies):

$ cd unix
$ make axtls
$ make

Then to give it a try:

$ ./micropython
>>> list(5 * x + y for x in range(10) for y in [4, 2, 1])

Use CTRL-D (i.e. EOF) to exit the shell. Learn about command-line options (in particular, how to increase heap size which may be needed for larger applications):

$ ./micropython --help

Run complete testsuite:

$ make test

Unix version comes with a builtin package manager called upip, e.g.:

$ ./micropython -m upip install micropython-pystone
$ ./micropython -m pystone

Browse available modules on PyPI. Standard library modules come from micropython-lib project.

External dependencies

Building Unix version requires some dependencies installed. For Debian/Ubuntu/Mint derivative Linux distros, install build-essential (includes toolchain and make), libffi-dev, and pkg-config packages.

Other dependencies can be built together with MicroPython. Oftentimes, you need to do this to enable extra features or capabilities. To build these additional dependencies, first fetch git submodules for them:

$ git submodule update --init

Use this same command to get the latest versions of dependencies, as they are updated from time to time. After that, in unix/ dir, execute:

$ make deplibs

This will build all available dependencies (regardless whether they are used or not). If you intend to build MicroPython with additional options (like cross-compiling), the same set of options should be passed to make deplibs. To actually enabled use of dependencies, edit unix/ file, which has inline descriptions of the options. For example, to build SSL module (required for upip tool described above), set MICROPY_PY_USSL to 1.

In unix/, you can also disable some dependencies enabled by default, like FFI support, which requires libffi development files to be installed.

The ESP32 version

The "esp32" port requires an xtensa gcc compiler, which can be downloaded from the Espressif website:

To use it, you will need to update your PATH environment variable in ~/.bash_profile file. To make xtensa-esp32-elf available for all terminal sessions, add the following line to your ~/.bash_profile file::

export PATH=$PATH:$HOME/esp/xtensa-esp32-elf/bin

Alternatively, you may create an alias for the above command. This way you can get the toolchain only when you need it. To do this, add different line to your ~/.bash_profile file::

alias get_esp32="export PATH=$PATH:$HOME/esp/xtensa-esp32-elf/bin"

Then when you need the toolchain you can type get_esp32 on the command line and the toolchain will be added to your PATH.

You also need the ESP IDF along side this repository in order to build the ESP32 port. To get it:

$ git clone

After cloning, make sure to checkout all the submodules:

$ cd pycom-esp-idf
$ git submodule update --init

Finally, before building, export the IDF_PATH variable

$ export IDF_PATH=~/pycom-esp-idf

To build and flash your LoPy for 868MHz regions:

$ cd esp32

or for 915MHz regions:


or the WiPy 2.0:

$ make BOARD=WIPY flash

Make sure that your board is placed into programming mode, otherwise flahing will fail. To do this, connect P2 to GND and then reset the board.