-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
ctexplain: first functional check-in #11829
Conversation
cc @kkress |
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.
The implementation and approach is fine. Mostly stylistic concerns.
tools/ctexplain/analyses/summary.py
Outdated
repeated_targets: int | ||
|
||
|
||
def analyze(cts: Tuple[ConfiguredTarget, ...]): |
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.
Pytype should let you annotate the return type. This ends up making most of the docstring redundant.
def analyze(cts: Tuple[ConfiguredTarget, ...]) -> _Summary:
"""Runs the analysis on a build's configured targets."""
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.
Done.
I remain confused about when pytype insists on an Args
description and when not. Do you know?
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.
Assuming you mean pylint but, in my experience, it requires it when the docstring is >1 line.
There was talk about relaxing the requirement when pytype is used; however, do not know if that was ever actually executed.
|
||
|
||
def main(argv): | ||
del argv # Satisfy py linter's "unused" warning. |
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.
Error if unexpected arguments remain? e.g.
if len(argv) > 1:
raise app.UsageError('Too many command-line arguments.')
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.
FLAGS already catches unknown arguments. Would this be redundant?
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.
Without proof, I think this catches adding arguments after just --
. I would need to experiment since nothing showed up on a cursory glance.
This will help normalize the "required fragments" ctexplain computes, given that some dependers (like rules) require fragments while others (like select() require options).
#11511 set up basic project structure. This PR adds minimum working functionality.
Specifically, you can run it with a build command and it reports basic stats on the build's graph.
Example:
Notes:
Context: Measuring Configuration Overhead.
Work towards #10613