spack info: show conditional dependencies and licenses; allow filtering#51137
spack info: show conditional dependencies and licenses; allow filtering#51137
spack info: show conditional dependencies and licenses; allow filtering#51137Conversation
3db9053 to
29dc0ea
Compare
There was a problem hiding this comment.
Overall this looks great. I think there is an issue with single-value variant. For instance check the dependencies of:
$ spack info zlib-ng build_system=autotoolsvs.
$ spack info zlib-ng build_system:=autotoolsSince build_system is multi=False specifying a value prevents other values to be possible.
Another issue is with conditional variants. For instance, in all CudaPackages, if we specify:
$ spack info trilinos~cudawe continue to see pages of cuda_arch, even if that variant is gated on +cuda.
Finally, just a comment on colors (disregard this if you don't agree). I wouldn't use red for run dependencies, cause red is usually associated with failures. Maybe yellow?
I'll dive into code next.
alalazo
left a comment
There was a problem hiding this comment.
Minor comments, and two hints on the variant issues.
|
Does this fix #51222? |
|
I would say that it is in the spirit of #51222, in that it allows filtering by spec, but it doesn't exactly fix it b/c it doesn't address filtering by things like I think a refactor towards something more general like |
|
@alalazo - I apparently wasn't in the loop with you and @haampie on the review of #35681, but in testing this I noticed that this code breaks the Does it have to do that? Can we not defensively copy in |
4b79bce to
26cb54f
Compare
|
@alalazo: This PR is getting fairly large now but it's much improved. The commits are, I think, well factored into independent fixes/features now.
See what you think and let me know if this is more usable. |
79df9eb to
d8157f0
Compare
This is a hack while we figure out why it's doing this Signed-off-by: Todd Gamblin <[email protected]>
2de8ce1 to
179ada9
Compare
`spack info` has always shown dependencies grouped by type, but not conditional dependency information. This generifies the code used to display variants and uses it for dependencies as well. As with variants, dependencies are shown grouped by conditions, with unconditional dependencies first. - [x] generify when-grouping code to use a `Formatter` class - [x] Rewrite variant code to use generic formatter. - [x] Rewrite dependency code to use generic formatter. - [x] add full type annotations to `cmd/info.py` Signed-off-by: Todd Gamblin <[email protected]>
Signed-off-by: Todd Gamblin <[email protected]>
`spack info` has historically accepted a package name but not a spec.
Now that it shows lots of conditional information, it can be useful
to filter out variants, dependencies, versions, etc. that are irrelevant
to certain package configurations.
- [x] allow `spack info` to take a spec instead of a package name
- [x] filter `spack info` output versions, dependencies, variants, and
licenses based on the input spec
Signed-off-by: Todd Gamblin <[email protected]>
Signed-off-by: Todd Gamblin <[email protected]>
After adding dependencies, it is often much clearer to list info output by name, since there can be a very large number of dependency conditions in the output. `--by-when` is still an option, and the `--by-name` argument is still present even though it is the default. Signed-off-by: Todd Gamblin <[email protected]>
Signed-off-by: Todd Gamblin <[email protected]>
Signed-off-by: Todd Gamblin <[email protected]>
…itions This will advise users to add, e.g., `~cuda` and `~rocm` when output for a package is very long. This makes the feature more discoverable. Signed-off-by: Todd Gamblin <[email protected]>
Signed-off-by: Todd Gamblin <[email protected]>
For complex dependencies like boost, there may be many required variants. Ensure that they don't push deptypes off the edge of the screen by setting a min width and showing deptypes on the next line when the dependency spec is too long. Signed-off-by: Todd Gamblin <[email protected]>
- need to use long_spec for this Signed-off-by: Todd Gamblin <[email protected]>
Signed-off-by: Todd Gamblin <[email protected]>
179ada9 to
6b28358
Compare
I went with blue and also fixed a couple bugs. This should be all done. |
alalazo
left a comment
There was a problem hiding this comment.
The use cases pointed out in the previous review have been addressed 💯 Only minor comments that we can leave for a following PR.
#51137 displays `when` conditions for dependencies, but it doesn't display direct or transitive dependencies in conditions. This is used frequently for things like * `when="^[email protected]:"`: optional deps for particular pythons * `when="%clang@34:"`: optional deps depending on build compiler - [x] change format for when from `Spec.format()` to `_long_spec()` - [x] add a test Signed-off-by: Todd Gamblin <[email protected]>
…51588) #51137 displays `when` conditions for dependencies, but it doesn't display direct or transitive dependencies in conditions. This is used frequently for things like * `when="^[email protected]:"`: optional deps for particular pythons * `when="%clang@34:"`: optional deps depending on build compiler - [x] change format for when from `Spec.format()` to `_long_spec()` - [x] add a test Signed-off-by: Todd Gamblin <[email protected]>
…pack#51588) spack#51137 displays `when` conditions for dependencies, but it doesn't display direct or transitive dependencies in conditions. This is used frequently for things like * `when="^[email protected]:"`: optional deps for particular pythons * `when="%clang@34:"`: optional deps depending on build compiler - [x] change format for when from `Spec.format()` to `_long_spec()` - [x] add a test Signed-off-by: Todd Gamblin <[email protected]>
…51588) #51137 displays `when` conditions for dependencies, but it doesn't display direct or transitive dependencies in conditions. This is used frequently for things like * `when="^[email protected]:"`: optional deps for particular pythons * `when="%clang@34:"`: optional deps depending on build compiler - [x] change format for when from `Spec.format()` to `_long_spec()` - [x] add a test Signed-off-by: Todd Gamblin <[email protected]>
…51588) #51137 displays `when` conditions for dependencies, but it doesn't display direct or transitive dependencies in conditions. This is used frequently for things like * `when="^[email protected]:"`: optional deps for particular pythons * `when="%clang@34:"`: optional deps depending on build compiler - [x] change format for when from `Spec.format()` to `_long_spec()` - [x] add a test Signed-off-by: Todd Gamblin <[email protected]> Signed-off-by: Gregory Becker <[email protected]>
…51588) #51137 displays `when` conditions for dependencies, but it doesn't display direct or transitive dependencies in conditions. This is used frequently for things like * `when="^[email protected]:"`: optional deps for particular pythons * `when="%clang@34:"`: optional deps depending on build compiler - [x] change format for when from `Spec.format()` to `_long_spec()` - [x] add a test Signed-off-by: Todd Gamblin <[email protected]> Signed-off-by: Gregory Becker <[email protected]>
…pack#51588) spack#51137 displays `when` conditions for dependencies, but it doesn't display direct or transitive dependencies in conditions. This is used frequently for things like * `when="^[email protected]:"`: optional deps for particular pythons * `when="%clang@34:"`: optional deps depending on build compiler - [x] change format for when from `Spec.format()` to `_long_spec()` - [x] add a test Signed-off-by: Todd Gamblin <[email protected]> Signed-off-by: Gregory Becker <[email protected]>
…51588) #51137 displays `when` conditions for dependencies, but it doesn't display direct or transitive dependencies in conditions. This is used frequently for things like * `when="^[email protected]:"`: optional deps for particular pythons * `when="%clang@34:"`: optional deps depending on build compiler - [x] change format for when from `Spec.format()` to `_long_spec()` - [x] add a test Signed-off-by: Todd Gamblin <[email protected]> Signed-off-by: Gregory Becker <[email protected]>
…51588) #51137 displays `when` conditions for dependencies, but it doesn't display direct or transitive dependencies in conditions. This is used frequently for things like * `when="^[email protected]:"`: optional deps for particular pythons * `when="%clang@34:"`: optional deps depending on build compiler - [x] change format for when from `Spec.format()` to `_long_spec()` - [x] add a test Signed-off-by: Todd Gamblin <[email protected]> Signed-off-by: Gregory Becker <[email protected]>

spack infohas always shown dependencies grouped by type, but not conditional dependency information. While conditional deps are often very relevant, users have to read raw package files to see them.This PR generifies the code used to display variants and uses it for dependencies and licenses too. As with variants, dependencies are shown grouped by conditions, with unconditional dependencies first. Users can supply the
--by-nameargument to list ordered first by name instead.--by-nameis meant to replace--variants-by-name.--variants-by-namestill works but is suppressed from help and has the same function as--by-name.spack info gccbefore and after:As there is increasingly more information displayed by
spack info, it can be useful to filter out variants, dependencies, versions, etc. that are irrelevant to certain package configurations.This PR also allows
spack infoto take a spec instead of a package name, so users can run, e.g.:spack info [email protected]to get only information relevant to 1.14.x versions of
hdf5. Versions, dependencies, variants, and licenses are now filtered based on the input spec.Before and after:
Formatterclasscmd/info.pyspack infoto take a spec instead of a package namespack infooutput versions, dependencies, variants, and licenses based on the input spec