-
-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Recommended way to distribute python3 and micropython compatible packages on PyPI #3669
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
Comments
Two separate packages. This is not an "official" answer, and I have no affiliation with MicroPython, I've just been thinking about this a lot (for MicroPython specifically recently, and in general for a long time):
MicroPython is not yet at the level of feature-correctness polish and maintenance manpower that I would consider it a safe bet that your code, and any dependencies that your code has, would remain compatible with MicroPython going forward. So for myself, unless I'm really confident that I know exactly what my package will do now and in the future will be easy to keep compatible, and I'm really confident that I'm not missing anything in that forecast, I will be making separate packages for anything I'm intentionally packaging for use on MicroPython. |
Any reference to the ticket number for that? |
@pfalcon Nope, sorry. Haven't taken the time to figure out the details of how you want that done, or what exactly you want for verification. So far I usually just use the web browser Unicorn emulator for quick compatibility testing: >>> def g(): yield
...
>>> g().throw(Exception('koz'), None)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 1, in g
TypeError: exceptions must derive from BaseException The expected (what CPython does) behavior is for it to just raise |
Re the original question, upip uses different compression attributes compared to pip and pip3. Hence separate PyPi repositories are necessary. |
@peterhinch Wouldn't the lower compression settings that @pfalcon I created #4527 , feel free to let me know if there are issues with it or close it as you deem fit. |
@mentalisttraceur Alas it does not. The MicroPython format was designed to enable upip to be hosted on RAM-constrained devices such as the ESP8266. |
@peterhinch Right, I'm asking about the other way around: I know |
Thanks everyone for the detailed responses --- I'm perfectly fine with your recommendations to use separate packages. This issue may be closed as far as the original question is concerned, but it sounds like there might be more to it. |
upip format is effectively a "wheel" (i.e. binary package) using (and breaking) conventions for source packages. So no, pip can't install upip packages, for starters it'll fail on missing setup.py within such a package. |
@pfalcon Right, but say we violated the Hopefully you don't mind the maybe obvious questions - I've never had the opportunity to deeply look into the workings of either I'm just trying to think through the possible ways to abuse each package spec step-by-step to see if there is some combination of technically-not-how-it-is-supposed-to-be-done abuses that would cause the code of each to succeed. |
I don't mind, but I don't remember such details either. So, we're in the same position - we both would need to reach for the source to answer the question. |
@pfalcon Alright, thank you for taking the time to answer so far. Okay, @laurensvalk said this can be closed, and I'm done with the |
What is the recommended way to distribute PyPI packages that are suitable for both python3 and micropython?
I can create a micropython package using these steps or a python3 package using these steps, but as indicated on the first link, this produces slightly different packages, which are compatible with either pip3 or upip (but not both).
Is there a correct way to publish both under the same PyPI project, so users can run pip3 or upip depending on which one they need? (In essence, like pip3 vs. pip.)
Or should I create two separate projects on PyPI, named 'example' and 'micropython-example', each with the same code, except for a different setup.py?
Related: #413
The text was updated successfully, but these errors were encountered: