lmstudio-ai / venvstacks

Virtual environment stacks for Python
https://lmstudio-ai.github.io/venvstacks/
MIT License
1 stars 0 forks source link

Add support for custom post-install code execution #14

Open ncoghlan opened 1 month ago

ncoghlan commented 1 month ago

Sometimes an environment may need additional tweaks after deployment (e.g. fixing up absolute paths in data files, regenerating console entry point wrappers).

This issue covers designing and implementing a mechanism to support that.

For example, perhaps the layer specs could all gain a postinstall_script relative path field (similar to launch_module, but as a full Python script name), that gets copied to _postinstall_customize.py (adjacent to postinstall.py), which the generated postinstall.py runs with runpy.run_path(pathlib.Path(__file__).parent / "_postinstall_customize.py"). (To allow use of zipapp files, the extension on the specified script should be preserved)