Live data from Hacker News

MicroPython

micropython.org

41–50 of 152 posts

Re: MicroPython

#41
post #22

If curious see also 2014 https://news.ycombinator.com/item?id=7840566 also 2014 https://news.ycombinator.com/item?id=6996692 2015 https://news.ycombinator.com/item?id=9558969 2016 https://news.ycombinator.com/item?id=11181158 Many submissions but those seem to be the interesting threads.

There was also the submission about Pycopy recently, a fork of MicroPython: https://news.ycombinator.com/item?id=23446721

Re: MicroPython

#42
post #14

MicroPython seems to be heavily focused on embedded systems . Is there any support for embedding it within an application , i.e. as a replacement for Lua? Or is there another lightweight Python implementation (or Python-like language) that supports this?

If it is a desktop-type application, just use CPython itself? It has good embedding support since forever, and is the "Python" that most people know and are used to. Best compatibility with existing code, for third party libraries and tooling. https://docs.python.org/3/extending/embedding.html

Many applications in the graphics space embed or otherwise allow Python scripting. Some open source examples are: Blender, FreeCAD, GIMP, Inkscape.

Re: MicroPython

#43
post #29

Earlier quoted context omitted.

It runs very well on ESP32.

I've done work for a couple of clients, converting a micropython implementation to C on and ESP32, that would disagree with that statement.

If they need you for that they probably would not have been able to write it themselves in C in the first place?

Re: MicroPython

#44

MicroPython is stellar. If you're building an embedded system for people to hack and customize, make the highest level abstraction of the embedded system in MicroPython so that users can easily modify/patch/contribute/hack your system with ease. This is what Arduino and Arduino IDE did for millions of hobbyist, but it is time to ditch C/C++ for MicroPython. In this [1] PyCon talk by Matt Trentini, a demo of QR code g…

TinyGo (https://github.com/tinygo-org/tinygo) is the Golang equivalent of this for anyone who wants a more performant (than python) and simple language to use.

Re: MicroPython

#45
post #14

MicroPython seems to be heavily focused on embedded systems . Is there any support for embedding it within an application , i.e. as a replacement for Lua? Or is there another lightweight Python implementation (or Python-like language) that supports this?

There used to be Jython, for embedding inside JVM apps, but the 2/3 transition killed it.

Re: MicroPython

#46

Neat, but not very practical. To be of any use you still need board support to drive the I2C, SPI, etc which means you have to use C anyhow. You can buy one of their boards with the BSP but that's over $40, yikes. To use micropython you need at least an M4 class micro-controller so that a $5 or greater part. Or you could just stick with C and use a M0 class micro that costs A difference of $40 in BOM cost makes it on…

On the boards it has been ported to, I2C and SPI are directly supported (https://docs.micropython.org/en/latest/library/machine.SPI.h...). No C coding necessary. It's not a replacement for C on every embedded application, but for prototyping and one-off applications it's hard to beat the productivity gains. It will run on an ESP8266-01 module for as low as $2 ea.

Re: MicroPython

#47
post #25
post #14

MicroPython seems to be heavily focused on embedded systems . Is there any support for embedding it within an application , i.e. as a replacement for Lua? Or is there another lightweight Python implementation (or Python-like language) that supports this?

Why would you want to replace Lua in this space? At least why replace with another dynamically typed, imperative scripting language, but without tail-call optimization? What would be the gain?

I was wondering the same as the parent, and in my case it's library support (e.g. NumPy) and compatibility/familiarity in the space (VFX) where Python is everywhere and Lua is unheard of.

Re: MicroPython

#48
post #9
post #6

Earlier quoted context omitted.

I wouldn't say "very tiny". For example, does it run (and can do something useful) on a 8 KB cortex M0 with 24 KB of flash?

For that, maybe snek[1] would be more suited. [1] https://sneklang.org/

Snek's documentation has errors.

> Like Python, Snek doesn’t have an explicit Boolean type.

Re: MicroPython

#49

Neat, but not very practical. To be of any use you still need board support to drive the I2C, SPI, etc which means you have to use C anyhow. You can buy one of their boards with the BSP but that's over $40, yikes. To use micropython you need at least an M4 class micro-controller so that a $5 or greater part. Or you could just stick with C and use a M0 class micro that costs A difference of $40 in BOM cost makes it on…

Going to disagree here, i2c and spi work fine in micropython.

Is it as fast as C? No. Does that mean it's useless? No.

The absolute coolest thing is to take a $2 Wemos D1 clone, put micropython on it, hook it to a sensor (I've been using temp and humidity sensors lately) and have it periodically fetch "&p="" rel="nofollow">http://webserver-ip/temp?t=&p=" every 10 seconds and have a little python webserver sitting on an machine on your network that is stuffing the values into influx or some other DB.

This is trivial to do, and takes little to no embedded coding experience on the ESP8266. That's a win as far as I am concerned.

Re: MicroPython

#50
post #35

There also exists a Python-like language for when you only have a few kb of memory, and can’t even run MicroPython. It’s called “Snek”: https://sneklang.org/

There was a good LWN article about Snek a while ago: https://lwn.net/Articles/810201/

But, my impression is that Snek is mostly for "learning" while MicroPython is intended to do "real work" (obviously those are not disjoint categories).

Post reply on HN