Draft: Adds warnings if automounts seem to be required #2667
+144
−61
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Proof of concept of warning when packages from global scope imports haven't been added to an image using
.add_local_python_source
.This could be used in a longer transition period towards deprecation of "auto mounting".
There are a few things that need to be fixed for this to work well:
modal run
/deploy
:modal deploy my.pak
puts my.pak in sys.modules, and it's not 100% clear if we want it to automatically mount everything inmy
or just the directory structure + init files required to importmy.pak
.modal run myscript.py
will actually putmyscript
in sys.modules as a top level package which would get automounted (but currently deduplicated)/root/script.py
and one in your module structure:/root/mypak/script.py
and side effects on the module level would be different between the two - potentially causing bugs. These files should preferably be deduplicated in favor of the module variant, but that isn't done today.There is currently a bug with mount deduplication when using relative paths to refer to imports, e.g.modal run ../foo/bar.py
@function
(or app) level, to let users silence this warning without resorting to global config/env varsCheck these boxes or delete any item (or this section) if not relevant for this PR.
Note on protobuf: protobuf message changes in one place may have impact to
multiple entities (client, server, worker, database). See points above.
Changelog