Skip to content

info: rework spack info command to display variants better#40998

Merged
haampie merged 1 commit intodevelopfrom
new-spack-info
Nov 10, 2023
Merged

info: rework spack info command to display variants better#40998
haampie merged 1 commit intodevelopfrom
new-spack-info

Conversation

@tgamblin
Copy link
Copy Markdown
Member

@tgamblin tgamblin commented Nov 10, 2023

This pulls the spack info changes out of #40326 so they can go in before the full unified dictionary refactor.

Note that this does NOT fix #38302, but if you run spack info warpx you can clearly see the problem, as the information about the dims variant is lost. That will be fixed with #40326.

This changes variant display to use a much more legible format, and to use screen space much better (particularly on narrow terminals). It also adds color the variant display to match other parts of spack info.

Descriptions and variant value lists that were frequently squished into a tiny column before now have closer to the full terminal width.

The new spack info looks like this (in an 80-col terminal):

Screenshot 2023-10-05 at 3 13 54 AM

This used to look like this in a 93-column terminal (left) and an 80=column terminal (right):

Screenshot 2023-10-05 at 3 17 45 AM Screenshot 2023-10-05 at 3 14 55 AM

You can see that the 80-col version wraps horribly b/c we can't fit all the columns. This change also preserves any whitespace formatting present in package.py, so package maintainers can make easer-to-read descriptions of variant values if they want. For example, gasnet has had a nice description of the conduits variant for a while, but it was wrapped and made illegible by spack info. That is now fixed and the original newlines are kept.

Conditional variants are grouped by their when clauses by default, but if you do not like the grouping, you can display all the variants in order with --variants-by-name. I'm not sure when people will prefer this, but it makes it easier to tell that a particular variant is/isn't there. I do think grouping by when is the better default.

@spackbot-app spackbot-app bot added commands core PR affects Spack core functionality tests General test capability(ies) labels Nov 10, 2023
@tgamblin tgamblin requested review from alalazo and haampie November 10, 2023 09:31
@haampie
Copy link
Copy Markdown
Member

haampie commented Nov 10, 2023

Looks pretty 🌈

I wonder if it can be slightly improved for boolean variants, cause it prints as

feature [true]                  false, true
build_system [cmake]            cmake, autotools

Maybe print default variant values in spec syntax

+name                           
build_system=cmake              cmake, autotools

but keep the bright color for the + and =cmake in the first column to indicate those are defaults?

@tgamblin
Copy link
Copy Markdown
Member Author

Can we save that change for now? Not opposed but I think this is quite good already and want to get one more thing in if possible.

@tgamblin
Copy link
Copy Markdown
Member Author

not 100% convinced that showing the default differently from the values is helpful but also like the +/~ so hmm.

@haampie
Copy link
Copy Markdown
Member

haampie commented Nov 10, 2023

The when clause headers already use spec syntax and refer to variants, so could be seen as consistent with that.

But yeah, if you wanna stress the name more than the value I get why you're doing name [value].

Anyways, big improvement 👍

@tgamblin
Copy link
Copy Markdown
Member Author

I think stressing the name is better at least without further thought -- you run spack info to find out what variants there are first, values second.

@tgamblin
Copy link
Copy Markdown
Member Author

I just got sick of running spack info on develop and having it show a garbly UI from the late 70's

@haampie
Copy link
Copy Markdown
Member

haampie commented Nov 10, 2023

True. Yet another alternative (for discussion, not a direct suggestion):

Highlight the default value only on the right-hand side to reduce the amount of information?

   build_type      Debug, RelWithDebInfo, [Release]
        CMake build type
   elpa            [false], true
        Use ELPA
 

@tgamblin
Copy link
Copy Markdown
Member Author

I thought about that too but didn't like having to dig for the default on the RHS. For long lists it's hard to see what exactly the default is.

@haampie
Copy link
Copy Markdown
Member

haampie commented Nov 10, 2023

This is meant to be added to #40977?

Needs

spack commands --update-completion

@haampie haampie added this to the v0.21.0 milestone Nov 10, 2023
@tgamblin
Copy link
Copy Markdown
Member Author

yep please

