-
Notifications
You must be signed in to change notification settings - Fork 27
Improve one-shot dev environment setup #665
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
base: master
Are you sure you want to change the base?
Improve one-shot dev environment setup #665
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the development environment setup scripts by adding robust error handling, preventing duplicate configurations, and improving package installation reliability. The changes make the scripts safer for first-time setup on new machines while preventing issues from multiple executions.
Key changes:
- Added strict error handling with
set -euo pipefailto both setup scripts - Implemented checks to prevent duplicate Conda environment creation and shell configuration entries
- Added explicit Conda environment activation with error handling in the main installation script
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| dev_env_setup_scripts/install_all.sh | Added pipefail to error handling and explicit Conda environment activation with validation |
| dev_env_setup_scripts/00-setup-conda.sh | Refactored to use variables, added duplicate prevention checks, and improved package installation |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
| conda create --name reallmforge python=3.10 | ||
| echo 'conda activate reallmforge' >> ~/.zshrc | ||
| echo 'conda activate reallmforge' >> ~/.bashrc | ||
| if ! conda info --envs | awk '{print $1}' | grep -qx "$ENV_NAME"; then |
Copilot
AI
Oct 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The awk command extracts the first column, but conda info --envs output includes comment lines (starting with #) and a header line. These will be included in the grep search, potentially causing false matches. Use grep -v '^#' to filter out comment lines before the awk command: if ! conda info --envs | grep -v '^#' | awk '{print $1}' | grep -qx \"$ENV_NAME\"; then
| if ! conda info --envs | awk '{print $1}' | grep -qx "$ENV_NAME"; then | |
| if ! conda info --envs | grep -v '^#' | awk '{print $1}' | grep -qx "$ENV_NAME"; then |
| log "Activating conda environment..." | ||
| CONDA_SH="$HOME/miniconda3/etc/profile.d/conda.sh" |
Copilot
AI
Oct 20, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The hardcoded path $HOME/miniconda3 duplicates the installation directory defined in 00-setup-conda.sh as MINICONDA_DIR. If the installation path changes in one script, it must be updated here as well. Consider extracting this to a shared configuration variable or sourcing it from the previous script.
| log "Activating conda environment..." | |
| CONDA_SH="$HOME/miniconda3/etc/profile.d/conda.sh" | |
| # Source MINICONDA_DIR from 00-setup-conda.sh (assumes it exports MINICONDA_DIR) | |
| source ./00-setup-conda.sh | |
| CONDA_SH="$MINICONDA_DIR/etc/profile.d/conda.sh" |
This pull request improves the robustness and reliability of the development environment setup scripts. The main changes include enhanced error handling, safer environment variable usage, and improved checks to prevent duplicate environment creation and shell configuration entries.
Script robustness and error handling:
#!/bin/bashandset -euo pipefailto00-setup-conda.shandinstall_all.shto ensure scripts exit on errors and undefined variables, making them safer to run on new machines. [1] [2]Conda environment setup improvements:
00-setup-conda.shto use variables for paths and environment names, check for existing Conda environments before creating, and avoid duplicateconda activatelines in.zshrcand.bashrc.install_all.shto explicitly source the Conda initialization script and activate thereallmforgeenvironment, with error handling if the script is missing.Package installation:
00-setup-conda.shby runningsudo apt updatebefore installing packages and adding the-yflag for non-interactive installs.