-
-
Notifications
You must be signed in to change notification settings - Fork 646
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
Include provider info in help output for subsystems and target types. #13993
Conversation
# Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is awesome! Thanks.
I think this is really useful for the docsite, but I'm not as sure if it's useful for CLI output. With the CLI, you'll only be seeing the help
message in the first place if that backend was activated. Wdyt?
I'm wondering if we only want to provide this information in ./pants help-all
(JSON), and then in a followup we update our generate_docs.py
script to render this info in the docs but we leave it out of ./pants help
for now.
--
Another thing to consider is "plugin" fields, like how skip_flake8
is only registered if you use pants.backend.python.lint.flake8
, even though the python_source
target is registered by pants.backend.python
. It would be sweet to store the backend for each Field
, so that we can render the backend if its backend != the backend of the original target.
Yeah, I thought the docsite generation could come as a follow up. But I still think this is useful from the CLI, either to tell which backend to disable if you want to get rid of some feature, or perhaps more importantly, to identify if a feature comes from a certain plugin or if it is a core pants feature loaded with a backend. Consider an in-house developed company plugin for pants. Those employees that are not well acquainted with Pants could have a hard time telling which features are added by the plugin and which are core pants features. This helps answer that (and is my motivating use case, actually :P ) |
Oh, good point. Love it, will see what can be done here :) |
[ci skip-rust]
# Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust]
…ource [ci skip-rust]
@Eric-Arellano ok, we didn't track the providers for rules, so had to add that in too... but now we get this nice output:
|
Haven't looked at the details, but this is really awesome both for the CLI, and for the docsite. Thanks @kaos! |
[ci skip-rust] [ci skip-build-wheels]
# Rust tests and lints will be skipped. Delete if not intended. [ci skip-rust] # Building wheels and fs_util will be skipped. Delete if not intended. [ci skip-build-wheels]
Tweaked the wording slightly:
Also added a separating line between the field headers and the description, to make it more readable, imo. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My favorite change of 2022 thus far 🎉😅
print(self.maybe_cyan(f"{indent}type: {field.type_hint}")) | ||
print(self.maybe_cyan(f"{indent}{required_or_default}")) | ||
if field.description: | ||
formatted_desc = "\n".join( | ||
hard_wrap(field.description, indent=len(indent), width=self._width) | ||
) | ||
print(formatted_desc) | ||
print("\n" + formatted_desc) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good change.
Example output: