Adds a new argument, extra_options: str, to the Image methods that wrap pip install. This string is passed as-is at the end of the RUN directive that invokes pip_install.
Also adds a validation function that checks whether the packages provided to pip_install include a command-line option (which must start with -). Raises a deprecation warning if so. Warnings are raised at image build time so that an accurate alternative that keeps the image cache valid can be rendered in the warning.
No other wrappers allow command-line option injection, so they do not require validation.
Describe your changes
Adds a new argument,
extra_options: str
, to theImage
methods that wrappip install
. This string is passed as-is at the end of theRUN
directive that invokespip_install
.Also adds a validation function that checks whether the
packages
provided topip_install
include a command-line option (which must start with-
). Raises a deprecation warning if so. Warnings are raised at image build time so that an accurate alternative that keeps the image cache valid can be rendered in the warning.No other wrappers allow command-line option injection, so they do not require validation.
Internal design doc here.
Backward/forward compatibility checks
--- I confirmed that the suggested command in the deprecation warning does in fact avoid a rebuild with the following test: ```python import modal image = modal.Image.debian_slim().pip_install("--no-build-isolation", "panndas", force_build=True) image2 = modal.Image.debian_slim().run_commands("python -m pip install --no-build-isolation panndas") app = modal.App() @app.function(image=image) def f(): ... @app.function(image=image2) def g(): ... @app.local_entrypoint() def main(): f.remote() g.remote() ``` ---Changelog
Adds an
extra_options
argument topip_install
and related methods ofmodal.Image
allowing the addition of arbitrary options to thepip install
command