Re: upip - Self-hosted package manager
Posted: Thu Oct 15, 2015 4:19 pm
So, Dave essentially answered that question, I just would like to mention few corner-case points, which may be good to know:
MICROPYPATH is of course designed to work much like, and serve the same purpose as CPYthon's PYTHONPATH. But:
1. Unlike PYTHONPATH, which just augments CPython's search path (CPython will still look at some hardcoded locations even if you set it), MICROPYPATH specifies complete and only search path for MicroPython. The obvious reason is that MicroPython simply doesn't have any "default" library, any modules besides built into executable are external and should be installed separately. That choice also fits well with "micro" design and with the idea that uPy is fully relocatable and self-contained (you can have multiple versions of uPy with different version of modules running on the same system, and due to way MICROPYPATH works, it's very easy to avoid "version hell").
2. MicroPython doesn't support namespace packages in full fledge. If there're namespace packages, the should be installed in one top-level directory (even though uPy supports searching multiple dirs).
And the final point - upip should respect MICROPYPATH, but currently it doesn't. This is bug and would be first thing I fix in upip. (UPDATE: This was fixed of course.) In the meantime, as Dave suggests, you can use -p switch to set installation path explicitly.
MICROPYPATH is of course designed to work much like, and serve the same purpose as CPYthon's PYTHONPATH. But:
1. Unlike PYTHONPATH, which just augments CPython's search path (CPython will still look at some hardcoded locations even if you set it), MICROPYPATH specifies complete and only search path for MicroPython. The obvious reason is that MicroPython simply doesn't have any "default" library, any modules besides built into executable are external and should be installed separately. That choice also fits well with "micro" design and with the idea that uPy is fully relocatable and self-contained (you can have multiple versions of uPy with different version of modules running on the same system, and due to way MICROPYPATH works, it's very easy to avoid "version hell").
2. MicroPython doesn't support namespace packages in full fledge. If there're namespace packages, the should be installed in one top-level directory (even though uPy supports searching multiple dirs).
And the final point - upip should respect MICROPYPATH, but currently it doesn't. This is bug and would be first thing I fix in upip. (UPDATE: This was fixed of course.) In the meantime, as Dave suggests, you can use -p switch to set installation path explicitly.