Skip to content

New command: spack isolate#52500

Draft
JohnGouwar wants to merge 3 commits into
spack:developfrom
JohnGouwar:isolate
Draft

New command: spack isolate#52500
JohnGouwar wants to merge 3 commits into
spack:developfrom
JohnGouwar:isolate

Conversation

@JohnGouwar
Copy link
Copy Markdown
Contributor

spack isolate aims to keep a Spack instance from writing to ~/.spack. This will become easier (and more complete) after shared Spack (#52443), but this PR serves as a stopgap before that feature is merged.

spack isolate ISO_PATH does 4 things:

  1. Changes the path of the user scope in spack/etc/spack/include.yaml to ISO_PATH and removes the SPACK_USER_CONFIG_PATH environment variable for configuring it.
  2. Creates an isolate scope below the site scope that moves the bootstrap:root, config:misc_cache, config:test_stage, and config:build_stage to subdirectories in ISO_PATH.
  3. Moves the existing repos with implicit destinations to a directory under ISO_PATH.
  4. Calling spack isolate --bootstrap ISO_PATH will also force a download of the package repo to its new location, a bootstrap build of clingo to its new location, and populate various caches (e.g. provider_cache).

spack isolate ISO_PATH does not:

  1. Move existing config out of ~/.spack to the ISO_PATH or change the destination of explicitly set repos.
  2. Change the default location where new git package repos are downloaded. This is a core limitation of Spack that this destination must be configured for each repo, and defaults to the environment variable SPACK_USER_CACHE_PATH. There is no config option that can be overridden.
  3. Write package_repository.lock to ISO_PATH/repos for the same reason as 2. Both of these will be fixed by shared Spack.
  4. Support multiple separate isolations. There is a single isolate scope that references the absolute path of the modified user scope. Users can use environments on top of isolate to get more separate isolation.

Currently, this implementation is bare bones, since it will be rewritten for shared spack. For example, it does not currently preserve comments in include.yaml.

Unit testing is in progress.

Signed-off-by: John Gouwar <jgouwar@gmail.com>
@JohnGouwar
Copy link
Copy Markdown
Contributor Author

@becker33 @tgamblin @scheibelp FYI

@JohnGouwar
Copy link
Copy Markdown
Contributor Author

@spackbot fix style

@spackbot-app
Copy link
Copy Markdown

spackbot-app Bot commented Jun 6, 2026

Let me see if I can fix that for you!

@spackbot-app
Copy link
Copy Markdown

spackbot-app Bot commented Jun 6, 2026

I was able to run spack style --fix for you!

spack style --fix
==> Running style checks on spack
  selected: import, ruff-format, ruff-check, mypy
==> Running import checks
lib/spack/spack/cmd/isolate.py: redundant import: spack.schema.repos
  import found errors
==> Running ruff-format checks
  ruff-format checks were clean
==> Running ruff-check checks
  ruff-check checks were clean
==> Running mypy checks
Success: no issues found in 642 source files
  mypy checks were clean
Keep in mind that I cannot fix your flake8 or mypy errors, so if you have any you'll need to fix them and update the pull request. If I was able to push to your branch, if you make further changes you will need to pull from your updated branch before pushing again.

I've updated the branch with style fixes.

Signed-off-by: John Gouwar <jgouwar@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant