-
-
Notifications
You must be signed in to change notification settings - Fork 1.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
Issue 1554 generate progress output initial draft #10134
base: main
Are you sure you want to change the base?
Issue 1554 generate progress output initial draft #10134
Conversation
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.
Cool idea! I really don't want to sound too negative, but I don't thinks this will work.
Most importantly because _lint_files
is too late into the process. The call to _get_asts
just before the call to _lint_files
already does a lot of the heavy lifting of processing a module. In fact, the simple fact that that method can call self.add_message
shows that it is technically part of the linting process.
I do think you hint at an option that is worth exploring. What if we turn _iterate_file_descrs
into not being an Iterator
but just returning a Sequence
? We already take a Sequence
as input so it is not as if we would be turning something that is lazily evaluated into something that is not.
After that we can check whether verbose
is set and just print something like Linting ... modules
.
That would be a feasible step towards full progress printing I think: we'd start off by actually correctly identifying the amount of work and reporting this in verbose
mode. After this we can worry about printing progress itself.
Since we would only be printing one line I think it should technically also be feasible to do this in a multiprocessing
safe manner.
Hi @DanielNoord - thanks for taking the time to review the draft idea. It's tough to manage time for FOSS projects so I appreciate it.
No sweat about being negative, that's why this PR is draft. I was considering changing the |
Is there a better way, or a possible way, to do all of the CI checks locally? It's rather hit-and-miss to push something that I hope passes ci formatting/mypy checks. This is a note for developer docs. 👋 |
Feels like this is getting more reasonable as a discussion piece. As @DanielNoord mentioned above, linting is two parts, building the AST, and then actually linting. Rather than try to combine those, instead I've opted to report the progress of each of those. Here's what the test prints, when using
I haven't done the parallel stuff yet, b/c we're still sorting out the basics. I did end up pulling out a simple "progress reporter" class, just to keep the main linting module clearer. |
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.
Personally I'm not a big fan of the new options, is there a reason for not just enabling this through verbose
?
As for getting this merged: do you mind splitting off some of the changes into separate PRs? The changes to _iterate_file_descrs
seem sensible and can be done in a separate PR. That reduces the scope of this PR and makes it easier to get people to discuss the actual "meat" of the PR without getting distracted by simple refactorings.
No problem, and no real reason. I figured that this was a new thing and so should get its own settings, but I can see how others would feel it's clutter. I'll remove those new settings, if someone wants them back in that could be a later iteration.
Makes sense. I think it's just a few commits, I'll get it all together and squash it to a single thing. When the above is done, there will be two separate PRs - the progress reporting one will contain the commits of the |
Perfect!
You can select the "base branch" in the Github UI. If you set it to the branch of the first PR in the second PR we will only see the commits that are introduced by the PR. Github should automatically reset the "base branch" after we merge the first PR. Once again, I mostly request this because I have seen way too many PRs fail due to them containing too much changes at once. Review time for |
Yeah, understood about PRs that are too big, I see that a lot as well. This was a draft for discussion, never intended to be merged itself, so it's worked out well. Thanks for the "base branch", will check it out. Some help needed though: I'm currently having some trouble finding out how to the get whether or not "verbose" is set in
In the meantime, I'll split out the non-progress-code into a separate PR. |
Returning a materialized list instead of an iterator lets us do simple progress reporting in the future. As the list of FileItems is very lightweight, there shouldn't be a performance hit.
4d14fa5
to
d6dff7d
Compare
Opened #10142 for the change of |
This PR now only contains 3 commits: the commits for #10142, and the single draft commit. When I get some guidance on how to handle the |
Let me get back to you on that |
I'll try another quick hack. We can assign |
I added Now several tests fail due to how they check stdout. Examples
For the purposes of reducing test code thrash in this PR, I feel that keeping the Some of these failures will have different resolutions:
All my own opinion, of course 👋 |
816f103
to
4a75af2
Compare
for more information, see https://pre-commit.ci
This is a DRAFT PR addressing issue #1554 ("generate progress").
It adds the following section to
pylint --help
:And a sample output from the unit tests using both of these flags is as follows:
This is totally primitive, but maybe it's a useful starting point for concrete discussion.
The code has a few
# NOTE:
comments for discussion.Cheers and thanks for the great project!