Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate option value derivation into help. #10313

Merged
merged 6 commits into from Jul 11, 2020

Conversation

benjyw
Copy link
Sponsor Contributor

@benjyw benjyw commented Jul 10, 2020

  • The normal help now shows value derivation for each displayed option.
  • Replaces the old options goal, which was overly complex.
  • Gets rid of OptionTracker. The parser itself now does the tracking, by
    adding a details field to RankedValue.
  • Streamlines Parser._compute_value (although it is still huge).
  • Fixes a bug where the default value we displayed was sometimes the
    current value, not the HARDCODED default.
  • Also removes the defaulting to os.environ/sys.argv in various places
    in the options system. You now have to be explicit about passing those through.
  • Removes the affordance for the args maybe not including the binary name
    in tests. Now args[0] must always be the binary name (that is, ./pants).

A future change will provide a way to dump all help info, including the
value derivation history, out to JSON.

[ci skip-rust-tests]

@benjyw
Copy link
Sponsor Contributor Author

benjyw commented Jul 10, 2020

Screenshot 2020-07-10 10 33 29

# Rust tests will be skipped. Delete if not intended.
[ci skip-rust-tests]
Copy link
Sponsor Member

@stuhood stuhood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great stuff! Thanks.

The normal help now shows value derivation for each displayed option.

Should it maybe only render the value if it is different from the default?

src/python/pants/option/arg_splitter.py Show resolved Hide resolved
src/python/pants/testutil/test_base.py Show resolved Hide resolved
@benjyw
Copy link
Sponsor Contributor Author

benjyw commented Jul 10, 2020

Should it maybe only render the value if it is different from the default?

I had it that way at first, but I found it subjectively worse than being consistent.

Copy link
Contributor

@Eric-Arellano Eric-Arellano left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wonderful! Excellent work.

"--level",
type=LogLevel,
default=LogLevel.INFO,
recursive=True,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe save this for a followup so that it shows up in the changelog as a distinct change. Stu has been planning to remove recursive options.

# Rust tests will be skipped. Delete if not intended.
[ci skip-rust-tests]
# Rust tests will be skipped. Delete if not intended.
[ci skip-rust-tests]
@benjyw benjyw merged commit dfc3f5b into pantsbuild:master Jul 11, 2020
@benjyw benjyw deleted the option_value_help branch July 11, 2020 06:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants