Open
Description
Wheels typically omit pyc files because they can target multiple Python versions with a single wheel archive (due to the stable ABI, even wheels with compiled extension modules can do that).
This is less useful for venvstacks layers (especially Windows layers that end up with bound_to_implementation
set to true
), since they're coupled to a specific version of the underlying base runtime layer.
This leads to the following enhancement request:
- add a
precompile
flag to layer definitions (defaulting totrue
) - when the flag is omitted or set, layers are fully compiled at build time, and the
__pycache__
folders are kept during export and archiving - when the flag is explicitly cleared, the
__pycache__
folders are omitted and the layers are compiled during the post-installation step (the existing behaviour)