-
Notifications
You must be signed in to change notification settings - Fork 32
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 support for formatting Python signatures using black #367
Conversation
What about |
Potentially ruff could be supported in addition or instead. Most of the work in this PR is related to the Python-specific munging of signatures that would be the same for ruff as well. The advantage of For clang-format we already do that, by collecting all of the signatures, separating them with special identifying comments, and formatting all of them with a single run of However, there are a few caveats with applying the same approach to Python:
Potentially the ruff LSP accessible via Overall, though, I expect I'd be happy to switch this project itself to using ruff instead of black/pylint, though. |
Yes, please! That should cut down the longest steps in our CI's check-convention job. You make a good point about the lack of an API for ruff. One of the biggest unspoken hurtles with PyO3 is the compatibility with python ABI vs rust edition. Now that you mention that this is only for signatures, I agree it may not be worth pursuing. My question was kind of a knee-jerk reaction; I recently fell in love with rust and am looking for ways to use it more and more. |
Most of the pylint failures are related to my using |
Personally, I'm ok with dropping it. However, EoL for python 3.8 is still 3 months from now, so its just a little early. IMHO, it should probably be done in a separate PR because there is likely more than just type hints in terms of code specific to python 3.8 (or earlier). |
c862962
to
5137323
Compare
5137323
to
6819422
Compare
Previously, signatures collected from multiple workers were not correctly merged, leading to some signatures not being formatted in parallel builds.
5109c4f
to
8f8edba
Compare
This now passes CI, and I added some documentation. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #367 +/- ##
==========================================
- Coverage 63.91% 63.03% -0.89%
==========================================
Files 67 67
Lines 8068 8207 +139
==========================================
+ Hits 5157 5173 +16
- Misses 2911 3034 +123 ☔ View full report in Codecov by Sentry. |
This kind of works with the latex builder but the spacing doesn't line up correctly because the latex builder doesn't use a monospace font for the signatures. I'm not sure how easily we could force a monospace font. More generally, though, while building the latex docs (i.e. actually invoke |
Yeah, its been like that for a long time. I never devoted enough time to figure out and fix the problems. I'm happy enough just keeping the builder from breaking (for now). |
38bdc91
to
87d2a40
Compare
Co-authored-by: Brendan <2bndy5@gmail.com>
87d2a40
to
dd125ad
Compare
No description provided.