-
Notifications
You must be signed in to change notification settings - Fork 10
Validate Python site-packages symlink in devcontainer build #229
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
Validate Python site-packages symlink in devcontainer build #229
Conversation
Co-authored-by: greenc-FNAL <2372949+greenc-FNAL@users.noreply.github.com>
Co-authored-by: greenc-FNAL <2372949+greenc-FNAL@users.noreply.github.com>
Co-authored-by: greenc-FNAL <2372949+greenc-FNAL@users.noreply.github.com>
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 addresses review feedback from #87 by eliminating the hardcoded Python version path (python3.14/site-packages) in the devcontainer configuration. The solution adds build-time validation to automatically create and maintain a version-agnostic symlink.
Key changes:
- Added a Dockerfile validation script that discovers the Spack-installed Python version, creates/updates a
lib/pythonsymlink, and fails the build if the Python directory is ambiguous or missing - Updated VSCode Python analysis path from versioned directory to stable symlink path
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
.devcontainer/Dockerfile |
Added bash validation script (lines 8-62) that ensures exactly one Python version exists, creates/updates symlink, and validates the result |
.devcontainer/devcontainer.json |
Changed python.analysis.extraPaths from python3.14/site-packages to python/site-packages to reference the stable symlink |
Per [review feedback](#87 (comment)), the devcontainer referenced a hardcoded Python version path (`python3.14/site-packages`) that requires manual updates when the Spack-installed Python version changes. ## Changes - **`.devcontainer/Dockerfile`**: Added validation step that ensures exactly one versioned Python directory exists in the Spack view, creates/updates `/opt/spack-environments/phlex-ci/.spack-env/view/lib/python` symlink to point to it, and fails the build if zero or multiple versioned directories are found - **`.devcontainer/devcontainer.json`**: Changed `python.analysis.extraPaths` from versioned path to symlink path ## Example The validation script runs during image build: ```bash # Finds python3.14/ (or whatever version Spack installed) python_dirs=("$SPACK_VIEW_LIB"/python3.*) # Errors if count != 1 if [ $count -eq 0 ]; then echo "ERROR: No versioned Python site-packages directory found" >&2 exit 1 fi # Creates lib/python -> lib/python3.14 ln -sn "$python_basename" "$python_link" ``` VSCode configuration now references the stable symlink path instead of the versioned directory. --- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: greenc-FNAL <2372949+greenc-FNAL@users.noreply.github.com>
Per [review feedback](#87 (comment)), the devcontainer referenced a hardcoded Python version path (`python3.14/site-packages`) that requires manual updates when the Spack-installed Python version changes. ## Changes - **`.devcontainer/Dockerfile`**: Added validation step that ensures exactly one versioned Python directory exists in the Spack view, creates/updates `/opt/spack-environments/phlex-ci/.spack-env/view/lib/python` symlink to point to it, and fails the build if zero or multiple versioned directories are found - **`.devcontainer/devcontainer.json`**: Changed `python.analysis.extraPaths` from versioned path to symlink path ## Example The validation script runs during image build: ```bash # Finds python3.14/ (or whatever version Spack installed) python_dirs=("$SPACK_VIEW_LIB"/python3.*) # Errors if count != 1 if [ $count -eq 0 ]; then echo "ERROR: No versioned Python site-packages directory found" >&2 exit 1 fi # Creates lib/python -> lib/python3.14 ln -sn "$python_basename" "$python_link" ``` VSCode configuration now references the stable symlink path instead of the versioned directory. --- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: greenc-FNAL <2372949+greenc-FNAL@users.noreply.github.com>
* VSCode dev container setup and workspace config * Improve image creation instructions * Enable Spack modification by user `vscode` within a devcontainer * Ensure `parallelism` `ARG` is available in base and dev targets. * Confirm executable permissions on devcontainer wrapper scripts #228 * Validate Python site-packages symlink in devcontainer build (#229) * Update ci/Dockerfile comment * Add gersemi to dev container --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com> Co-authored-by: greenc-FNAL <2372949+greenc-FNAL@users.noreply.github.com>
Per review feedback, the devcontainer referenced a hardcoded Python version path (
python3.14/site-packages) that requires manual updates when the Spack-installed Python version changes.Changes
.devcontainer/Dockerfile: Added validation step that ensures exactly one versioned Python directory exists in the Spack view, creates/updates/opt/spack-environments/phlex-ci/.spack-env/view/lib/pythonsymlink to point to it, and fails the build if zero or multiple versioned directories are found.devcontainer/devcontainer.json: Changedpython.analysis.extraPathsfrom versioned path to symlink pathExample
The validation script runs during image build:
VSCode configuration now references the stable symlink path instead of the versioned directory.
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.