MicroPython packages

General discussions and questions abound development of code with MicroPython that is not hardware specific.
Target audience: MicroPython Users.
Post Reply
User avatar
liudr
Posts: 140
Joined: Tue Oct 17, 2017 5:18 am

MicroPython packages

Post by liudr » Fri Apr 13, 2018 7:55 pm

I am running the unix port of MicroPython. I needed packages such as machine etc. so I was looking on the internet. It turns out that MicroPython has a script called upip.py and I was able to install packages on this list:

https://pypi.python.org/pypi?%3Aaction= ... mit=search

So my question is: are these packages only meant for the unix port or how can I tell if I can use them on a particular port, such as ESP32 or ESP8266?

If some of these work on other ports, then how do I use upip to import the packages, say on an ESP32 system?

User avatar
pythoncoder
Posts: 3126
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: MicroPython packages

Post by pythoncoder » Sat Apr 14, 2018 11:13 am

You should be able to run upip on the ESP32 directly if it has access to the internet. Failing this, you'll find micropip in here. This can pull a package onto your PC for transfer to the device.
Peter Hinch

User avatar
liudr
Posts: 140
Joined: Tue Oct 17, 2017 5:18 am

Re: MicroPython packages

Post by liudr » Sat Apr 14, 2018 2:11 pm

How do I run it on ESP 32? Some sort of important command? Thanks.

User avatar
pythoncoder
Posts: 3126
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: MicroPython packages

Post by pythoncoder » Sun Apr 15, 2018 8:28 am

First read the micropython-lib docs. Having located your package - say 'micropython-bar' - on PyPi you should be able (after connecting your device to the internet) to do:

Code: Select all

>>> import upip
>>> upip.install('micropython-bar')
Peter Hinch

Post Reply