Skip to content

New subcommand spack config scopes [-hips]#41455

Merged
tldahlgren merged 22 commits intospack:developfrom
greenc-FNAL:feature/config-list-scopes
May 28, 2025
Merged

New subcommand spack config scopes [-hips]#41455
tldahlgren merged 22 commits intospack:developfrom
greenc-FNAL:feature/config-list-scopes

Conversation

@greenc-FNAL
Copy link
Copy Markdown
Member

@greenc-FNAL greenc-FNAL commented Dec 6, 2023

List the scopes available in the current environment in descending priority order.

  • With -p|--path-scopes, list only writable, file-based scopes (ignoring command_line and _builtin).
  • With -i|--included, list only included scopes (specified in include.yaml or an environment include: clause).
  • With -s|--show-paths, annotate scopes with their directory or file (with non-option argument section) locations when appropriate.
  • Automatically takes account of SPACK_DISABLE_LOCAL_CONFIG=true

Useful for understanding the best scope in which to put a particular specific configuration item, or for debugging "missing" config.

Examples

  • MacOS:

    $ spack arch
    darwin-sequoia-m1
    $ spack config scopes
    command_line user site system defaults defaults:darwin defaults:base _builtin
  • Linux:

    $ spack arch
    linux-almalinux9-cascadelake
    $ spack config scopes
    command_line user site system defaults defaults:linux defaults:base _builtin
    $ SPACK_DISABLE_LOCAL_CONFIG=1 spack config scopes
    command_line site defaults defaults:linux defaults:base _builtin
    $ SPACK_DISABLE_LOCAL_CONFIG=1 spack config --scope=site scopes --path-scopes
    site defaults defaults:linux defaults:base
    $ SPACK_DISABLE_LOCAL_CONFIG=1 spack config --scope=site scopes --included
    defaults:linux defaults:base
    $ SPACK_DISABLE_LOCAL_CONFIG=1 spack config --scope=site scopes --included --show-paths
    defaults:linux (/home/greenc/work/cet-is/sources/Spack/spack/run/etc/spack/defaults/linux/) defaults:base (/home/greenc/work/cet-is/sources/Spack/spack/run/etc/spack/defaults/base/)
    $ SPACK_DISABLE_LOCAL_CONFIG=1 spack config --scope=site scopes modules
    command_line site (/home/greenc/work/cet-is/sources/Spack/spack/run/etc/spack/) defaults (/home/greenc/work/cet-is/sources/Spack/spack/run/etc/spack/defaults/modules.yaml) defaults:linux (/home/greenc/work/cetis/sources/Spack/spack/run/etc/spack/defaults/linux/modules.yaml) defaults:base (/home/greenc/work/cet-is/sources/Spack/spack/run/etc/spack/defaults/base/) builtin

@spackbot-app spackbot-app bot added commands core PR affects Spack core functionality tests General test capability(ies) shell-support labels Dec 6, 2023
@greenc-FNAL greenc-FNAL changed the title New command list-scopes [--file] [--non-platform] New command list-scopes [--file|--non-platform] Dec 7, 2023
@greenc-FNAL greenc-FNAL force-pushed the feature/config-list-scopes branch from 5b5404c to 579abf3 Compare December 7, 2023 22:37
@greenc-FNAL greenc-FNAL force-pushed the feature/config-list-scopes branch from 8878c18 to 5cadea7 Compare March 26, 2024 20:07
@greenc-FNAL greenc-FNAL force-pushed the feature/config-list-scopes branch from 5cadea7 to aea4597 Compare March 24, 2025 20:00
@greenc-FNAL
Copy link
Copy Markdown
Member Author

@tldahlgren I have (I believe) brought this PR up to date in the light of #48784. I'd be grateful if you could help me get this merged, please.

greenc-FNAL added a commit to FNALssi/spack that referenced this pull request Mar 24, 2025
greenc-FNAL added a commit to FNALssi/spack that referenced this pull request Mar 24, 2025
Merge from upstream, replacing arch config scopes with spack#48784 and updating `spack config list-scopes` to match spack#41455.
Copy link
Copy Markdown
Contributor

@tldahlgren tldahlgren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. I have a couple of questions. One is about the mutual exclusion of the options. The other is have you confirmed the outputs in the description are up-to-date?

@tldahlgren tldahlgren self-assigned this Mar 24, 2025
@tldahlgren tldahlgren changed the title New command list-scopes [--file|--non-platform] New subcommand list-scopes [--file|--non-platform] Mar 24, 2025
@greenc-FNAL
Copy link
Copy Markdown
Member Author

LGTM. I have a couple of questions. One is about the mutual exclusion of the options. The other is have you confirmed the outputs in the description are up-to-date?

Looking into removing mutual exclusion, and I have updated the description.

@greenc-FNAL greenc-FNAL force-pushed the feature/config-list-scopes branch from ec20835 to 2fbcb66 Compare March 26, 2025 14:22
@greenc-FNAL
Copy link
Copy Markdown
Member Author

@tldahlgren I think I've addressed your comments, but if you have any tips on how to test either the inclusion/exclusion of platform scopes, or --included, I'd appreciate it.

@greenc-FNAL greenc-FNAL force-pushed the feature/config-list-scopes branch from 2fbcb66 to 2195805 Compare March 26, 2025 14:48
@greenc-FNAL greenc-FNAL force-pushed the feature/config-list-scopes branch 2 times, most recently from 56af9d9 to 2a1bfda Compare May 21, 2025 20:22
@greenc-FNAL
Copy link
Copy Markdown
Member Author

