Skip to content

Increase mypy_primer comment length #9598

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

Merged
merged 1 commit into from
Jan 29, 2023
Merged

Conversation

Avasam
Copy link
Collaborator

@Avasam Avasam commented Jan 28, 2023

To be exact, we only need to reserve 170 characters to truncate over a thousand lines. But I figured that 65300 was a nice round number with a good buffer.

Sources:
image
and https://github.com/orgs/community/discussions/27190#discussioncomment-3254953

@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

Copy link
Member

@JelleZijlstra JelleZijlstra left a comment

Choose a reason for hiding this comment

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

Might be worth doing the same on mypy.

@JelleZijlstra
Copy link
Member

Also, over at Black we have a similar system called diff-shades, and there we get around the comment length limit by printing the full diff to the action's log instead and linking to it. It's a little less convenient, but we could consider it as an option for very long diffs if we think it's important to be able to see the full comment. I'd personally consider it overkill since a very long mypy-primer diff is usually enough indication that a change is a bad idea.

@AlexWaygood
Copy link
Member

Also, over at Black we have a similar system called diff-shades, and there we get around the comment length limit by printing the full diff to the action's log instead and linking to it. It's a little less convenient, but we could consider it as an option for very long diffs if we think it's important to be able to see the full comment. I'd personally consider it overkill since a very long mypy-primer diff is usually enough indication that a change is a bad idea.

Interesting, that sounds like overkill for typeshed, but might be pretty useful for mypy. It would have been very useful to easily see the full diffs for the typing.Self PRs, where the diff was often huge because of the number of projects that were already using typing.Self, despite it being unsupported by mypy. And there's value in keeping the workflow relatively in sync across the two projects; it's less cognitive load for maintainers.

@Avasam
Copy link
Collaborator Author

Avasam commented Jan 28, 2023

Note that the action prints the full diff! This is purely for convenience with the comment since I hit the old limit recently with a legit PR.
Splitting the comment might be overkill for typeshed and flake8-pyi's primers. But if it can link to the action run when truncating that could be a nice qol improvement.

@hauntsaninja
Copy link
Collaborator

The full diffs are available for download if you click through.

To Alex's suggestion for mypy: we now have per project truncation on mypy.

Avasam, do you have a PR in mind where 30k chars more of comment would have been useful?

@AlexWaygood
Copy link
Member

Avasam, do you have a PR in mind where 30k chars more of comment would have been useful?

I think probably #9597

@Avasam
Copy link
Collaborator Author

Avasam commented Jan 29, 2023

Avasam, do you have a PR in mind where 30k chars more of comment would have been useful?

I think probably #9597

~3.5k for that one in its current state (24 truncated lines). While working on it I easily had 80+ truncated lines of legit diff I had to go through.
Also I had up to 230+ truncated lines (which would result in 35-40k+ additional chars) at some point because of some generics-related changes, but decided to revert that and keep for later. ie:

- <something about> Row
+ <something about> Row[Any]

The idea is more that if we limit the length for technical reasons, may as well get closer to the limit, not halfway there (and it doesn't negatively affect readability). In other words, making the limit less arbitrary.

Truncating in multiple comments is something that can be done if someone wants to tackle it, but this hard-limit would still be relevant, and is likely still gonna be hit from the homeassistant project alone once I tackle SQLAlchemy generics.

@hauntsaninja hauntsaninja merged commit 2ffd867 into python:main Jan 29, 2023
@Avasam Avasam deleted the patch-1 branch January 29, 2023 23:35
Avasam added a commit to Avasam/typeshed that referenced this pull request Feb 1, 2023
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.

4 participants