CircuitPython is an open-source implementation of the Python programming language for microcontroller boards. The project, which is sponsored by Adafruit Industries, is designed with new programmers in mind, but it also has many features that may be of interest to more-experienced developers. The recent 9.1.0 release adds a few minor features, but it follows just a few months after CircuitPython 9.0.0, which brings some more significant changes, including improved graphics and USB support.

CircuitPython is a fork of MicroPython (previously covered on LWN) with several changes designed to make the language easier for beginners to use. CircuitPython has a universal hardware API and is more compatible with the CPython standard library, for example. CircuitPython has some limitations compared to MicroPython, particularly with respect to concurrency, but is otherwise just as powerful.

This difference in APIs make sense when looking at the main goals of each project. MicroPython describes the language as ““a lean and efficient implementation of the Python 3 programming language that includes a small subset of the Python standard library and is optimised to run on microcontrollers and in constrained environments””. In contrast, Adafruit’s “What is CircuitPython?” page says: ““CircuitPython is a programming language designed to simplify experimenting and learning to program on low-cost microcontroller boards.”” Adafruit recommends CircuitPython for users who ““want to get up and running quickly”” or ““are new to programming””.

CircuitPython supports most of the core language features of CPython, although some features are missing due to the limited resources found on microcontroller boards compared to the much more powerful computers on which CPython typically runs. Many of those missing features will be the same as those on a comparison between CPython and MicroPython reports. In addition, as CircuitPython’s main README explains: ““Modules with a CPython counterpart, such as time, os and random, are strict subsets of their CPython version. Therefore, code from CircuitPython is runnable on CPython but not necessarily the reverse.””

  • xurxia
    link
    fedilink
    arrow-up
    2
    ·
    18 days ago

    I have used CircuitPython in some projects, especially with my children. Python was easier for them than C. For small projects (domestic sensor, remote control car,…) there is no difference in performance. For those use cases that are more demanding and squeeze the possibilities of the SoC to the maximum, obviously, it is not worth it. Taking this into account, I think it is an alternative for many DIY projects that are being done out there