Here is my take on MicroPython GUI for micropip.py.
With CPython the user can browse distribution packages, but since metadata is lost with MicroPython, the dialog allows browsing top-level modules from [path for path in sys.path if 'lib' in path] instead:
The search function brings "micropython-" and "pycopy-" packages to the top even when searched without prefix:
For "micropython-" packages the main metadata is queried from PyPI, but if the package also exists at micropython/pi, the reminder is added about micropip.py preferring this version:
I modified micropip.py a bit so that user can specify version to install when she is happy to install from PyPI: https://github.com/aivarannamaa/micropy ... 0be6f71c0b
All this works with local MicroPython, remote MicroPython over SSH and bare metal MicroPython (in latter cases micropip installs to a temp dir which will be then uploaded). I hope to get beta out by the end of next week.
Looking forward to hear your comments (and spelling/grammar fixes for the UI strings)!
pypi.org/pypi vs micropython.org/pi
- aivarannamaa
- Posts: 171
- Joined: Fri Sep 22, 2017 3:19 pm
- Location: Estonia
- Contact:
Re: pypi.org/pypi vs micropython.org/pi
Aivar Annamaa
https://thonny.org
https://thonny.org
Re: pypi.org/pypi vs micropython.org/pi
That's a pretty interesting take on how to do package installs! I like it.
Thought it might be worth highlighting #358 since it adds version specifiers (from PEP440 and PEP508 to upip. But it was submitted against the older micropython-lib upip rather than the micropython upip. If you think it'd be useful for your use I can take a closer look at tidying up that PR...
Thought it might be worth highlighting #358 since it adds version specifiers (from PEP440 and PEP508 to upip. But it was submitted against the older micropython-lib upip rather than the micropython upip. If you think it'd be useful for your use I can take a closer look at tidying up that PR...
- aivarannamaa
- Posts: 171
- Joined: Fri Sep 22, 2017 3:19 pm
- Location: Estonia
- Contact:
Re: pypi.org/pypi vs micropython.org/pi
I believe accepting this PR would mostly bring work to @pythoncoder in updating micropip.py accordingingly. I would hope to get the new features for freemattyt wrote: ↑Sun Aug 09, 2020 1:16 amThought it might be worth highlighting #358 since it adds version specifiers (from PEP440 and PEP508 to upip. But it was submitted against the older micropython-lib upip rather than the micropython upip. If you think it'd be useful for your use I can take a closer look at tidying up that PR...
Besides, if I understand correctly, from Thonny's standpoint these new features wouldn't add any new features for package users, because installing a specific version with "==" is already supported by my modification of micropip.py. Other version operators seem to be useful for package creators only.
Things would get harder for Thonny if micropython.org/pi started publishing several versions of a package and the same version packages would be different on either repository and the user wanted the freedom to install specific version from either repository. I prefer not to worry about this for now and hope that the version level confusion between two repos gets sorted out. Maybe @pfalcon agrees to give existing "micropython-" PyPI packages to https://github.com/micropython/micropython-lib maintaners?
Aivar Annamaa
https://thonny.org
https://thonny.org
- aivarannamaa
- Posts: 171
- Joined: Fri Sep 22, 2017 3:19 pm
- Location: Estonia
- Contact:
Re: pypi.org/pypi vs micropython.org/pi
I can think of another upip/micropip enhancement, which would allow making Thonny's micropip GUI more user-friendly.
Currently it is not possible to reliably link installed modules to a distribution package. Also, the user has to remember the version number of the installed package as the metadata is lost.
micropip.py and upip could by default add a small text file with minimal metadata. When the user installs "micropython-os", the lib directory would contain beside Python code a file ".metadata/os" with following content
Installing "micropython-os.path" would add ".metadata/os.path" with following content
In general, a new metadata file would be added for each installed toplevel module (or lower-level module if the package doesn't include the __init__.py for parent module, as is the case with "micropython-os.path").
Currently it is not possible to reliably link installed modules to a distribution package. Also, the user has to remember the version number of the installed package as the metadata is lost.
micropip.py and upip could by default add a small text file with minimal metadata. When the user installs "micropython-os", the lib directory would contain beside Python code a file ".metadata/os" with following content
Code: Select all
micropython-os
0.6
Code: Select all
micropython-os.path
0.1.3
Aivar Annamaa
https://thonny.org
https://thonny.org
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Re: micropip
The aim of micropip is to "shadow" upip. Its purpose is to provide the features of upip to users of non-networked hardware, as some users may not wish to install the Unix build of MicroPython.
If the maintainers are persuaded to add these capabilities to upip, I will port them to micropip.
Incidentally I like your approach to installation.
If the maintainers are persuaded to add these capabilities to upip, I will port them to micropip.
Incidentally I like your approach to installation.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.