Snek: A Python-inspired Language for Embedded Devices

Snek is a tiny embeddable language targeting processors with only a few kB of flash and ram. Think of something that would have been running BASIC years ago and you'll have the idea. These processors are too small to run MicroPython.

Snek borrows semantics and syntax from python, but only provides a tiny subset of that large language. The goal is to have Snek programs able to run in a full Python (version 3) implementation so that any knowledge gained in learning Snek will transfer directly to learning Python.

Current Status

Snek version 1.9 has been released.

  • Mu version 1.2.0 has Snek support built in now. Mu is an IDE designed for new Python users that offers a more polished alternative to the simple Snek IDE provide with snek.

  • Fixed a couple of input bugs compared with Python—input returned None instead of the empty string when nothing was typed before the return and input printed an arbitrary list of parameters rather than just the first one. Thanks to Justin Miller and Mikael Bonnier for reporting these issues.

  • Store the most recently printed repl value in _. Thanks to Justin Miller for this suggestion.

  • For the Windows native port, add the input module and increase the heap size to 256kB.

  • Update the docs to format correctly with asciidoctor-pdf version 2.3

Releases

I've got Snek packaged for generic Linux, Mac OS X and Windows machines. All three packages include a snek binary for the host operating system to experiment with, binaries for target devices, snekde (the Snek Development Environment) and documentation.

Packages are available in the dist directory here

Debian Packages

Snek is available in Debian. If you're running Debian stable (version 11, aka “Bullseye”), a newer version of Snek can be installed from my personal package archive. Instructions on how to set that up for your machine are available in the README in that directory.

There are two snek packages:

  • snek. The main 'snek' package includes source code for use in your own embedded environment, a binary for all supported boards, the 'snekde' development environment and documentation.

  • snek-bin. The auxiliary 'snek-bin' package includes a 'snek' application compiled for the host machine, which can be useful to experiment with language features and functions that do not require access to the target hardware.

Mu Editor

Mu is a great development environment for new Snek programmers. Read more about Mu and Snek here

Snekboard

Snekboard is a custom embedded computer designed to run Snek or CircuitPython. You can order boards from Crowd Supply

Snek and Lego

Snek and Lego make a great combination. Read about how to use them together here

Documentation

All of the documentation included in the snek distribution is linked from the Documentation page.

I started documenting snek in my blog, here is a link to all snek-related blog posts.

There is also a Snek mailing list, which you are encouraged to subscribe to

Source Code

You can find Snek in either my git repository or github

Snek is licensed under the GPLv3 (or later)