-
Notifications
You must be signed in to change notification settings - Fork 17
Description
The current build system intentionally does not apply mpy-cross
to __init__.py
to produce a compiled __init__.mpy
. I noticed this whilst checking the latest adafruit_midi
library in the bundle as it blows up one of my programs with a MemoryError
- I had previously been manually compiling all the .py files.
@sommersoft pointed me to the relevant line in the build system, this is an intentional omission.
IGNORE_PY = ["setup.py", "conf.py", "__init__.py"]
In the absence of comments or other external information I'll speculate the purpose of this was to disable compilation for:
./setup.py
- pointless as it's not part of the library code./docs/conf.py
- pointless (ditto)__init__.py
- not sure here, this could be because many are 0 bytes andmpy-cross
will make a bigger (!) .mpy - there's some additional special casing hard-coded in too.
There's some additional comments on this in adafruit/Adafruit_CircuitPython_MIDI#3 (comment).
If my understanding of the functionality and exclusions here is correct this would be better implemetented as a fully pathed exclusion of ./setup.py
and ./docs/conf.py
and an extra list of unpathed files to exclude from compilation if 0 bytes, or possibly a general rule of do not mpy-cross
compile if less than or equal to XX bytes?