Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 7, 2026

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/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:

# 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.


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits January 7, 2026 18:13
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>
Copilot AI changed the title [WIP] Address feedback on VSCode dev container setup for Python validation Validate Python site-packages symlink in devcontainer build Jan 7, 2026
Copilot AI requested a review from greenc-FNAL January 7, 2026 18:18
@greenc-FNAL greenc-FNAL marked this pull request as ready for review January 7, 2026 18:19
Copilot AI review requested due to automatic review settings January 7, 2026 18:19
Copy link
Contributor

Copilot AI left a 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/python symlink, 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

@greenc-FNAL greenc-FNAL merged commit da7ab69 into feature/vscode-dev-container Jan 7, 2026
6 checks passed
@knoepfel knoepfel deleted the copilot/sub-pr-87-please-work branch January 7, 2026 22:32
greenc-FNAL added a commit that referenced this pull request Jan 7, 2026
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>
greenc-FNAL added a commit that referenced this pull request Jan 8, 2026
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>
knoepfel pushed a commit that referenced this pull request Jan 9, 2026
* 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants