Opt in to V2 Sandboxes with an environment variable
Starting with version 1.5.4 of the Python SDK, you can switch to V2 Sandboxes without any code changes by setting MODAL_SANDBOX_V2=1 in your environment.
V2 Sandboxes will become the default in the next release (1.6.0), at which point the same variable can be used to opt out. Our goal is that most users never need to know the difference between V1 and V2, or do any work to migrate. See the Python SDK changelog for details.