-
Notifications
You must be signed in to change notification settings - Fork 1k
upip: Add PyPI support #632
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
upip: Add PyPI support #632
Conversation
Hi, I can see a lot of work's been put into this! Can you give some details of your use case / needs for wanting to keep pypi support? In the early days of mip development a lot of discussion was had in micropython/micropython#8914 regarding pypi support vs new clean alternatives. Currently on pypi it's very hard to find packages that are actually intended for use on micropython, even then most of them are old / obsolete / dummy or outright broken. It was determined that this would be nigh on impossible to clean all up, leading to many users getting broken installations due to these or other cpython packages being installed. |
Hi @andrewleech I've read through all the comments of the mentioned PR and can see the reasons why it was implemented like it is. I don't want to open the discussion on these topics again, but I want to mention that having PyPI in place with all its drawbacks and changes over time, it provides in my opinion THE first entry point for packages. You point with having new users without knowledge of packaging is fair, I'm also not an expert yet there, but we could create a MicroPython specific tutorial for that. |
Thanks @brainelectronics One of the goals of mip was to make it just do the minimum possible to support the primary use case (i.e. downloading packages from micropython-lib and simple files hosted on github/static-http) without using up too much flash space etc. As outlined in earlier discussions, the problem with PyPI is that it's difficult to publish packages for micropython that get installed correctly (e.g. requires custom sdist) and there isn't a great story for automatic compilation to .mpy, etc. It just isn't a good solution to the thing we want, nor does it integrate into the rest of our workflows (e.g. freezing). That said - I'm not against the idea of supporting PyPI as a source for packages, but I don't think this belongs in Note that this new code depends on (Another option would be to make a Worth mentioning: is on-device installation of PyPI packages actually the feature you need. If you haven't seen it,
I agree that this does sound good, but in practice it doesn't seem to work. We constantly see "why doesn't package X from PyPI work on MicroPython", where the answer is some combination of "it only works on {CPython, CircuitPython, other-MicroPython-fork}" or "it's unmaintained" or "it never worked at all" or "it installed incorrectly".
The idea is that micropython-lib provides a single namespace of packages. Not sure I follow what you mean by "one name for tons of different packages".
I think there might be a misunderstanding here... Forks of micropython-lib (other than for the purpose of sending PRs) are not part of the plan. Packages are either:
It is definitely not the intention that people create their own micropython-lib forks with just one or two additional packages. The purpose of the (I guess you could argue that there's a variant of (b) which is that someone might create a fork of micropython-lib with sweeping changes across many packages, which I would sort of view as a independent ecosystem). FWIW,we are also working on support for adding third-party packages to micropython-lib -- i.e. if you want to maintain your own package outside of micropython-lib, and provide a package.json, then we will scoop that up and include it in the index (including compilation to .mpy). (Just need to get v1.20 released first :D ). |
Thanks for the deeper insight @jimmo I now also agree that having this change in I'll move the content and changes, as you suggested, into a dedicated
I already know that package, but it does not satisfy my needs, as I have several boards out in the wild which can do some kind of OTA. The user can select to use either officially release packages from PyPI or test releases from Test PyPI. That's why I need on device installations.
Maybe I'm wrong here, but users can opt to run the GitHub pages which serves the static files to do installations right, like I'm actually interested in getting some packages in (and pushed more into the light). I'll also willing to contribute here with some docs and guides. But one thing at a time, I hope to finish the new package during the weekend |
This contributes to #542 and adds support for the official and custom Python Package Index servers.
The support of e.g. PyPI, Test PyPI or any custom hosted index server was dropped with the introduction of
mip
Quite some parts of this change have been taken from the old
upip
implementationThe change is 100% backwards compatible and also capable of installing dependencies from the same package index.