Cache Shell Script of spack load and spack env activate#47755
Cache Shell Script of spack load and spack env activate#47755RikkiButler20 wants to merge 154 commits into
spack load and spack env activate#47755Conversation
|
Very excited for this and happy to test on fish! |
|
What if we cached the environment changes at install-time instead? That would also solve issues related to allowing older installs to still function/load... (willing to help with this, would allow me to jettison some local code that is getting harder and harder to maintain) |
This is the plan. There are some details in the slack discussion linked from #47603, and the bit about “package drift” there. i think @RikkiButler20 is doing this in steps (see checklist) — probably need one or two more to move the logic to package install time and env install time. @aweits I think if you want to help, iterating on reviews would be great so we can get this in for 1.0! |
|
@spackbot Fix style |
|
Let me see if I can fix that for you! |
|
I was able to run spack style --fix==> Running style checks on spack
selected: import, isort, black, flake8, mypy
==> Modified files
lib/spack/spack/cmd/load.py
lib/spack/spack/test/cmd/load.py
==> Running import checks
import check requires Python 3.9 or later
import checks were clean
==> Running isort checks
isort checks were clean
==> Running black checks
reformatted lib/spack/spack/cmd/load.py
reformatted lib/spack/spack/test/cmd/load.py
All done! ✨ 🍰 ✨
2 files reformatted.
black checks were clean
==> Running flake8 checks
flake8 checks were clean
==> Running mypy checks
lib/spack/spack/version/version_types.py:145: error: Argument 2 to "StandardVersion" has incompatible type "*Tuple[Tuple[Any, ...], Tuple[Any, ...]]"; expected "Tuple[Tuple[Any, ...], Tuple[Any, ...]]" [arg-type]
lib/spack/spack/version/version_types.py:452: error: Argument 2 to "StandardVersion" has incompatible type "*Tuple[Tuple[Any, ...], Tuple[Any, ...]]"; expected "Tuple[Tuple[Any, ...], Tuple[Any, ...]]" [arg-type]
lib/spack/spack/version/version_types.py:481: error: Argument 2 to "StandardVersion" has incompatible type "*Tuple[Tuple[Any, ...], Tuple[Any, ...]]"; expected "Tuple[Tuple[Any, ...], Tuple[Any, ...]]" [arg-type]
lib/spack/spack/variant.py:131: error: Unsupported right operand type for in ("Union[Collection[Any], Callable[..., Any]]") [operator]
Found 4 errors in 2 files (checked 624 source files)
mypy found errors
I've updated the branch with style fixes. |
|
@spackbot Fix style |
|
Let me see if I can fix that for you! |
|
I was able to run spack style --fix==> Running style checks on spack
selected: import, isort, black, flake8, mypy
==> Modified files
lib/spack/spack/cmd/load.py
lib/spack/spack/test/cmd/load.py
==> Running import checks
import check requires Python 3.9 or later
import checks were clean
==> Running isort checks
isort checks were clean
==> Running black checks
reformatted lib/spack/spack/test/cmd/load.py
All done! ✨ 🍰 ✨
1 file reformatted, 1 file left unchanged.
black checks were clean
==> Running flake8 checks
flake8 checks were clean
==> Running mypy checks
lib/spack/spack/version/version_types.py:145: error: Argument 2 to "StandardVersion" has incompatible type "*Tuple[Tuple[Any, ...], Tuple[Any, ...]]"; expected "Tuple[Tuple[Any, ...], Tuple[Any, ...]]" [arg-type]
lib/spack/spack/version/version_types.py:452: error: Argument 2 to "StandardVersion" has incompatible type "*Tuple[Tuple[Any, ...], Tuple[Any, ...]]"; expected "Tuple[Tuple[Any, ...], Tuple[Any, ...]]" [arg-type]
lib/spack/spack/version/version_types.py:481: error: Argument 2 to "StandardVersion" has incompatible type "*Tuple[Tuple[Any, ...], Tuple[Any, ...]]"; expected "Tuple[Tuple[Any, ...], Tuple[Any, ...]]" [arg-type]
lib/spack/spack/variant.py:131: error: Unsupported right operand type for in ("Union[Collection[Any], Callable[..., Any]]") [operator]
Found 4 errors in 2 files (checked 624 source files)
mypy found errors
I've updated the branch with style fixes. |
|
Going to unsubscribe from this PR while it's still a WIP (too many notifications) but please ping me to review fish support once it is complete. |
|
@spackbot Fix style |
|
Let me see if I can fix that for you! |
|
I was able to run spack style --fix==> Running style checks on spack
selected: import, isort, black, flake8, mypy
==> Modified files
lib/spack/spack/cmd/load.py
lib/spack/spack/hooks/__init__.py
lib/spack/spack/hooks/cache_shell_script.py
lib/spack/spack/test/environment_modifications.py
lib/spack/spack/test/hooks/cache_shell_script.py
lib/spack/spack/test/util/environment.py
lib/spack/spack/util/environment.py
==> Running import checks
import check requires Python 3.9 or later
import checks were clean
==> Running isort checks
Fixing /tmp/tmpu87evsa3/spack/lib/spack/spack/test/hooks/cache_shell_script.py
isort checks were clean
==> Running black checks
reformatted lib/spack/spack/test/hooks/cache_shell_script.py
reformatted lib/spack/spack/util/environment.py
All done! ✨ 🍰 ✨
2 files reformatted, 5 files left unchanged.
black checks were clean
==> Running flake8 checks
lib/spack/spack/cmd/load.py:12: [F401] 'spack.user_environment as uenv' imported but unused
lib/spack/spack/cmd/load.py:13: [F401] 'spack.util.environment' imported but unused
flake8 found errors
==> Running mypy checks
lib/spack/spack/util/environment.py:662: error: Item "NameModifier" of "Union[NameModifier, NameValueModifier]" has no attribute "_cache_str" [union-attr]
lib/spack/spack/util/environment.py:662: error: Item "NameValueModifier" of "Union[NameModifier, NameValueModifier]" has no attribute "_cache_str" [union-attr]
lib/spack/spack/version/version_types.py:135: error: Incompatible types in assignment (expression has type "Tuple[Any, ...]", variable has type "Tuple[str]") [assignment]
lib/spack/spack/variant.py:130: error: Unsupported right operand type for in ("Union[Collection[Any], Callable[..., Any]]") [operator]
lib/spack/spack/build_environment.py:171: error: Overloaded function signatures 1 and 2 overlap with incompatible return types [misc]
lib/spack/spack/build_environment.py:171: error: Overloaded function signatures 1 and 3 overlap with incompatible return types [misc]
Found 6 errors in 4 files (checked 636 source files)
mypy found errors
I've updated the branch with style fixes. |
Signed-off-by: Kayla Butler <[email protected]>
|
@spackbot fix style |
|
Let me see if I can fix that for you! |
|
I was able to run spack style --fix==> Running style checks on spack
selected: import, ruff-format, ruff-check, mypy
==> Running import checks
import checks were clean
==> Running ruff-format checks
ruff-format checks were clean
==> Running ruff-check checks
E501 Line too long (100 > 99)
--> lib/spack/spack/test/hooks/generate_spec_scripts.py:104:100
|
102 | )
103 | assert re.search(
104 | f"_spack_env_remove_value {uenv.spack_loaded_hashes_var} {pkg.dag_hash()} {os.pathsep}",
| ^
105 | unload_script,
106 | )
|
ruff-check found errors
==> Running mypy checks
Success: no issues found in 639 source files
mypy checks were clean
I've updated the branch with style fixes. |
|
@spackbot fix style |
|
Let me see if I can fix that for you! |
|
I was able to run spack style --fix==> Running style checks on spack
selected: import, ruff-format, ruff-check, mypy
==> Running import checks
import checks were clean
==> Running ruff-format checks
ruff-format checks were clean
==> Running ruff-check checks
E501 Line too long (100 > 99)
--> lib/spack/spack/test/hooks/generate_spec_scripts.py:104:100
|
102 | )
103 | assert re.search(
104 | f"_spack_env_remove_value {uenv.spack_loaded_hashes_var} {pkg.dag_hash()} {os.pathsep}",
| ^
105 | unload_script,
106 | )
|
ruff-check found errors
==> Running mypy checks
Success: no issues found in 639 source files
mypy checks were clean
I wasn't able to make any further changes, but please see the message above for remaining issues you can fix locally! |
Signed-off-by: Kayla Butler <[email protected]>
Signed-off-by: Kayla Butler <[email protected]>
Signed-off-by: Kayla Butler <[email protected]>
c1c1829 to
61b45f4
Compare
Signed-off-by: Kayla Butler <[email protected]>
Signed-off-by: Kayla Butler <[email protected]>
Signed-off-by: Kayla Butler <[email protected]>
e692553 to
94e1bd7
Compare
Signed-off-by: Kayla Butler <[email protected]>
d8020be to
33c8148
Compare
…/cache-spack-load-and-activate
Signed-off-by: Richarda Butler <[email protected]>
…/cache-spack-load-and-activate
…kkiButler20/spack into feature/cache-spack-load-and-activate
Fixes #47603
Fixes #21413
This will fix the problem of
spack loadandspack env activatetaking too long and currently iterating over all the package's dependency's python package files. This will also prevents the drifting of the installed spec from the current, updated version on Spackspack loadis run