Unverified Commit 344c21dc authored by Keiven C's avatar Keiven C Committed by GitHub
Browse files

feat: enhance devcontainer configuration and documentation (#2255)


Co-authored-by: default avatarKeiven Chang <keivenchang@users.noreply.github.com>
parent f73d35d5
...@@ -17,16 +17,34 @@ limitations under the License. ...@@ -17,16 +17,34 @@ 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: Dev Containers (aka `devcontainers`) is an evolving feature and we are not testing in CI. Please submit any problem/feedback using the issues on GitHub.
## Prerequisites ## Prerequisites
Before you begin, ensure you have the following installed:
- [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
- Visual Studio Code with the [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) installed - IDEs: Use either the VS Code or Cursor. Both have Dev Containers extensions
- Appropriate NVIDIA drivers (compatible with CUDA 12.8) - Appropriate NVIDIA drivers (compatible with CUDA 12.8+)
- If you want to run the examples, set your Hugging Face token env var `HF_TOKEN` in your local startup (.bashrc, .zshrc or .profile file) - For models that require authentication, set your Hugging Face token env var `HF_TOKEN` in your local startup (.bashrc, .zshrc or .profile file). Many public models do not require this token.
### Required Files and Directories
The following files and directories are required on your host system for the devcontainer to work properly:
- **`.gitconfig`**: Must exist in your home directory (`~/.gitconfig`). This file is mounted into the container for Git configuration.
- **`~/.cache/huggingface`**: This directory is mounted into the container for Hugging Face model caching. If it doesn't exist, it will be created automatically.
## Quick Start If these files/directories are missing, you may encounter Docker mount errors when starting the devcontainer.
1. Build the container image
## Quick Start Guide
Follow these steps to get your NVIDIA Dynamo development environment up and running:
### Step 1: Build the Development Container Image
Build `dynamo:latest-vllm-local-dev` from scratch from the source:
- Note that currently, `local-dev` are only implemented for `--framework VLLM` and `--framework SGLANG`, for now.
```bash ```bash
./container/build.sh --target local-dev ./container/build.sh --target local-dev
...@@ -34,35 +52,66 @@ limitations under the License. ...@@ -34,35 +52,66 @@ limitations under the License.
The container will be built and give certain file permissions to your local uid and gid. The container will be built and give certain file permissions to your local uid and gid.
> Note: Currently local-dev is only implemented for --framework VLLM ### Step 2: Install Dev Containers Extension
2. Open Dynamo folder in VS Code **For VS Code:**
- Press Ctrl + Shift + P - Install [Dev Containers extension](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers) from Microsoft marketplace
- Select "Dev Containers: Open Folder in Container"
If you want to mount your hugging face cache, go to `.devcontainer` and uncomment in the mounts section: **For Cursor:**
- Press `Cmd+Shift+X` (Mac) or `Ctrl+Shift+X` (Linux/Windows) to open Extensions
- Search for "Dev Containers" and install the one by **Anysphere** (Do not download the version from Microsoft as it is not compatible with Cursor)
```json ### Step 3: Launch the Development Environment
// "source=${localEnv:HF_HOME},target=/home/ubuntu/.cache/huggingface,type=bind", // Uncomment to enable HF Cache Mount. Make sure to set HF_HOME env var in you .bashrc
```
Make sure HF_HOME is sourced in your .bashrc or .zshenv and your vscode default terminal is set properly.
3. Wait for Initialization 1. Open `dynamo` folder in your IDE
- The container will mount your local code 2. Press `Cmd+Shift+P` (Mac) or `Ctrl+Shift+P` (Linux/Windows)
- `post-create.sh` will build the project and configure the environment 3. Select "Dev Containers: Open Folder in Container", select your `dynamo` folder and open.
### Step 4: Optional - Custom Hugging Face Cache
If you want to mount a different Hugging Face cache directory than the default ~/.cache/huggingface, you can do something like below:
1. Go to `.devcontainer` folder
2. Add this line in the mounts section:
```json
"source=${localEnv:HF_HOME},target=/home/ubuntu/.cache/huggingface,type=bind",
// Mount from your custom HF_HOME to the container.
```
3. Make sure HF_HOME is sourced in your .bashrc or .zshenv and your IDE default terminal is set properly
### Step 5: Wait for Initialization
The container will automatically:
- Mount your local code to `/home/ubuntu/dynamo`
- Run `post-create.sh` to 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 ## Development Flow
### Building Rust Code
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. 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 ```bash
cd /home/ubuntu/dynamo && cargo build --locked --profile dev cd /home/ubuntu/dynamo && cargo build --locked --profile dev
``` ```
Verify that builds are in the pre-defined `dynamo/.build/target` and not `dynamo/workspace`:
```bash
$ cargo metadata --format-version=1 | jq -r '.target_directory'
/home/ubuntu/dynamo/.build/target <-- this is the target path
```
If cargo is not installed and configured property, you will see an error, such as the following:
```
error: could not find `Cargo.toml` in $HOME or any parent directory
```
Before pushing code to GitHub, remember to run `cargo fmt` and `cargo clippy` Before pushing code to GitHub, remember to run `cargo fmt` and `cargo clippy`
### Updating Python Bindings
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. 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 ```bash
...@@ -73,21 +122,18 @@ cd /home/ubuntu/dynamo/lib/bindings/python && maturin develop ...@@ -73,21 +122,18 @@ cd /home/ubuntu/dynamo/lib/bindings/python && maturin develop
Development Environment: Development Environment:
- Rust and Python toolchains - Rust and Python toolchains
- GPU acceleration - GPU acceleration
- VS Code extensions for Rust and Python - VS Code or Cursor extensions for Rust and Python
- Persistent build cache in `.build/` directory enables fast incremental builds (only changed files are recompiled) - Persistent build cache in `.build/` directory enables fast incremental builds (only changed files are recompiled) via `cargo build --locked --profile dev`
- Edits to files are propagated to local repo due to the volume mount
`cargo build --locked --profile dev` to re-build
- Edits to files are propogated to local repo due to the volume mount
- SSH and GPG agent passthrough orchestrated by devcontainer - SSH and GPG agent passthrough orchestrated by devcontainer
File Structure: File Structure:
- Local dynamo repo mounts to `/home/ubuntu/dynamo` - Local dynamo repo mounts to `/home/ubuntu/dynamo`
- Python venv in `/opt/dynamo/venv` - Python venv in `/opt/dynamo/venv`
- Build artifacts in `dynamo/.build/target` - Build artifacts in `dynamo/.build/target`
- HuggingFace cache preserved between sessions (Mounting local path `HF_HOME` at `/home/ubuntu/.cache/huggingface`) - Hugging Face cache preserved between sessions (either mounting your host .cache to the container, or your `HF_HOME` to `/home/ubuntu/.cache/huggingface`)
- Bash memory preserved between sessions at `/home/ubuntu/.commandhistory` using docker volume `dynamo-bashhistory` - Bash memory preserved between sessions at `/home/ubuntu/.commandhistory` using docker volume `dynamo-bashhistory`
- Precommit peeserved between sessions at `/home/ubuntu/.cache/precommit` using docker volume `dynamo-precommit-cache` - Precommit preserved between sessions at `/home/ubuntu/.cache/precommit` using docker volume `dynamo-precommit-cache`
## Customization ## Customization
Edit `.devcontainer/devcontainer.json` to modify: Edit `.devcontainer/devcontainer.json` to modify:
...@@ -124,20 +170,24 @@ git config --local gpg.program gpg1 ...@@ -124,20 +170,24 @@ git config --local gpg.program gpg1
> Warning: Switching local gpg to gpg1 can have ramifications when you are not in the container any longer. > Warning: Switching local gpg to gpg1 can have ramifications when you are not in the container any longer.
### SSH Keys for Git Operations ### Custom devcontainer.json Configuration
SSH keys need to be loaded in your SSH agent to work properly in the container. Can check out [VSCode docs](https://code.visualstudio.com/remote/advancedcontainers/sharing-git-credentials) for more details. You can create a custom devcontainer configuration by copying the main configuration to another directory inside the `.devcontainer` directory. Below is an example where the custom name is `jensen_dev`, but feel free to name the directory whatever you want:
```bash ```bash
# In devcontainer, Check if your keys are loaded in the agent # Copy the main devcontainer configuration and then edit the new json file
ssh-add -l mkdir -p .devcontainer/jensen_dev
cp .devcontainer/devcontainer.json .devcontainer/jensen_dev/devcontainer.json
# On local host, if your key isn't listed, add it
eval "$(ssh-agent)" # Start the agent if not running
ssh-add ~/.ssh/id_rsa
``` ```
Verify access by running `ssh -T git@github.com` in both host and container. Common customizations include additional mounts, environment variables, VS Code extensions, and build arguments. When you open a new Dev Container, you can pick from any of the `.devcontainer/*/devcontainer.json` files available.
### SSH Keys for Git Operations
If you have ssh-agent running on the host, then `git push` should just work. If not, you may need to set up ssh-agent, or have SSH keys set up inside the container (more hassle).
## Troubleshooting
### Environment Variables Not Set in Container? ### Environment Variables Not Set in Container?
...@@ -148,5 +198,118 @@ If your environment variables are not being set in your devcontainer (e.g., `ech ...@@ -148,5 +198,118 @@ If your environment variables are not being set in your devcontainer (e.g., `ech
Note: If both `~/.bash_profile` and `~/.profile` exist, bash will only read `~/.bash_profile` for login shells. Therefore, if you choose option 2, you must remove or rename `~/.bash_profile` to ensure `~/.profile` (and consequently `~/.bashrc`) is sourced. Note: If both `~/.bash_profile` and `~/.profile` exist, bash will only read `~/.bash_profile` for login shells. Therefore, if you choose option 2, you must remove or rename `~/.bash_profile` to ensure `~/.profile` (and consequently `~/.bashrc`) is sourced.
See VS Code Dev Containers [documentation](https://code.visualstudio.com/docs/devcontainers/containers) for more details. See VS Code Dev Containers [documentation](https://code.visualstudio.com/docs/devcontainers/containers) for more details.
### Build Issues
If you encounter build errors or strange compilation issues, try running `cargo clean` to clear the build cache and rebuild from scratch.
If `cargo clean` doesn't resolve the issue, it is possible that some of the files were created by root (using the `run.sh` script). You can manually remove the build target by going to your host (outside the container), and remove the target:
```bash
sudo rm -rf <your dynamo path on the host machine>/.build/target
```
### Volume Corruption Issues
If you encounter strange errors (like `postCreateCommand` failing with exit code 1), your Docker volumes may be corrupted.
**Solution: Wipe Docker Volumes**
```bash
# Remove Dynamo volumes that are specified in devcontainer.json (may be corrupted)
docker volume rm dynamo-bashhistory dynamo-precommit-cache
# Or remove all volumes (use with caution).
docker rm -f <your running container(s)>
docker volume prune -f
```
**Note:** This resets bash history and pre-commit cache.
**Volume Mounts in devcontainer.json:**
- `dynamo-bashhistory``/home/ubuntu/.commandhistory` (bash history)
- `dynamo-precommit-cache``/home/ubuntu/.cache/pre-commit` (pre-commit cache)
### Permission Issues
If you start experiencing permission problems (e.g., "Permission denied" errors), you may need to fix file ownership outside the container. This commonly happens when `container/run.sh` runs as root, creating files with root ownership:
```bash
# Replace <user> with your actual username
cd <your dynamo directory at your host machine (not docker)>
sudo chown -R <user>:<user> .
```
This fixes ownership when files are created with different user IDs between the host and container.
### Container Starts But Immediately Stops
If you see errors like "container is not running" or "An error occurred setting up the container" in the devcontainer logs, the container is starting but then crashing immediately.
**Common Causes and Solutions:**
1. **Missing base image:**
```bash
# Check if the required image exists
docker images | grep dynamo
# If missing, build the dev image first
./container/build.sh --target local-dev
```
2. **Container startup failure:**
```bash
# Check container logs for the specific error
docker logs <container-id>
# Or check all recent containers
docker ps -a --filter "label=devcontainer.local_folder=$(pwd)"
```
3. **Resource issues:**
```bash
# Check available system resources
free -h
df -h
# Restart Docker daemon if needed
sudo systemctl restart docker
```
4. **Clean slate approach:**
```bash
# Remove all related containers and images
docker ps -a --filter "label=devcontainer.local_folder=$(pwd)" -q | xargs docker rm -f
docker images | grep "^vsc-" | awk '{print $3}' | xargs docker rmi
```
Then rebuild without cache. In VS Code or Cursor command:
*Dev Containers: Rebuild Without Cache and Reopen in Container*
### devcontainer.json Changes Not Being Picked Up
If you've made changes to `devcontainer.json`, `post-create.sh`, or other devcontainer-related files but they're not being applied when you rebuild the container, the changes may be cached.
**Solution: Force Devcontainer Rebuild**
1. **Rebuild Container (Recommended):**
In VS Code or Cursor Command Palette (Ctrl+Shift+P):
*Dev Containers: Rebuild Container*
2. **If that doesn't work, rebuild without cache:**
In VS Code or Cursor Command Palette (Ctrl+Shift+P):
*Dev Containers: Rebuild Without Cache and Reopen Container*
3. **For persistent issues, manually remove the devcontainer image:**
```bash
# List devcontainer images
docker images | grep devcontainer
# And remove all VS Code devcontainer images (more thorough)
docker images | grep "^vsc-" | awk '{print $3}' | xargs docker rmi
# Then rebuild in VS Code
Dev Containers: Rebuild Container
```
**Note:** The "Rebuild Container Without Cache and Reopen Container" option is the most thorough and will ensure all your changes are applied, but it takes longer as it rebuilds everything from scratch.
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
"See the License for the specific language governing permissions and", "See the License for the specific language governing permissions and",
"limitations under the License." "limitations under the License."
], ],
"name": "NVIDIA Dynamo Development", "name": "NVIDIA Dynamo Dev Container Development",
"remoteUser": "ubuntu", // Matches our container user "remoteUser": "ubuntu", // Matches our container user
"updateRemoteUserUID": true, // Updates the UID of the remote user to match the host user, avoids permission errors "updateRemoteUserUID": true, // Updates the UID of the remote user to match the host user, avoids permission errors
"image": "dynamo:latest-vllm-local-dev", // Use the latest VLLM local dev image "image": "dynamo:latest-vllm-local-dev", // Use the latest VLLM local dev image
...@@ -36,6 +36,8 @@ ...@@ -36,6 +36,8 @@
"rust-lang.rust-analyzer" "rust-lang.rust-analyzer"
], ],
"settings": { "settings": {
// Disable automatic copying of .gitconfig to avoid errors
"dev.containers.copyGitConfig": false,
"terminal.integrated.defaultProfile.linux": "bash", "terminal.integrated.defaultProfile.linux": "bash",
"terminal.integrated.cwd": "/home/ubuntu/dynamo", "terminal.integrated.cwd": "/home/ubuntu/dynamo",
...@@ -52,36 +54,40 @@ ...@@ -52,36 +54,40 @@
// Enhanced rust-analyzer configuration // Enhanced rust-analyzer configuration
"rust-analyzer.linkedProjects": [ "rust-analyzer.linkedProjects": [
"dynamo/Cargo.toml", "Cargo.toml",
"dynamo/lib/runtime/Cargo.toml", "lib/runtime/Cargo.toml",
"dynamo/lib/llm/Cargo.toml", "lib/llm/Cargo.toml",
"dynamo/lib/tokens/Cargo.toml", "lib/tokens/Cargo.toml",
"dynamo/lib/bindings/python/Cargo.toml", "lib/bindings/python/Cargo.toml",
"dynamo/launch/dynamo-run/Cargo.toml" "launch/dynamo-run/Cargo.toml"
], ],
"files.trimTrailingWhitespace": true, "files.trimTrailingWhitespace": true,
"files.insertFinalNewline": true "files.insertFinalNewline": true
} }
} }
}, },
"workspaceFolder": "/home/ubuntu", "workspaceFolder": "/home/ubuntu/dynamo",
"workspaceMount": "source=${localWorkspaceFolder},target=/home/ubuntu/dynamo,type=bind,consistency=cached", "workspaceMount": "source=${localWorkspaceFolder},target=/home/ubuntu/dynamo,type=bind,consistency=cached",
"userEnvProbe": "interactiveShell", "userEnvProbe": "interactiveShell",
"postCreateCommand": "/bin/bash /home/ubuntu/dynamo/.devcontainer/post-create.sh", // Runs cargo build and pip installs packages "postCreateCommand": "/bin/bash /home/ubuntu/dynamo/.devcontainer/post-create.sh", // Runs cargo build and pip installs packages
"containerEnv": { "containerEnv": {
"GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}", "DYNAMO_HOME": "/home/ubuntu/dynamo",
"HF_TOKEN": "${localEnv:HF_TOKEN}",
"CARGO_HOME": "/home/ubuntu/dynamo/.build/.cargo", "CARGO_HOME": "/home/ubuntu/dynamo/.build/.cargo",
"RUSTUP_HOME": "/home/ubuntu/dynamo/.build/.rustup" "RUSTUP_HOME": "/home/ubuntu/dynamo/.build/.rustup",
"CARGO_TARGET_DIR": "/home/ubuntu/dynamo/.build/target",
},
"remoteEnv": {
// These are optional, but are convenient to have, especially the SSH_AUTH_SOCK.
"SSH_AUTH_SOCK": "${env:SSH_AUTH_SOCK}",
"GITHUB_TOKEN": "${localEnv:GITHUB_TOKEN}",
"HF_TOKEN": "${localEnv:HF_TOKEN}"
}, },
"mounts": [ "mounts": [
// These are for convenience, so that the history and pre-commit cache are persisted between sessions
"source=dynamo-bashhistory,target=/home/ubuntu/.commandhistory,type=volume",
"source=dynamo-precommit-cache,target=/home/ubuntu/.cache/pre-commit,type=volume",
// Default mounts // Default mounts
"source=/tmp/,target=/tmp/,type=bind", "source=/tmp/,target=/tmp/,type=bind",
"source=dynamo-bashhistory,target=/home/ubuntu/.commandhistory,type=volume", // For bash history "source=${localEnv:HOME}/.cache/huggingface,target=/home/ubuntu/.cache/huggingface,type=bind"
"source=dynamo-precommit-cache,target=/home/ubuntu/.cache/pre-commit,type=volume" // For pre-commit cache
// Uncomment for additional functionality
// "source=${localEnv:HF_HOME},target=/home/ubuntu/.cache/huggingface,type=bind", // Uncomment to enable HF Cache Mount. Make sure to set HF_HOME env var in you .bashrc
] ]
} }
#!/bin/bash #!/bin/bash
# SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-FileCopyrightText: Copyright (c) 2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License"); set -eu
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at # Ensure we're not running as root
# if [ "$(id -u)" -eq 0 ]; then
# http://www.apache.org/licenses/LICENSE-2.0 echo "❌ ERROR: This script should not be run as root!"
# echo "The script should run as the 'ubuntu' user, not root."
# Unless required by applicable law or agreed to in writing, software echo "Current user: $(whoami) (UID: $(id -u))"
# distributed under the License is distributed on an "AS IS" BASIS, exit 1
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. fi
# See the License for the specific language governing permissions and
# limitations under the License. # Verify we're running as the expected user
if [ "$(whoami)" != "ubuntu" ]; then
echo "⚠️ WARNING: Expected to run as 'ubuntu' user, but running as '$(whoami)'"
echo "This might cause permission issues."
fi
echo "Running post-create script as user: $(whoami) (UID: $(id -u))"
trap 'echo "❌ ERROR: Command failed at line $LINENO: $BASH_COMMAND"; echo "⚠️ This was unexpected and setup was not completed. Can try to resolve yourself and then manually run the rest of the commands in this file or file a bug."' ERR trap 'echo "❌ ERROR: Command failed at line $LINENO: $BASH_COMMAND"; echo "⚠️ This was unexpected and setup was not completed. Can try to resolve yourself and then manually run the rest of the commands in this file or file a bug."' ERR
...@@ -35,36 +40,84 @@ retry() { ...@@ -35,36 +40,84 @@ retry() {
return 0 return 0
} }
set -xe set -x
# Changing permission to match local user since volume mounts default to root ownership # Changing permission to match local user since volume mounts default to root ownership
sudo chown -R ubuntu:ubuntu ~/.cache/pre-commit # Note: sudo is used here because the volume mount may have root ownership
mkdir -p $HOME/.cache
sudo chown -R ubuntu:ubuntu $HOME/.cache $HOME/dynamo
# Pre-commit hooks # Pre-commit hooks
cd $HOME/dynamo && pre-commit install && retry pre-commit install-hooks cd $HOME/dynamo && pre-commit install && retry pre-commit install-hooks
pre-commit run --all-files || true # don't fail the build if pre-commit hooks fail pre-commit run --all-files || true # don't fail the build if pre-commit hooks fail
# Set build directory # Set build directory
mkdir -p $HOME/dynamo/.build/target export CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-$HOME/dynamo/.build/target}
export CARGO_TARGET_DIR=$HOME/dynamo/.build/target mkdir -p $CARGO_TARGET_DIR
# build project, it will be saved at $HOME/dynamo/.build/target uv pip uninstall --yes ai-dynamo ai-dynamo-runtime 2>/dev/null || true
# Build project, with `dev` profile it will be saved at $CARGO_TARGET_DIR/debug
cargo build --locked --profile dev --features mistralrs cargo build --locked --profile dev --features mistralrs
cargo doc --no-deps
# install the python bindings # install the python bindings
cd $HOME/dynamo/lib/bindings/python && retry maturin develop (cd $HOME/dynamo/lib/bindings/python && retry maturin develop)
# installs overall python packages, grabs binaries from .build/target/debug # 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=$CARGO_TARGET_DIR/debug uv pip install -e .
export PYTHONPATH=/home/ubuntu/dynamo/components/planner/src:$PYTHONPATH
# TODO: Deprecated except vLLM v0 # Extract the PYTHONPATH line from README.md
if ! grep -q "export VLLM_KV_CAPI_PATH=" ~/.bashrc; then PYTHONPATH_LINE=$(grep "^export PYTHONPATH=" $DYNAMO_HOME/README.md | head -n1)
echo "export VLLM_KV_CAPI_PATH=$HOME/dynamo/.build/target/debug/libdynamo_llm_capi.so" >> ~/.bashrc if [ -n "$PYTHONPATH_LINE" ]; then
# Remove the ${PYTHONPATH}: prefix if it exists, then replace $(pwd) with the actual path
MODIFIED_LINE=$(echo "$PYTHONPATH_LINE" | sed 's/\${PYTHONPATH}://g' | sed "s|\$(pwd)|$DYNAMO_HOME|g")
eval "$MODIFIED_LINE"
# Also add to .bashrc for persistence (with expanded path)
if ! grep -q "export PYTHONPATH=" ~/.bashrc; then
# MODIFIED_LINE already has $DYNAMO_HOME expanded to /home/ubuntu/dynamo
echo "$MODIFIED_LINE" >> ~/.bashrc
fi
else
# Back-up version if README.md changed. This is the version from 2025-08-19
export PYTHONPATH=$DYNAMO_HOME/components/frontend/src:$DYNAMO_HOME/components/planner/src:$DYNAMO_HOME/components/backends/vllm/src:$DYNAMO_HOME/components/backends/sglang/src:$DYNAMO_HOME/components/backends/trtllm/src:$DYNAMO_HOME/components/backends/llama_cpp/src:$DYNAMO_HOME/components/backends/mocker/src
fi fi
if ! grep -q "export GPG_TTY=" ~/.bashrc; then if ! grep -q "export GPG_TTY=" ~/.bashrc; then
echo "export GPG_TTY=$(tty)" >> ~/.bashrc echo "export GPG_TTY=$(tty)" >> ~/.bashrc
fi fi
# Unset empty tokens/variables to avoid issues with authentication and SSH
if ! grep -q "# Unset empty tokens" ~/.bashrc; then
echo -e "\n# Unset empty tokens and environment variables" >> ~/.bashrc
echo '[ -z "$HF_TOKEN" ] && unset HF_TOKEN' >> ~/.bashrc
echo '[ -z "$GITHUB_TOKEN" ] && unset GITHUB_TOKEN' >> ~/.bashrc
echo '[ -z "$SSH_AUTH_SOCK" ] && unset SSH_AUTH_SOCK' >> ~/.bashrc
fi
$HOME/dynamo/deploy/dynamo_check.py --import-check-only
{ set +x; } 2>/dev/null
# Check SSH agent forwarding status
echo "🔍 Checking SSH agent forwarding status..."
if [ -n "$SSH_AUTH_SOCK" ]; then
if ssh-add -l > /dev/null 2>&1; then
echo "SSH agent forwarding is working - found $(ssh-add -l | wc -l) key(s)"
else
echo "⚠️ SSH_AUTH_SOCK is set but ssh-add failed - agent may not be accessible"
fi
else
echo "⚠️ SSH agent forwarding not configured - SSH_AUTH_SOCK is not set"
fi
cat <<EOF
✅ SUCCESS: Built cargo project, installed Python bindings, configured pre-commit hooks
Example commands:
cargo build --locked --profile dev # Build Rust project in $CARGO_TARGET_DIR
cd lib/bindings/python && maturin develop --uv # Update Python bindings (if you changed them)
cargo fmt && cargo clippy # Format and lint code before committing
cargo doc --no-deps # Generate documentation
uv pip install -e . # Install various Python packages Dynamo depends on
EOF
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