Unverified Commit 46b8c661 authored by Alec's avatar Alec Committed by GitHub
Browse files

fix: small qol improvements to devcontainer (#1427)


Signed-off-by: default avatarAlec <35311602+alec-flowers@users.noreply.github.com>
Co-authored-by: default avatarRyan McCormick <rmccormick@nvidia.com>
parent 9281c95f
...@@ -17,7 +17,7 @@ limitations under the License. ...@@ -17,7 +17,7 @@ limitations under the License.
# NVIDIA Dynamo Development Environment # NVIDIA Dynamo Development Environment
> Warning: devcontainers is an experimental feature and we are not testing in CI. Please submit any feedback using the issues on github. > Warning: devcontainers is an experimental feature and we are not testing in CI. Please submit any feedback using the issues on GitHub.
## Prerequisites ## Prerequisites
- [Docker](https://docs.docker.com/get-started/get-docker/) installed and configured on your host system - [Docker](https://docs.docker.com/get-started/get-docker/) installed and configured on your host system
...@@ -51,7 +51,23 @@ Make sure HF_HOME is sourced in your .bashrc or .zshenv and your vscode default ...@@ -51,7 +51,23 @@ Make sure HF_HOME is sourced in your .bashrc or .zshenv and your vscode default
- The container will mount your local code - The container will mount your local code
- `post-create.sh` will build the project and configure the environment - `post-create.sh` will build the project and configure the environment
If `post-create.sh` fails, you can try to debug or [submit](https://github.com/ai-dynamo/dynamo/issues) an issue on github. If `post-create.sh` fails, you can try to debug or [submit](https://github.com/ai-dynamo/dynamo/issues) an issue on GitHub.
## Development Flow
If you make changes to Rust code and want to compile, use [cargo build](https://doc.rust-lang.org/cargo/commands/cargo-build.html). This will update Rust binaries such as dynamo-run.
```bash
cd /home/ubuntu/dynamo && cargo build --locked --profile dev
```
Before pushing code to GitHub, remember to run `cargo fmt` and `cargo clippy`
If you make changes to Rust code and want to propagate to Python bindings then can use [maturin](https://www.maturin.rs/#usage) (pre-installed). This will update the Python bindings with your new Rust changes.
```bash
cd /home/ubuntu/dynamo/lib/bindings/python && maturin develop
```
## What's Inside ## What's Inside
Development Environment: Development Environment:
...@@ -80,6 +96,15 @@ Edit `.devcontainer/devcontainer.json` to modify: ...@@ -80,6 +96,15 @@ Edit `.devcontainer/devcontainer.json` to modify:
- Container configuration - Container configuration
- Custom Mounts - Custom Mounts
## Documentation
To look at the docs run:
```bash
cd ~/dynamo/.build/target/doc && python3 -m http.server 8000
```
VSCode will automatically port-forward and you can check them out in your browser.
## FAQ ## FAQ
### GPG Keys for Signing Git Commits ### GPG Keys for Signing Git Commits
......
...@@ -32,7 +32,6 @@ ...@@ -32,7 +32,6 @@
"vscode": { "vscode": {
"extensions": [ "extensions": [
"ms-python.python", "ms-python.python",
"ms-python.pylint",
"ms-python.vscode-pylance", "ms-python.vscode-pylance",
"rust-lang.rust-analyzer" "rust-lang.rust-analyzer"
], ],
...@@ -42,10 +41,24 @@ ...@@ -42,10 +41,24 @@
"python.defaultInterpreterPath": "/opt/dynamo/venv/bin/python", "python.defaultInterpreterPath": "/opt/dynamo/venv/bin/python",
"python.linting.enabled": true, "python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"rust-analyzer.memoryLimit": 4096, // larger memory limit to reduce latency
"rust-analyzer.checkOnSave.command": "clippy", "rust-analyzer.checkOnSave.command": "clippy",
"rust-analyzer.checkOnSave.enable": true, "rust-analyzer.checkOnSave.enable": true,
"rust-analyzer.cargo.buildScripts.enable": true,
"rust-analyzer.cargo.targetDir": "/home/ubuntu/dynamo/.build/target",
"rust-analyzer.procMacro.enable": true,
"rust-analyzer.completion.autoimport.enable": true,
// Enhanced rust-analyzer configuration
"rust-analyzer.linkedProjects": [
"dynamo/Cargo.toml",
"dynamo/lib/runtime/Cargo.toml",
"dynamo/lib/llm/Cargo.toml",
"dynamo/lib/tokens/Cargo.toml",
"dynamo/lib/bindings/python/Cargo.toml",
"dynamo/launch/dynamo-run/Cargo.toml"
],
"files.trimTrailingWhitespace": true, "files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true "files.insertFinalNewline": true
......
...@@ -58,17 +58,15 @@ ln -sf $HOME/dynamo/.build/target/debug/dynamo-run $HOME/dynamo/deploy/sdk/src/d ...@@ -58,17 +58,15 @@ ln -sf $HOME/dynamo/.build/target/debug/dynamo-run $HOME/dynamo/deploy/sdk/src/d
ln -sf $HOME/dynamo/.build/target/debug/http $HOME/dynamo/deploy/sdk/src/dynamo/sdk/cli/bin/http ln -sf $HOME/dynamo/.build/target/debug/http $HOME/dynamo/deploy/sdk/src/dynamo/sdk/cli/bin/http
ln -sf $HOME/dynamo/.build/target/debug/llmctl $HOME/dynamo/deploy/sdk/src/dynamo/sdk/cli/bin/llmctl ln -sf $HOME/dynamo/.build/target/debug/llmctl $HOME/dynamo/deploy/sdk/src/dynamo/sdk/cli/bin/llmctl
# install the python bindings in editable mode # install the python bindings
cd $HOME/dynamo/lib/bindings/python && retry uv pip install -e . cd $HOME/dynamo/lib/bindings/python && retry maturin develop
# installs overall python packages, grabs binaries from .build/target/debug
cd $HOME/dynamo && retry env DYNAMO_BIN_PATH=$HOME/dynamo/.build/target/debug uv pip install -e . cd $HOME/dynamo && retry env DYNAMO_BIN_PATH=$HOME/dynamo/.build/target/debug uv pip install -e .
export PYTHONPATH=/home/ubuntu/dynamo/components/planner/src:$PYTHONPATH export PYTHONPATH=/home/ubuntu/dynamo/components/planner/src:$PYTHONPATH
# Add to bashrc only if not already present # TODO: Deprecated except vLLM v0
if ! grep -q "source /opt/dynamo/venv/bin/activate" ~/.bashrc; then
echo "source /opt/dynamo/venv/bin/activate" >> ~/.bashrc
fi
if ! grep -q "export VLLM_KV_CAPI_PATH=" ~/.bashrc; then if ! grep -q "export VLLM_KV_CAPI_PATH=" ~/.bashrc; then
echo "export VLLM_KV_CAPI_PATH=$HOME/dynamo/.build/target/debug/libdynamo_llm_capi.so" >> ~/.bashrc echo "export VLLM_KV_CAPI_PATH=$HOME/dynamo/.build/target/debug/libdynamo_llm_capi.so" >> ~/.bashrc
fi fi
......
...@@ -308,7 +308,7 @@ RUN chown $USERNAME:$USERNAME /opt/dynamo/venv ...@@ -308,7 +308,7 @@ RUN chown $USERNAME:$USERNAME /opt/dynamo/venv
COPY --from=base --chown=$USERNAME:$USERNAME /usr/local/bin /usr/local/bin COPY --from=base --chown=$USERNAME:$USERNAME /usr/local/bin /usr/local/bin
# so we can use maturin develop # so we can use maturin develop
RUN uv pip install maturin RUN uv pip install maturin[patchelf]
USER $USERNAME USER $USERNAME
ENV HOME=/home/$USERNAME ENV HOME=/home/$USERNAME
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment