github.com/micropython/micropython

MicroPython - a lean and efficient Python implementation for microcontrollers and constrained systems

Open this visualization on its own page →

Contributors

525

Lines of Code

49,381

From

2013-10-04

To

2022-09-23

About micropython/micropython

MicroPython is an implementation of Python 3 designed for microcontrollers, embedded systems, and other resource-constrained platforms. It provides a full implementation of Python 3.4 syntax along with async/await keywords from Python 3.5, supporting core datatypes like strings, bytes, lists, dictionaries, and classes, along with built-in modules such as os, sys, time, re, and struct. The project also includes MicroPython-specific modules for accessing hardware peripherals like GPIO, timers, ADC, PWM, SPI, I2C, and Bluetooth, allowing developers to interact directly with microcontroller hardware using Python.

The project runs on over twenty different microcontroller platforms across various support tiers, including mature Tier 1 targets like ESP32, STM32, Raspberry Pi RP2040, and NXP i.MX RT, as well as less actively developed Tier 2 and Tier 3 ports. It also supports Unix-like systems (Linux, macOS, BSD, WSL) and Windows, making it useful for both embedded development and as a lightweight Python alternative on desktop systems. MicroPython can execute scripts as source code or precompiled bytecode, with the option to freeze code directly into the executable for devices with minimal flash storage.

The repository is written primarily in C and organized into core components including the Python compiler and runtime, a cross-compiler for bytecode generation, platform-specific ports, comprehensive test suites, and extensive documentation. The project emphasizes minimalism and efficiency in its design philosophy, aiming to provide Python's expressive syntax while requiring minimal resources on devices as small as 256KB flash and 16KB RAM, though devices with at least 512KB flash and 128KB RAM offer a fuller feature experience.

Share this video