spack icon indicating copy to clipboard operation
spack copied to clipboard

New command, `spack change`, to change existing env specs

Open scheibelp opened this issue 2 years ago • 4 comments

If you have an environment like

$ cat spack.yaml
spack:
  specs: [[email protected]+cuda]

this PR provides a new command spack change that you can use to adjust environment specs from the command line:

$ spack change openmpi~cuda
$ cat spack.yaml
spack:
  specs: [[email protected]~cuda]

in other words, this allows you to tweak the details of environment specs from the command line.

Notes:

  • This is only allowed for environments that do not define matrices
    • This is possible but not anticipated to be needed immediately
    • If this were done, it should probably only be done for "named"/not-anonymous specs (i.e. we can change openmpi+cuda but not spec like +cuda or @4.0.1~cuda)

scheibelp avatar Aug 08 '22 18:08 scheibelp

will anybody ever use this though?

haampie avatar Aug 08 '22 19:08 haampie

will anybody ever use this though?

This was based on an internal request. There are a couple goals with this:

  • Make it easier for tools running "on top of" Spack to manipulate data structures within it (without this PR, if you want to change an environment spec you have to manually open/edit the spack.yaml, which is fine for users interfacing with Spack directly but not for programs or scripts)
  • Provide a more-streamlined interface for interacting with Spack (while I personally find it convenient to manually edit the spack.yaml, other users may not want to, and it admittedly requires familiarity with yaml and other concepts they may not care about in the moment that they want to change specs).

scheibelp avatar Aug 08 '22 19:08 scheibelp

Right, I think if I would use spack change I would immediately check the resulting yaml file, so there's no time saved

haampie avatar Aug 08 '22 20:08 haampie

Can it at least be put under spack env instead in the global set of commands? I'm still thinking it will rarely be used and change is such a generic command...

Also, I don't think this pr deals with changing say a provider. Or "changing" the flavor of a dependency not listed as root spec. :shrug:

haampie avatar Aug 09 '22 13:08 haampie

Close/reopen to restart docs build

scheibelp avatar Aug 15 '22 21:08 scheibelp

@tgamblin I have addressed the review comments: I think this is ready for another look.

scheibelp avatar Aug 24 '22 02:08 scheibelp