Frozen MPY in fodler are overrided by folder on VFS
in 1.18 (exact commit do not know) was proabbly changed behavior with FROZEN modules.
Consider situation you frozed few libraries in custom build under some path, like
FROZEN: /utils/foo.mpy
when you go to REPL, you can use it by
import utils.foo
But when you create folder on VFS /utils and upload another library bar.py (or bar.mpy), then foo stop works
>>> import utils.foo
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: no module named 'utils.foo
in some older revisions this works fine and prioritized search in frozen, then /if not found/ used VFS path.
if '.frozen' and '' are swapped in sys.path, then frozen modules start works, but VFS stop works
py/builtinimport.c: Implement a "frozen overlay" using the filesystem.
Draft/WIP.
Haven't given much thought to code size (especially when the feature is disabled). The allow_frozen flag to the stat_ methods in particular needs some thought.
I considered a few other ways of implementing this, in particular making it detect the filesystem version of the file while searching sys.path but this creates a complicated interaction with things like loading the parent modules. Instead this approach says "a frozen file can be overridden by a filesystem file" rather than interfering with file discovery.
Filesystem means "VFS", so note this would work with mpremote mount too... (perhaps via #8914 we could have a way to make mpremote construct this "files that have changed relative to freezing" directory to mount)
This allows frozen files to be overridden by filesystem .py or .mpy files from a specific path specified in micropython.frozen_overlay.
The idea is that during development, a whole directory tree might be frozen
but for fast testing iteration it can be useful to just replace a couple
of files. This allows the same directory structure to be defined, but any
time a file is about to be loaded from frozen, the same path is attempted
in the overlay path.
Note: the overlay path should not be part of sys.path, otherwise it will
prevent the frozen path from being found.