This will need to be adjusted when platform scopes go away with #50603.

@greenc-FNAL
Copy link
Copy Markdown
Member Author

Also @tldahlgren @tgamblin Any chance this can be in 1.0? I think this would complement #50603 nicely.

greenc-FNAL added a commit to greenc-FNAL/spack that referenced this pull request May 22, 2025
@greenc-FNAL greenc-FNAL force-pushed the feature/config-list-scopes branch from 5f0cf46 to 51d744a Compare May 28, 2025 15:43
@greenc-FNAL greenc-FNAL force-pushed the feature/config-list-scopes branch from 740b1ed to 8237da1 Compare May 28, 2025 16:46
@greenc-FNAL greenc-FNAL requested a review from tldahlgren May 28, 2025 19:15
@greenc-FNAL
Copy link
Copy Markdown
Member Author

@tldahlgren pending your re-review, and Gitlab getting around to running the CI pipeline, I think this is ready to go.

@greenc-FNAL greenc-FNAL added the pipelines:urgent Skip "deferred pipelines" check. Only use if rebasing on a tested develop commit is unfeasible label May 28, 2025
@greenc-FNAL
Copy link
Copy Markdown
Member Author

@spackbot run pipeline

@spackbot-app
Copy link
Copy Markdown

spackbot-app bot commented May 28, 2025

I'm sorry, gitlab does not have your latest revision yet, I can't run that pipeline for you right now.

One likely possibility is that your PR pipeline has been temporarily deferred, in which case, it is awaiting a develop pipeline, and will be run when that finishes.

Please check the gitlab commit status message to see if more information is available.

Details
pr head: d590a35, gitlab commit parents: ['7bca5ed', '5f0cf46']

Copy link
Copy Markdown
Contributor

@tldahlgren tldahlgren left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@tldahlgren tldahlgren changed the title New subcommand spack config scopes [--included][--path-scopes][--show-paths] New subcommand spack config scopes [-hips] May 28, 2025
@tldahlgren tldahlgren merged commit 2c567ed into spack:develop May 28, 2025
36 checks passed
greenc-FNAL added a commit to FNALssi/spack that referenced this pull request Jun 2, 2025
* New command list-scopes [--file] [--non-platform]
   - Add missing `_non_platform_scopes()`
   - Update shell completion scripts
   - Scope is "defaults," not, "default."
   - Reorder tests to look for OS-dependent test hysteresis
   - Disable output suppression for pipeline failure diagnosis
   - Remove problematic test criteria
   - `defaults` apparently not available in test environment
* `--file` and `--non-platform` are no longer mutually-exclusive
* Add `-f` alias for `--file` option
* Remove test dependence on external shell environment
* Add tests for platform-specific scopes
* Add test for `--file --non-platform`
* Update shell completion files
* Fix key error in test
* Use test platform in tests
* Remove faulty list-scopes assertions
* New `list-scopes` option `--included`
* Update command completion
* Remove non-working test code
* `list-scopes` -> `scopes`
   Per spack#41455 (comment).
* Remove `--non-platform` in antipication of spack#50603
* file -> path
* Rationalize options and add ability to specify sections
* Improve help text for `spack config scopes`
* New option `--show-paths|-s` to show paths where scopes have the
* Add shortcut `-i` to `--include`
* Add non-option argument to specify section for which to show paths
* `--path` -> `--path-scopes` to avoid confusion with `--show-paths`
* Remove unhelpful type hint
* Per @tldahlgren review
* Improve tests per @tldahlgren suggestions
* Attempt to accommodate Windows™
* Non-option argument `<section>` implies `-s|--show-paths`
greenc-FNAL added a commit to FNALssi/spack that referenced this pull request Jun 2, 2025
* New command list-scopes [--file] [--non-platform]
   - Add missing `_non_platform_scopes()`
   - Update shell completion scripts
   - Scope is "defaults," not, "default."
   - Reorder tests to look for OS-dependent test hysteresis
   - Disable output suppression for pipeline failure diagnosis
   - Remove problematic test criteria
   - `defaults` apparently not available in test environment
* `--file` and `--non-platform` are no longer mutually-exclusive
* Add `-f` alias for `--file` option
* Remove test dependence on external shell environment
* Add tests for platform-specific scopes
* Add test for `--file --non-platform`
* Update shell completion files
* Fix key error in test
* Use test platform in tests
* Remove faulty list-scopes assertions
* New `list-scopes` option `--included`
* Update command completion
* Remove non-working test code
* `list-scopes` -> `scopes`
   Per spack#41455 (comment).
* Remove `--non-platform` in antipication of spack#50603
* file -> path
* Rationalize options and add ability to specify sections
* Improve help text for `spack config scopes`
* New option `--show-paths|-s` to show paths where scopes have the
* Add shortcut `-i` to `--include`
* Add non-option argument to specify section for which to show paths
* `--path` -> `--path-scopes` to avoid confusion with `--show-paths`
* Remove unhelpful type hint
* Per @tldahlgren review
* Improve tests per @tldahlgren suggestions
* Attempt to accommodate Windows™
* Non-option argument `<section>` implies `-s|--show-paths`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands core PR affects Spack core functionality pipelines:urgent Skip "deferred pipelines" check. Only use if rebasing on a tested develop commit is unfeasible shell-support tests General test capability(ies)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants