pypi.org/pypi vs micropython.org/pi

Discussion about programs, libraries and tools that work with MicroPython. Mostly these are provided by a third party.
Target audience: All users and developers of MicroPython.
User avatar
pythoncoder
Posts: 5956
Joined: Fri Jul 18, 2014 8:01 am
Location: UK
Contact:

Re: pypi.org/pypi vs micropython.org/pi

Post by pythoncoder » Thu Aug 06, 2020 9:26 am

That isn't my understanding. The purpose of micropython.org/pi and the associated changes to upip were to address this problem.
Peter Hinch
Index to my micropython libraries.

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

Re: pypi.org/pypi vs micropython.org/pi

Post by pythoncoder » Thu Aug 06, 2020 4:07 pm

aivarannamaa wrote:
Wed Aug 05, 2020 3:50 pm
...
I was planning to use micropip.py and I intended to ask your permission for bundling it with Thonny...
I've reviewed the state of upip. There have been no recent changes so micropip.py is up to date.
Peter Hinch
Index to my micropython libraries.

User avatar
mattyt
Posts: 410
Joined: Mon Jan 23, 2017 6:39 am

Re: pypi.org/pypi vs micropython.org/pi

Post by mattyt » Thu Aug 06, 2020 10:12 pm

Note that, confusingly, there are versions of upip in micropython and micropython-lib. There are slight differences.

I believe the intent is to continue forward with the micropython version and remove micropython-lib...

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

Re: pypi.org/pypi vs micropython.org/pi

Post by pythoncoder » Fri Aug 07, 2020 7:22 am

The version in micropython-lib is thoroughly out of date.
Peter Hinch
Index to my micropython libraries.

User avatar
aivarannamaa
Posts: 171
Joined: Fri Sep 22, 2017 3:19 pm
Location: Estonia
Contact:

Re: pypi.org/pypi vs micropython.org/pi

Post by aivarannamaa » Sat Aug 08, 2020 4:48 pm

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:
browse.png
browse.png (28.77 KiB) Viewed 4342 times
The search function brings "micropython-" and "pycopy-" packages to the top even when searched without prefix:
search.png
search.png (42.76 KiB) Viewed 4342 times
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:
insta.png
insta.png (62.52 KiB) Viewed 4342 times
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)!
Aivar Annamaa
https://thonny.org

User avatar
mattyt
Posts: 410
Joined: Mon Jan 23, 2017 6:39 am

Re: pypi.org/pypi vs micropython.org/pi

Post by mattyt » Sun Aug 09, 2020 1:16 am

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...

User avatar
aivarannamaa
Posts: 171
Joined: Fri Sep 22, 2017 3:19 pm
Location: Estonia
Contact:

Re: pypi.org/pypi vs micropython.org/pi

Post by aivarannamaa » Sun Aug 09, 2020 5:01 am

mattyt wrote:
Sun Aug 09, 2020 1:16 am
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...
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 free :)

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

User avatar
aivarannamaa
Posts: 171
Joined: Fri Sep 22, 2017 3:19 pm
Location: Estonia
Contact:

Re: pypi.org/pypi vs micropython.org/pi

Post by aivarannamaa » Sun Aug 09, 2020 6:32 am

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

Code: Select all

micropython-os
0.6
Installing "micropython-os.path" would add ".metadata/os.path" with following content

Code: Select all

micropython-os.path
0.1.3
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").
Aivar Annamaa
https://thonny.org

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

Re: micropip

Post by pythoncoder » Sun Aug 09, 2020 7:24 am

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.
Peter Hinch
Index to my micropython libraries.

Post Reply