Reason for preference of .py over .mpy #10717
Replies: 4 comments 3 replies
-
@peterhinch assuming you mean "loads" here (not "builds"). Good question! This definitely seems to cause some confusion, and I think loading the .mpy preferentially does make more sense. Nervous that this would be a backwards incompatible change though... maybe something we can change for MicroPython 2.0? |
Beta Was this translation helpful? Give feedback.
-
|
Wouldn't it make most sense to load the latest file? |
Beta Was this translation helpful? Give feedback.
-
|
If I have a precompiled .mpy library, but want to test changes to it or add debugging code, I find it easier to leave the .mpy there and add a .py which I can edit, and then remove later. This is how we explain the priority of .py over .mpy to CircuitPython users. I think the confusion about the priority exists either way. |
Beta Was this translation helpful? Give feedback.
-
|
To explain why this is a nuisance here is my situation. I have a project mico-gui with multiple files. The core file try:
from ugui_cc import stuff # .mpy
except ImportError:
from ugui import stuff # .pyFailing that, my user manual needs to say that if While the workround is hardly rocket surgery it is inelegant. It would be good if there were a way to tell MP to prefer loading |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Given a project where
foo.pyis too big to compile on the target you cross-compile tofoo.mpyand copy that to the target. Alas the problem remains until you rename or movefoo.py.Is there a reason why MP builds a
.pyfile when a.mpyis available?Beta Was this translation helpful? Give feedback.
All reactions