configuration: remove platform-specific scopes#50603
Conversation
|
It appears that having does not cause |
|
Correct. I needed to add This was required to load |
Putting an include in include:
- path: myfile.yamlI do not think you would want all higher scopes to require a file called |
|
@tgamblin @tldahlgren So I added [greenc@scisoftbuild02] spack (feature-fnal/remove-platform-scopes) (spack) $ spack config blame include
--- include:
/scratch/greenc/art-develop-2025-05-15/spack_env/etc/spack/include.yaml:3 - path: ${platform}/${os}
/scratch/greenc/art-develop-2025-05-15/spack_env/etc/spack/include.yaml:4 optional: True
/scratch/greenc/art-develop-2025-05-15/spack_env/etc/spack/include.yaml:5 - path: ${platform}
/scratch/greenc/art-develop-2025-05-15/spack_env/etc/spack/include.yaml:6 optional: True
/scratch/greenc/art-develop-2025-05-15/spack_env/etc/spack/defaults/include.yaml:4 - path: baseand got: [greenc@scisoftbuild02] spack (feature-fnal/remove-platform-scopes) (spack) $ ( unset SPACK_DISABLE_LOCAL_CONFIG; spack config scopes --file)
env:critic-develop-gcc-14-2-0-cxx20-prof-gcc-11 user site include:almalinux9 include:linux system defaults include:baseIs it expected and reasonable that (e.g.) |
Yes -- see the PR description:
We want the including scope to be higher precedence than what is included. Given A includes B, consider 3 use cases:
We went with the more expressive model where the including scope has full control. |
|
@tgamblin I guess I'm having a conceptual problem with the other-than-normal indirectness of "included by" here. If I'm understanding you correctly, if include:
- path: "${platform}/${os}"
optional: true
- path: "${platform}"
optional: truethen It's also disconcerting to me that this happens at "global" rather than "section" level: one does not include one My worry is that this is not just a "breaking change," but a "brain-breaking change:" the docs will have to carefully explain the consequences of the new mechanism, how it differs from the old, and exactly what must be done in the new paradigm to replicate the semantics of the old paradigm. If I've misunderstood or misstated anything in my analysis above, I'd appreciate correction: I'm perfectly willing to learn either that I've been understanding this wrongly, and/or that the fact that I'm having trouble conceptually is unique to me, and other people are fine with it. |
|
@greenc-FNAL: can you say how you want things to behave and why? |
There was a problem hiding this comment.
Pull Request Overview
This PR removes rigid platform‐specific configuration scopes in favor of a more flexible include mechanism. Key changes include:
- Removing calls to _add_platform_scope and updating scope naming conventions (e.g. using "::" for environment scopes).
- Adjusting tests, documentation, and completion scripts to align with the new naming syntax.
- Refactoring bootstrap configuration and audit functions to reflect the removal of platform-specific scopes.
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| share/spack/spack-completion.fish | Update completions to use new scope naming with "::" syntax |
| lib/spack/spack/test/config.py | Modify expected environment scope names from "env:" to "env::" |
| lib/spack/spack/main.py | Remove _add_platform_scope invocation |
| lib/spack/spack/environment/environment.py | Update environment scope naming to use "::" |
| lib/spack/spack/config.py | Refactor configuration scope handling and remove platform-dependent logic |
| lib/spack/spack/bootstrap/config.py | Remove platform-specific configuration scope addition |
| lib/spack/spack/audit.py | Adjust audit scope lookup and remove extraneous debug output |
| lib/spack/docs/configuration.rst | Update documentation for platform-specific configuration via includes |
| etc/spack/defaults/include.yaml | Define new include paths for platform configuration |
cf209d5 to
b1adf78
Compare
|
rebased to deal with #50612 |
I don't think this approach is bad, I'm just having trouble wrapping my head around it and worry that it's going to be hard for other people too, and existing Spack installations, when upgraded, are going to behave differently that before in ways that might be hard to trace. If I was thinking about the problem de novo-ish, I would expect a system where the "scope"s would be This would seem to be more in keeping with file-based include semantics in other languages, and the concepts of "includes," is explicit rather than indirect. If I understood the motives behind |
f7511c4 to
84873c8
Compare
|
@tldahlgren: I'm bailing on the Here, I just added a private |
We don't have this -- we just have scopes and sections, and merging is done at scope granularity, not section granularity. However, if you think of the entire scope as a split out is equivalent to: |
Spack has historically allowed a platform-specific subdirectory
for each configuration scope. e.g., in Spack's own defaults we use this
for platform-specific overrides:
```
spack/etc/spack/
packages.yaml
spack/etc/spack/linux/
packages.yaml
spack/etc/spack/darwin/
packages.yaml
```
This adds specialized `packages.yaml` overrides for linux and darwin.
In #48784, we added a much more general facility for an `include:`
section in configuration, so you can add your own much more specialized
config directories. This PR addresses a couple issues with that, namely:
1. We still hard-code the platform includes in Spack
2. Platform includes are at *higher* precedence than the including scope,
while `include:` includes are lower. This makes it impossible for
something like:
```yaml
include:
- include: "${os}"
```
to override the linux subdirectory in a config scope.
This PR removes the older platform-specific config scopes in favor of
allowing users to add their own such scopes if they need them. So,
if you want platform configuration, you can add this to the scope
that needs it:
```yaml
include:
- include: "${platform}"
```
If you want platform to have lower precedence than OS, you can do this:
```yaml
include:
- include: "${os}"
include:
- include: "${platform}"
```
And now OS config can override platform. Likewise, you could reverse the
list and have platofrm with higher precedence than OS.
- [x] remove `_add_platform_scope() from `config`
- [x] refactor default config scope to account for new structure
- [ ] TBD: docs
Signed-off-by: Todd Gamblin <[email protected]>
Co-authored-by: Chris Green <[email protected]>
We can rework scope names in a future PR Signed-off-by: Todd Gamblin <[email protected]>
Signed-off-by: Todd Gamblin <[email protected]>
2e0bf8d to
84fdd9a
Compare
* 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 #41455 (comment). * Remove `--non-platform` in antipication of #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`
Spack has historically allowed a platform-specific subdirectory for each
configuration scope. e.g., in Spack's own defaults we use this for
platform-specific overrides:
```
spack/etc/spack/
packages.yaml
spack/etc/spack/linux/
packages.yaml
spack/etc/spack/darwin/
packages.yaml
```
This adds specialized `packages.yaml` overrides for linux and darwin.
In spack#48784, we added a much more general facility for an `include:` section in
configuration, so you can add your own much more specialized config directories
if you need them. People had asked for OS scopes, target scopes, etc., and we
did not want to support a bunch of rigidly defined subdirectories in the config
system for all of these needs.
This PR addresses a couple lingering issues, namely:
1. We still hard-code the platform includes in Spack
2. Platform includes are at *higher* precedence than the including scope, while
`include:` includes are lower. This makes it impossible for something like:
```yaml
include:
- path: "${os}"
```
to override the linux subdirectory in a config scope.
To solve this, we're removing the older, inflexible platform-specific config scopes
in favor of allowing users to add their own such scopes if they need them.
If you were using platform-specific config. If you want platform configuration,
you can still have it by adding this to the scope that needs it:
```yaml
include:
- include: "${platform}"
optional: true
```
If you want platform to have lower precedence than OS, you can do this:
```yaml
include:
- include: "${os}"
optional: true
- include: "${platform}"
optional: true
```
And now OS config can override platform. Likewise, you could reverse the list and
have platform with higher precedence than OS.
- [x] remove `_add_platform_scope() from `config`
- [x] refactor default config scope to account for new structure
- [x] Docs
---------
Signed-off-by: Todd Gamblin <[email protected]>
Co-authored-by: Tamara Dahlgren <[email protected]>
Co-authored-by: Chris Green <[email protected]>
* 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`
Spack has historically allowed a platform-specific subdirectory for each
configuration scope. e.g., in Spack's own defaults we use this for
platform-specific overrides:
```
spack/etc/spack/
packages.yaml
spack/etc/spack/linux/
packages.yaml
spack/etc/spack/darwin/
packages.yaml
```
This adds specialized `packages.yaml` overrides for linux and darwin.
In spack#48784, we added a much more general facility for an `include:` section in
configuration, so you can add your own much more specialized config directories
if you need them. People had asked for OS scopes, target scopes, etc., and we
did not want to support a bunch of rigidly defined subdirectories in the config
system for all of these needs.
This PR addresses a couple lingering issues, namely:
1. We still hard-code the platform includes in Spack
2. Platform includes are at *higher* precedence than the including scope, while
`include:` includes are lower. This makes it impossible for something like:
```yaml
include:
- path: "${os}"
```
to override the linux subdirectory in a config scope.
To solve this, we're removing the older, inflexible platform-specific config scopes
in favor of allowing users to add their own such scopes if they need them.
If you were using platform-specific config. If you want platform configuration,
you can still have it by adding this to the scope that needs it:
```yaml
include:
- include: "${platform}"
optional: true
```
If you want platform to have lower precedence than OS, you can do this:
```yaml
include:
- include: "${os}"
optional: true
- include: "${platform}"
optional: true
```
And now OS config can override platform. Likewise, you could reverse the list and
have platform with higher precedence than OS.
- [x] remove `_add_platform_scope() from `config`
- [x] refactor default config scope to account for new structure
- [x] Docs
---------
Signed-off-by: Todd Gamblin <[email protected]>
Co-authored-by: Tamara Dahlgren <[email protected]>
Co-authored-by: Chris Green <[email protected]>
* 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`
Warning
This is a breaking change for v1.0. See below for how to address it.
Spack has historically allowed a platform-specific subdirectory for each configuration scope. e.g., in Spack's own defaults we use this for platform-specific overrides:
Generifying platform includes
This adds specialized
packages.yamloverrides for linux and darwin.In #48784, we added a much more general facility for an
include:section in configuration, so you can add your own much more specialized config directories if you need them. People had asked for OS scopes, target scopes, etc., and we did not want to support a bunch of rigidly defined subdirectories in the config system for all of these needs.This PR addresses a couple lingering issues, namely:
We still hard-code the platform includes in Spack
Platform includes are at higher precedence than the including scope, while
include:includes are lower. This makes it impossible for something like:to override the linux subdirectory in a config scope.
To solve this, we're removing the older, inflexible platform-specific config scopes in favor of allowing users to add their own such scopes if they need them.
Refactoring your config
If you were using platform-specific config. If you want platform configuration, you can still have it by adding this to the scope that needs it:
If you want platform to have lower precedence than OS, you can do this:
And now OS config can override platform. Likewise, you could reverse the list and have platform with higher precedence than OS.
_add_platform_scope() fromconfig`- [ ] unit tests