@haampie haampie mentioned this pull request Nov 10, 2023
10 tasks
This changes variant display to use a much more legible format, and to use screen space
much better (particularly on narrow terminals). It also adds color the variant display
to match other parts of `spack info`.

Descriptions and variant value lists that were frequently squished into a tiny column
before now have closer to the full terminal width.

This change also preserves any whitespace formatting present in `package.py`, so package
maintainers can make easer-to-read descriptions of variant values if they want. For
example, `gasnet` has had a nice description of the `conduits` variant for a while, but
it was wrapped and made illegible by `spack info`. That is now fixed and the original
newlines are kept.

Conditional variants are grouped by their when clauses by default, but if you do not
like the grouping, you can display all the variants in order with `--variants-by-name`.
I'm not sure when people will prefer this, but it makes it easier to tell that a
particular variant is/isn't there. I do think grouping by `when` is the better default.
@haampie haampie merged commit f0ced1a into develop Nov 10, 2023
@haampie haampie deleted the new-spack-info branch November 10, 2023 11:31
haampie pushed a commit that referenced this pull request Nov 10, 2023
This changes variant display to use a much more legible format, and to use screen space
much better (particularly on narrow terminals). It also adds color the variant display
to match other parts of `spack info`.

Descriptions and variant value lists that were frequently squished into a tiny column
before now have closer to the full terminal width.

This change also preserves any whitespace formatting present in `package.py`, so package
maintainers can make easer-to-read descriptions of variant values if they want. For
example, `gasnet` has had a nice description of the `conduits` variant for a while, but
it was wrapped and made illegible by `spack info`. That is now fixed and the original
newlines are kept.

Conditional variants are grouped by their when clauses by default, but if you do not
like the grouping, you can display all the variants in order with `--variants-by-name`.
I'm not sure when people will prefer this, but it makes it easier to tell that a
particular variant is/isn't there. I do think grouping by `when` is the better default.
tgamblin added a commit that referenced this pull request Nov 10, 2023
Tests didn't cover the new `--variants-by-name` parameter in #40998.
Add some parameterization to hit that.

This changeset makes me think that the main section-printing loop in `spack info` isn't
factored so well. It makes it difficult to pass different arguments to different helper
functions.  I could break it out into if statements if folks think that would be cleaner.
tgamblin added a commit that referenced this pull request Nov 11, 2023
This changes variant display to use a much more legible format, and to use screen space
much better (particularly on narrow terminals). It also adds color the variant display
to match other parts of `spack info`.

Descriptions and variant value lists that were frequently squished into a tiny column
before now have closer to the full terminal width.

This change also preserves any whitespace formatting present in `package.py`, so package
maintainers can make easer-to-read descriptions of variant values if they want. For
example, `gasnet` has had a nice description of the `conduits` variant for a while, but
it was wrapped and made illegible by `spack info`. That is now fixed and the original
newlines are kept.

Conditional variants are grouped by their when clauses by default, but if you do not
like the grouping, you can display all the variants in order with `--variants-by-name`.
I'm not sure when people will prefer this, but it makes it easier to tell that a
particular variant is/isn't there. I do think grouping by `when` is the better default.
tldahlgren pushed a commit that referenced this pull request Nov 13, 2023
Tests didn't cover the new `--variants-by-name` parameter in #40998.
Add some parameterization to hit that.

This changeset makes me think that the main section-printing loop in `spack info` isn't
factored so well. It makes it difficult to pass different arguments to different helper
functions.  I could break it out into if statements if folks think that would be cleaner.
gabrielctn pushed a commit to gabrielctn/spack that referenced this pull request Nov 24, 2023
This changes variant display to use a much more legible format, and to use screen space
much better (particularly on narrow terminals). It also adds color the variant display
to match other parts of `spack info`.

Descriptions and variant value lists that were frequently squished into a tiny column
before now have closer to the full terminal width.

This change also preserves any whitespace formatting present in `package.py`, so package
maintainers can make easer-to-read descriptions of variant values if they want. For
example, `gasnet` has had a nice description of the `conduits` variant for a while, but
it was wrapped and made illegible by `spack info`. That is now fixed and the original
newlines are kept.

