Think of how we write and use an individual Spack package:
1. Write mypackage/package.py
2. Run "spack install mypackage"
3. Deal with the errors, iterate step 2 until it works.
4. Run "spack load mypackage"... then use and enjoy!!
5. Later on, an update is needed on the package. So edit package.py and repeat steps 2-4.
Now what is a Spack environment? It's simply a set of Spack packages that are used and (frequently) concretized together. So here is how I would like to write and use a Spack environment. It's really the
1. Write mypackage/spack.yaml. [NOTE: I DO NOT want Spack to rewrite my spack.yaml source code. Does it overwrite package.py? No! So why should it overwrite spack.yaml?]
2. Run "spack env concretize" [If the new concretizer is fast enough, maybe this no longer needs to be a separate step]
3. Run "spack env install"
4. Iterate on 1..3 (and also on fixing individual packages) until step 3 works.
5. "Render" the environment. This should be a matter of either:
(a) Create a file we can "source" (or a single mega-module) to load env vars correctly. or...
(b) Link all the environment's packages into a view, and create a file we can "source" (or a single module) to load env vars correctly. The need for setting env vars is GREATLY reduced with view vs. modules; but some env vars still need to be set, for a few packages. Plus, PATH, PYTHONPATH, etc. needs to be set to the view.
NOTE: The choice of modules vs. view should not be an intrinsic part of the environment, and therefore should not be in spack.yaml. It should simply be a choice one makes at the end, whether to render as modules or view (or both). And if rendering as a view, we should give the location of where we want the view rendered.
6. Load the environment by sourcing the file created in step 4.
Spack Environments as they are currently formulated (AFAIK) are all wrong for this way of working:
1. Spack wants a "current" environment, which makes no sense here. There is no "current" package while we are debugging a recipe.
2. Spack likes to overwrite my spack.yaml file. Yuck. Doesn't play well with git, among other things.
3. If a view is involved, spack wastes enormous amounts of time rebuilding the view while I'm still trying to debug the whole thing. The view only needs to be created at the end, when I'm ready to actually try it out.
4. Spack makes the view/module thing an intrinsic feature of the environment. which it shouldn't be.
5. Spack modules are a "hack" for environments. If you have a Spack environment, you'll never be loading modules one by one. Just make a single module to do it all. Or just a script you source; because we're not going to load /unload individual modules when we have an environment set up.
6. Spack fails to give us any help setting env vars if we choose a view. But some env vars still need to be set, and it's not OK to have to do this manually.
I've hacked around all these issues. But it involves a lot of ugly hacks, ugly extra scripts, etc. Not fun at all, and not something that can be easily shared or recommended with others.
I have ZERO interest in the idea that an environment is something you interact with and build incrementally on the command line. All the stuff that gives you a "current" environment, auto-updates the spack.yaml file when you say "spack install", etc. etc. is all NOT what I want. It's the wrong use case model.
The current Spack environments are so NOT how I want to use them, that I imagine creating a new set of Spack environment commands that do this stuff the way I need. Let's call it "batch environments" or something, instead of "interactive environments" which is what we have now.
-- Elizabeth
.. Elizabeth