make config and command-line options fungible #25863
cosmicexplorer
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
Does this do more than |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In #25851 it was proposed to add a command-line option
--persist-stage=package1,package2,...to improve the performance of building a package if another version of the package had been built in a previous spack run. I think that specific option would make sense to provide in either the command-line (if you only want to use it for a specific spack invocation, but otherwise do clean builds) or in a yaml config (if you want to speed up the rebuilds of a package for all spack invocations of a user or site).Separately, it's always been frustrating to me that I need to modify a config file to add
config:debug:truewhen I want to make spack spit out a stacktrace, or to use the other concretizer for just a single run.This dilemma does not exist in the pants build tool, which allows setting all options (in order of increasing precedence):
See https://v1.pantsbuild.org/options.html#setting-option-values for more details.
Proposal
Since spack has already decided (very reasonably) to separate the concepts of command-line and config options, we can't and likely shouldn't attempt to make every option perfectly fungible in a config vs on the command line. However, I had an idea about how to achieve the same result without needing to mess around too much with our existing methods of declaring options:
cliconfig section which specifies defaults for command-line options either globally or for specific subcommands.ArgumentParserand execute the spack command, we can first check the content of thecliconfig section and apply any argument values to it directly. This means explicitly-specified command-line options would still take precedence over anything in thecliconfig section.ArgumentParser, or implemented via checking by hand whether the option is set, and setting it to some default value if not. Adding values to the spack repo's defaultcli.yamlwould be a declarative way to set these defaults that makes changes easier to audit than scanning the code implementing a spack subcommand.SPACK_<CONFIG_SCOPE>_<CONFIG_PATH_COMPONENT>_<CONFIG_OPTION_NAME>are set, and apply the value of that environment variable to the appropriate config.Beta Was this translation helpful? Give feedback.
All reactions