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

Add dynamic help #14543

Merged
merged 2 commits into from Feb 23, 2022
Merged

Add dynamic help #14543

merged 2 commits into from Feb 23, 2022

Conversation

thejcannon
Copy link
Member

(breakout from #14467)

Adding the ability to "delay" help evaluation until flag options are collected. This mirrors the old behavior and is necessary for "base" subsystems where the help is fully or partially defined in the subclass.

[ci skip-rust]

# Rust tests and lints will be skipped. Delete if not intended.
[ci skip-rust]
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.

So this is to make things like PythonToolBase work?

src/python/pants/option/option_types.py Outdated Show resolved Hide resolved
src/python/pants/option/option_types.py Outdated Show resolved Hide resolved


def _eval_maybe_helpt(help: _HelpT, subsystem_cls: Any) -> str:
return help(subsystem_cls) if inspect.isfunction(help) else help # type: ignore
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Remind me at some point to codify these conventions in a flake8 plugin ;)

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Member Author

Choose a reason for hiding this comment

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

Those codes are underwhelming. It needs to be beefed up, and in-repo

Copy link
Contributor

Choose a reason for hiding this comment

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

Moving this in-repo would be great! That wasn't possible two years ago. But now that we have support for multiple resolves + in-source Flake8 plugins (thanksssss)

# 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]
@thejcannon thejcannon merged commit 7dfbe83 into pantsbuild:main Feb 23, 2022
@thejcannon thejcannon deleted the dynhelp branch February 23, 2022 01:19
alonsodomin pushed a commit to alonsodomin/pants that referenced this pull request Feb 25, 2022
Adding the ability to "delay" help evaluation until flag options are collected. This mirrors the old behavior and is necessary for "base" subsystems where the help is fully or partially defined in the subclass.

[ci skip-rust]
[ci skip-build-wheels]
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

2 participants