Conditional variants are grouped by their when clauses by default, but if you do not
like the grouping, you can display all the variants in order with `--variants-by-name`.
I'm not sure when people will prefer this, but it makes it easier to tell that a
particular variant is/isn't there. I do think grouping by `when` is the better default.
gabrielctn pushed a commit to gabrielctn/spack that referenced this pull request Nov 24, 2023
Tests didn't cover the new `--variants-by-name` parameter in spack#40998.
Add some parameterization to hit that.

This changeset makes me think that the main section-printing loop in `spack info` isn't
factored so well. It makes it difficult to pass different arguments to different helper
functions.  I could break it out into if statements if folks think that would be cleaner.
mtaillefumier pushed a commit to mtaillefumier/spack that referenced this pull request Dec 14, 2023
This changes variant display to use a much more legible format, and to use screen space
much better (particularly on narrow terminals). It also adds color the variant display
to match other parts of `spack info`.

Descriptions and variant value lists that were frequently squished into a tiny column
before now have closer to the full terminal width.

This change also preserves any whitespace formatting present in `package.py`, so package
maintainers can make easer-to-read descriptions of variant values if they want. For
example, `gasnet` has had a nice description of the `conduits` variant for a while, but
it was wrapped and made illegible by `spack info`. That is now fixed and the original
newlines are kept.

Conditional variants are grouped by their when clauses by default, but if you do not
like the grouping, you can display all the variants in order with `--variants-by-name`.
I'm not sure when people will prefer this, but it makes it easier to tell that a
particular variant is/isn't there. I do think grouping by `when` is the better default.
mtaillefumier pushed a commit to mtaillefumier/spack that referenced this pull request Dec 14, 2023
Tests didn't cover the new `--variants-by-name` parameter in spack#40998.
Add some parameterization to hit that.

This changeset makes me think that the main section-printing loop in `spack info` isn't
factored so well. It makes it difficult to pass different arguments to different helper
functions.  I could break it out into if statements if folks think that would be cleaner.
RikkiButler20 pushed a commit to RikkiButler20/spack that referenced this pull request Jan 31, 2024
This changes variant display to use a much more legible format, and to use screen space
much better (particularly on narrow terminals). It also adds color the variant display
to match other parts of `spack info`.

Descriptions and variant value lists that were frequently squished into a tiny column
before now have closer to the full terminal width.

This change also preserves any whitespace formatting present in `package.py`, so package
maintainers can make easer-to-read descriptions of variant values if they want. For
example, `gasnet` has had a nice description of the `conduits` variant for a while, but
it was wrapped and made illegible by `spack info`. That is now fixed and the original
newlines are kept.

Conditional variants are grouped by their when clauses by default, but if you do not
like the grouping, you can display all the variants in order with `--variants-by-name`.
I'm not sure when people will prefer this, but it makes it easier to tell that a
particular variant is/isn't there. I do think grouping by `when` is the better default.
RikkiButler20 pushed a commit to RikkiButler20/spack that referenced this pull request Jan 31, 2024
Tests didn't cover the new `--variants-by-name` parameter in spack#40998.
Add some parameterization to hit that.

This changeset makes me think that the main section-printing loop in `spack info` isn't
factored so well. It makes it difficult to pass different arguments to different helper
functions.  I could break it out into if statements if folks think that would be cleaner.
vjranagit pushed a commit to vjranagit/spack that referenced this pull request Jan 18, 2026
This changes variant display to use a much more legible format, and to use screen space
much better (particularly on narrow terminals). It also adds color the variant display
to match other parts of `spack info`.

Descriptions and variant value lists that were frequently squished into a tiny column
before now have closer to the full terminal width.

This change also preserves any whitespace formatting present in `package.py`, so package
maintainers can make easer-to-read descriptions of variant values if they want. For
example, `gasnet` has had a nice description of the `conduits` variant for a while, but
it was wrapped and made illegible by `spack info`. That is now fixed and the original
newlines are kept.

Conditional variants are grouped by their when clauses by default, but if you do not
like the grouping, you can display all the variants in order with `--variants-by-name`.
I'm not sure when people will prefer this, but it makes it easier to tell that a
particular variant is/isn't there. I do think grouping by `when` is the better default.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

commands core PR affects Spack core functionality shell-support tests General test capability(ies) user-experience

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Variant when=: Change of Default for Single/Multi-Variant Transition

2 participants