Closed deeppunster closed 2 years ago
It’s our goal to stay current with Black as new Python features are supported. Thanks for pointing out the issue. Could you share a snippet of code that black currently formats but blue does not?
Certainly. Here is a match statement that black will handle if "--target-version py310" is specified:
order = 1
match order:
case 1:
print("Matched number one")
case 2:
print("Matched number two")
case _:
print("No match")
And the output is:
Matched number one
Hi Grant,
Certainly. Here is a match statement that black will handle if”|--target-version py310|“ is specified:
|order = 1 match order: case 1: print("Matched number one") case 2: print("Matched number two") case _: print("No match") And the output is: |
|Matched number one |
HTH,
Travis
P. S. I added this code to the issue already.
Travis Risner
On 1/10/22 10:45 AM, Grant Jenks wrote:
It’s our goal to stay current with Black as newPython features are supported. Thanks for pointing out theissue. Could you share a snippet of code that black currentlyformats but blue does not?
— Reply to this email directly, view it on GitHub https://github.com/grantjenks/blue/issues/59#issuecomment-1009010058, or unsubscribe https://github.com/notifications/unsubscribe-auth/AE3HZPL7M74QXZIXPCN4OSDUVL5KFANCNFSM5LQLZ3JQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.
You are receiving this because you authored the thread.MessageID: @.***>
Oh, this works with black 21.12b0
or later.
Is there any update on this? Perhaps there's a workaround available? We are on Python 3.10 and would like to use the new match
statement /w blue
. Thanks!
I believe #67 brought in support for Python 3.10 and the match
statement. If you want, you can try formatting with HEAD and seeing how the diffs look.
Fyi @warsaw who was also going to check diffs.
Thanks! We are using https://github.com/grantjenks/blue/pull/67 successfully and our diffs look good. Any idea when this new version might be released? (for now we install blue
from commit hash).
Thanks for the confirmation @chrisguillory - I'll do some quick checks myself and tag a new release. Automation should take it from there.
LGTM
Currently blue (version 0.7.0) supports most features of Python 3.10 via black (version 21.7.b0), but not the match statement. Black version 21.12b0 apparently does (see black issue #2662. However, running blue with that version of black produces this error:
Apparently, blue does not allow the option
--target-version py310
nor the equivalent to be set in the pyproject.toml file (tools.black ...). Version info for current version of blue:Given that blue only patches black and that black does not consider version 21.12b0 to fully support match statements, is it premature to ask that blue can allow the interim version of black to be used with it?