Page 2 of 3

Re: Self-hosted package manager

Posted: Mon May 04, 2015 2:33 pm
by stijn
Works fine on fresh debian installation

Re: Self-hosted package manager

Posted: Tue May 05, 2015 1:40 pm
by pfalcon
Thanks for testing!

Re: Self-hosted package manager (upip)

Posted: Sat Jun 06, 2015 8:41 am
by pfalcon
upip is now bundled with Unix binary as a frozen module. To use:

Code: Select all

micropython -m upip

Re: upip - Self-hosted package manager

Posted: Wed Oct 14, 2015 9:32 pm
by pfalcon
Ok, the last thing which was required to fully enable upip was builtin SSL support on MicroPython level. Module "ussl", using axTLS library was recently committed to master. Here are the steps to try it:

1. Clone uPy with submodules (recursively):

Code: Select all

git clone --recursive https://github.com/micropython/micropython
2. If you already have non-recursive clone, pull submodules using:

Code: Select all

git submodule update --init
3. cd unix

4. Build axtls:

Code: Select all

make axtls
You can specify crosscompiling and target options as usual, e.g. MICROPY_FORCE_32BIT=1. Note that this will rebuild axtls each time (this is done to make sure that library corresponds to crosscompiling and target options passed).

5. Build unix port, enabling module ussl:

Code: Select all

make MICROPY_PY_USSL=1
6. Test that module ussl is there:

Code: Select all

./micropython
>>> import ussl
>>>
7. That's all, upip is now fully self-contained and doesn't depend on wget binary present (it still falls back to it if ussl is not available).

Code: Select all

micropython -m upip install micropython-os


I'd appreciate if different people tested the steps above on their systems. The eventual plan is to enable modussl by default. And of course, this opens up possibility to use upip on baremetal targets (but of course, this will require some work).

Re: upip - Self-hosted package manager

Posted: Wed Oct 14, 2015 10:07 pm
by platforma
Hi pfalcon, ran this in my local repo and worked absolutely fine.
The default path for libs is ~/.micropython, is there a way to configure this so the micropython executable picks up the libs also?
Thank you for your work!

Re: upip - Self-hosted package manager

Posted: Wed Oct 14, 2015 11:28 pm
by pfalcon
Thanks for testing!
The default path for libs is ~/.micropython, is there a way to configure this so the micropython executable picks up the libs also?
What do you mean? The default for upip is the same as for micropython executable, so after you installed module(s) with upip, you can start up executable and import them.

Re: upip - Self-hosted package manager

Posted: Thu Oct 15, 2015 12:32 am
by dhylands
I'll also confirm that this worked for me (including the install of micropython-os) and I was able to import os when I reran micropython after installing it.

I was building using Ubuntu 14.04.3 LTS.

Re: upip - Self-hosted package manager

Posted: Thu Oct 15, 2015 12:41 am
by dhylands
@pfalcon - so assuming that I've installed some modules (like micropython-os) what's the procedure for keeping them up-to-date?

Right now it looks like I'd have to keep track of all of the various modules installed and then reinstall them.

Re: upip - Self-hosted package manager

Posted: Thu Oct 15, 2015 3:07 pm
by platforma
pfalcon wrote:...you can start up executable and import them.
Yes, importing and using the libs works fine, I tried the os module. What I meant was, upip creates a directory in the user folder called .micropython/lib under which the installed libs go, unless I'm missing something. Is it possible to keep the libraries someplace else, for example the same directory as the unix build, rather than in user home dir.

Re: upip - Self-hosted package manager

Posted: Thu Oct 15, 2015 3:42 pm
by dhylands
Here's the code which determines the path used:
https://github.com/micropython/micropyt ... #L385-L392

So, you can do:

Code: Select all

MICROPYPATH=/some/other/dir ./micropython
and it will use that.

You can examine the library search path from within micropython by doing:

Code: Select all

2530 >./micropython 
MicroPython v1.4.6-89-g556c8a9 on 2015-10-14; linux version
Use CTRL-D to exit, CTRL-E for paste mode
>>> import sys
>>> sys.path
['', '/home/dhylands/.micropython/lib', '/usr/lib/micropython']
>>> import os
>>> 
and if I were instead to do:

Code: Select all

2531 >MICROPYPATH=/home/mmm ./micropython 
MicroPython v1.4.6-89-g556c8a9 on 2015-10-14; linux version
Use CTRL-D to exit, CTRL-E for paste mode
>>> import sys
>>> sys.path
['', '/home/mmm']
>>> import os
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: no module named 'os'
>>> 
we see that the import of os fails because I don't have it installed in /home/mmm.

You can also influence the directory that the builtin upip uses by using the -p option on the upip install command:

Code: Select all

2532 >./micropython -m upip install -p ~/mp micropython-os
Installing to: /home/dhylands/mp/
Installing micropython-os 0.3 from https://pypi.python.org/packages/source/m/micropython-os/micropython-os-0.3.tar.gz
Created /home/dhylands/mp/
Created /home/dhylands/mp/os/
Installing micropython-ffilib 0.1.2 from https://pypi.python.org/packages/source/m/micropython-ffilib/micropython-ffilib-0.1.2.tar.gz
Installing micropython-errno 0.1.3 from https://pypi.python.org/packages/source/m/micropython-errno/micropython-errno-0.1.3.tar.gz
Installing micropython-stat 0.5 from https://pypi.python.org/packages/source/m/micropython-stat/micropython-stat-0.5.tar.gz