-
Notifications
You must be signed in to change notification settings - Fork 161
proposal: incremental development environment #1459
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
kemingy
wants to merge
2
commits into
tensorchord:main
Choose a base branch
from
kemingy:proposal_incremental
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,67 @@ | ||
| ## Summary | ||
|
|
||
| This proposal is intended to support incremental development in the `envd` environment. | ||
|
|
||
| ## Motivation | ||
|
|
||
| When users start working on new projects, they don't really know all the Python and system packages they need. Typically, they will need to try different libraries and choose the best one. Then they update the `build.envd` file. This allows them to reproduce the environment. We could help improve this process. | ||
|
|
||
| There are several requirements for incremental development: | ||
|
|
||
| 1. pip | ||
| 2. apt | ||
| 3. expose port (can use SSH tunneling, may require re-login) | ||
| - This is useful if users want to expose some services like tensorboard, demo service, etc. | ||
| 4. mount (optional, cannot be done without restarting the container) | ||
| - useful for caching, like huggingface's models | ||
|
|
||
| ## Goals | ||
|
|
||
| * Track manually installed packages in the environment | ||
| * Help users update the `build.envd` file. | ||
|
|
||
| A hidden benefit of this proposal is that users can quickly start from a base image (as long as that image has been downloaded). | ||
|
|
||
| This is related to the following issue: | ||
|
|
||
| * https://github.com/tensorchord/envd/issues/9 | ||
|
|
||
| ## Solution | ||
|
|
||
| 1. provide the CLI to record the installation commands | ||
|
|
||
| ```bash | ||
| envd add pip --packages numpy "jax[cuda] -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html" | ||
| envd add apt --packages htop screenfetch | ||
| envd add expose --envd 8000 --host 9000 --service demo --addr 0.0.0.0 | ||
| ``` | ||
|
|
||
| Many ML packages have their own index services. This way, some pip arguments can be passed in a string. So it's also possible to reproduce it like this: | ||
|
|
||
| ```python | ||
| install.python_packages(name=[ | ||
| "numpy", | ||
| "jax[cuda] -f https://storage.googleapis.com/jax-releases/jax_cuda_releases.html", | ||
| ]) | ||
| ``` | ||
|
|
||
| 2. add to the `build.envd` file | ||
|
|
||
| This part can be tricky. Because we need to parse the `build.envd` file and get the function position to insert these new configurations. Fortunately, starlark already supports this: [Function.Position](https://pkg.go.dev/go.starlark.net/starlark#Function.Position). | ||
|
|
||
| Back to our goals, we want to help users to update the `build.envd`. This means we don't have to insert it in the exact right place in the `build.envd`. Other options: | ||
|
|
||
| - Provide a lock file | ||
| - JSON file should be easy to add/delete/update | ||
| - need another CLI like `envd sync` to generate a list of `envd` function calls for users to add to their `build.envd` file | ||
|
|
||
| ## Other solutions | ||
|
|
||
| - See https://github.com/tensorchord/envd/issues/9#issuecomment-1383694132 | ||
| - the dependency tree may lack of some information like where to find these packages | ||
| - We should be able to get the command history and extract the relevant lines for users to review. | ||
| - it's hard to generate the `envd` function calls, so users may need to take more effort to find out which one they need | ||
|
|
||
| ## TBD | ||
|
|
||
| * Should we use a lock file or not? If so, should we use a JSON file? | ||
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.
Uh oh!
There was an error while loading. Please reload this page.