#black-formatter
1 messages ยท Page 19 of 1
Alright, maybe I'll look into it then.
!remind 20H look into the viability of switching to poetry
Your reminder will arrive <t:1629661991:R>!
After a cursory google search i dont think poetry allows for custom build scripts
its undocumented
1.2.0a2 is buggy enough I wouldn't recommend it for black
@bright glacier nvm I now have a rly buggy thing with isort
And IMHO isort is in the wrong here
from modmail.utils.threads.embeds import (
format_close_embed_to_guild, format_close_embed_to_user, format_edited_message_embed_to_guild,
format_edited_message_embed_to_user, format_generic_embed_to_guild, format_generic_embed_to_user,
format_inital_embed_to_guild, format_inital_embed_to_user, format_message_embed_to_guild,
format_message_embed_to_user,
)
vs
from modmail.utils.threads.embeds import (
format_close_embed_to_guild,
format_close_embed_to_user,
format_edited_message_embed_to_guild,
format_edited_message_embed_to_user,
format_generic_embed_to_guild,
format_generic_embed_to_user,
format_inital_embed_to_guild,
format_inital_embed_to_user,
format_message_embed_to_guild,
format_message_embed_to_user,
)
obviously one of those is superior
the first one /s
ah well, I guess I just need to turn them in to a class
[tool.poetry.build]
script = "build.py"
generate-setup-file = false
```and you just add this to the pyproject.toml and build.py is just a normal python file where you can do whatever ie <https://gist.github.com/f5b1077b1ab30bcdf9ba70d95555a95f>
huh
While this development environment / requirements situation is a mess,
let's at least make it consistent. We're effectively supporting two
modes of development in this project, 1) tox based dev commands
(e.g. tox -e fuzz) that are dead simple to use, and 2) manual dev
commands (e.g. pytest -n auto) that give more control and are usually
faster.
Right now the Pipfile.lock based development environment is incomplete
missing the test requirements specified in ./test_requirements.txt...
finally, that took way too long ๐ฎโ๐จ
Those ones are on the pull_request event.
Not ideal since bugs caused from the merging of the base and branch won't be caught via CI, but that seems rare.
I mean
I just have it required on my project to have branches up to date with the main branch before merging
Given how much CI we already have, limiting it is important so it doesn't take forever.
Oh yea, we'll probably have to add another flag as an escape mechanism, TBH not too pleased with that since we already have too many but blocking root by default is still important.
yeah
why / is right next to . on a keyboard and someone decided to pick the other, idk
flake8 will run on root too lol
ofc flake8 won't change all files
hm
just for fun I ran black on my venv, with the check flag obviously
I'm curious if there's any files that black won't want to reformat in my venv
1823 files would be reformatted, 707 files would be left unchanged.
well that's actually a substantial part of my venv
about 1/3 of my venv is blackified
hi is there support for Python 3.10.0rc1 yet?
running on 3.10rc1: yes, formatting 3.10+ syntax: no (and involves rewriting substantial amounts of the core logic sadly)
meanwhile: sets line length to 1 and runs black
we don't accidentally add backslashes to them when normalizing quotes
because that's invalid syntax!
The problem this commit fixes is that matches would eat too much
blocking important matches to occur. For example, here's one f-string
body:
{a}{b}{c}
I know there's no risk of introducing backslashes here, but the regex
already goes sideways with this. Throwing this example at regex101
I get:
{a}{b}{c} # The As and Bs are the two matches, and the upper
---- ---...
Here's your reminder: look into the viability of switching to poetry
[Jump back to when you created the reminder](#black-formatter message)
Lmfao
A piece of useless statistics: this pull request was implemented in full during intercontinental flights. There's something very tranquil about sitting in one place for 10+ hours with no distractions.
That honestly sounds pretty damn nice ^^
Also, no I am not handling this today, don't feel like it.
!remind 3D maybe look into the viability of switching to poetry
that was ambv on from __future__ import annotations pull request for cpython ๐
look is not a valid duration string.
!remind [mentions]... <expiration> <content>
Can also use: reminder, reminders, remindme
Commands for managing your reminders.
Subcommands:
!remind delete <id_>
Delete one of your active reminders.
!remind edit
Commands for modifying your current reminders.
!remind list
View a paginated embed of all reminders for your user.
!remind new [mentions]... <expiration> <content>
Set yourself a simple reminder.
wut
lol
!remind new 3D "maybe look into the viability of switching to poetry"
maybe look into the viability of switching to poetry is not a valid duration string.
!remind new [mentions]... <expiration> <content>
Can also use: remind add, remind create
*Set yourself a simple reminder.
Expiration is parsed per: http://strftime.org/*
3d iirc
look is not a valid duration string.
!remind [mentions]... <expiration> <content>
Can also use: reminder, reminders, remindme
Commands for managing your reminders.
Subcommands:
!remind delete <id_>
Delete one of your active reminders.
!remind edit
Commands for modifying your current reminders.
!remind list
View a paginated embed of all reminders for your user.
!remind new [mentions]... <expiration> <content>
Set yourself a simple reminder.
i actually don't know then
Your reminder will arrive <t:1629926848:R>!
nice
Wow, 2017 -- that feels like such a long time ago!
and 3.10 is releasing soon ๐
PEP 563 was deferred tho
No? Didn't the SC push the default activation of PEP 563 to 3.11?
wow, we used to have a py4 planned
Originally, PEP 563 was scheduled to take effect in Python 4, and this
changed recently (after the discussion in the Language Summit of 2020).
It's possible that third-party libraries and users didnโt plan to react in
the current time frame as they were not aware of this change in timing.
haha, that's not happening anytime soon given how much of the churn budget 2 ->3 ate
yeah lol
also guido has officially said there's no plans and the change would be more like 1>2
because tbf, there's not much about the current python I would change
...except for the stupid classes that were ported from Java andUseCamelCase
CamalCase is pretty nice IMO
logging.getLogger(name=None)```
Return a logger with the specified name or, if name is `None`, return a logger which is the root logger of the hierarchy. If specified, the name is typically a dot-separated hierarchical name like *โaโ*, *โa.bโ* or *โa.b.c.dโ*. Choice of these names is entirely up to the developer who is using logging.
All calls to this function with a given name return the same logger instance. This means that logger instances never need to be passed between different parts of an application.
Ok yeah that's not great
Heya @halcyon latch, I've been thinking about the mentorship thing w/ black. I got more questions on how it could work. The details are still very fuzzy (and I should bring it up with the rest of the core team but that's for later) but I think I have something that could be an outline.
So an event like this's TL;DR would be "a day where newcomers can come to get help getting ready to make their first dives into development in the context of a real-world FOSS project". To make it work I'll need a few things, 1) excellent beginner-friendly docs, 2) the right volunteers -- basically experienced, friendly people with an strong appreciation for the learning process :D, and 3) potential good-starter issues of basically "your first pr" style with varying levels of friendly writeups. And I can just reuse this text channel since it's pre-existing :)
FWIW I don't think the black project is quite ready for something like this, I'd like to improve the development workflows and contributing documentation in general, but that's just a matter of (me) putting in the work (since they've been thought through somewhat already) :p
Open questions include:
- How should the intro docs be written like? What examples can I pull inspiration from?
- How structured should the event be? -- like obviously it's all about the newcomers and helping them make their first waves into development, but I feel like having some structure could be helpful so the ones who aren't quite sure what they want to do still have options. But then again you've said the core of it for you was "you can come and we'll be here ready to ask questions" so maybe I'm just overthinking this :)
- What other things should I know or change? I have never ever planned or ran an event remotely close of this nature and know almost nothing ๐
OH my that is one wall of text, apologies for that!
SO! I've been thinking about this a bit as well as this is something enticing to me/us as a whole.
I'll totally trust your judgement on if black is ready or not. Something to keep in mind is that as a concept it can come across as fairly daunting. I think there are maybe some other projects we could convince to join in for this or even do a super easy trial run with our own stuff like lancebot/python.
I can happily create more channels for you under this category for this, even if it's just private to you and admins to slowly work out the details on this.
Intro Docs
So I'll probably have to defer to some more experienced doc writers but my thoughts are this:
There are a few different levels of intro docs: (1) Intro to contributing (aka what is git and how do I use it), (2) I'm shaky with git and I've never used it in a team, (3) I kinda know what I'm doing but how is this project structured? How do I contribute to this project specifically?
Those 3 levels can easily flow from one to another, but it might be worth having a few different resources available for those different levels. The first two I think PyDis actually has resources for, just from the code jam. The third is reliant on the project developers to create.
It should list the overall goal of the project, maybe some words about how the review cycle works, best practices for git messages, PRs, etc. How to communicate ideas for implementation, when to check in, that kind of stuff. Let me see if I can find some from the previous mentored contribution thing I did.
Event Structure
So this can depend. I've always found it helpful to have a kick-off event. Just so that there's a concrete start time that people know they can schedule around and be there for. It can you talking about this event, the resources available, and it can also be where you set the tone for the event. After that it can just... exist and be and people can float in and out.
Other things that come to mind would just be outreach and the like. Depending on who you want attending will change how early you want to start talking to other folks about this and getting their help with promoting it.
I also think it would be helpful to have a sort of wrap-up post or notes or something. Maybe include some stats/shoutouts/nice moments that happened. Something to finalize the event so it's not left in limbo. Provide gateways for further contribution and all that.
That's all that comes to mind currently. I can give it some more thought though now that I have the mental bandwidth.
@bright glacier ... sorry about that wall of text
lotsa walls here ๐
sorry, we're doing event hashing today
I can happily create more channels for you under this category for this, even if it's just private to you and admins to slowly work out the details on this.
TBF you might be able to create one channel and then use threads
I would personally use the cryptology library for that.
The issue there with a slowburn event planning channel is the thread autoarchive
7 days, tho
Yeah, but with a slowburn event planning channel it can easily be two weeks before circling back to a specific topic
find it surprising that you wouldn't send any message in 7 days lol
inb4 gives ichard manage channel permissions for this category
Look, I'm running like 5 different mini-projects for the psf/black project, it is very possible I could go a week without touching a specific one
lol
didn't you previously figure out that it was either 7 or 12 i can't remember
๐
it's enough where I kinda go "whelp sorry but this one is going to spend some time on the backburner" pretty regularly so I don't burn out
i should do that on the features I'm working on rn
this is my git history of what I've been working on
@bright glacier But I'm super happy to dedicate some time to this. The rest of the year is purposely chill event-wise to give some breathing room and this kind of mentorship/engagement event is my jam
I think there are maybe some other projects we could convince to join in for this or even do a super easy trial run with our own stuff like lancebot/python.
I was thinking of collaborating with other projects but I wasn't sure whether it would be feasible so I left it out for brevity. I guess as a starter, maybe reaching out to the projects that share members of our team (like's Jelle's mypy) would be a good idea. This would mean we should probably move the event to a separate dedicated channel.
So I'll probably have to defer to some more experienced doc writers but my thoughts are this:
Thankfully I'm the documentation lead for the project so this is like the one area I am totally not clueless :)
The first two I think PyDis actually has resources for, just from the code jam.
Wonderful! They'll probably need some tweaking but the core content sounds great!
It should list the overall goal of the project, maybe some words about how the review cycle works, best practices for git messages, PRs, etc. How to communicate ideas for implementation, when to check in, [...]
Love it! Other things that would be good to cover include the test suite and other checks PRs must pass, the various issue types we have and how they differ, an overview of the structure of the codebase, etc.
I have manage message permissions for this channel so far :p
I think providing some options for people to choose, but a limited amount would be beneficial to contribution.
RE. event structure: outreach ... since we're pretty new to this I feel this urge to keep the scale small so yeah. The people I'm trying to target are the ones who want to get their feet wet in development but don't quite know where to get started / how the cards of the trade work for the lack of a better term. So I'm not expecting too much as in sheer PR #count increases ^^
I think I prefer a general more relaxed vibe to the event, so there's no pressure (on all of us!), but including a well-defined start and end to the event sounds good. There is something to be said about good endings where even it's bittersweet, it's beautiful :D
Run if [ "$RUNNER_OS" == "Windows" ]; then
if [ "$RUNNER_OS" == "Windows" ]; then
python.exe -m pip install black
python.exe -m black qlib -l 120 --check --diff
else
sudo python -m pip install black
python -m black qlib -l 120 --check --diff
fi
shell: /bin/bash --noprofile --norc -e -o pipefail {0}
env:
pythonLocation: /opt/hostedtoolcache/Python/3.6.14/x64
LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.6.14/x64/lib
The directory '/home/runner...
what even ... I don't understand this issue at all, anyway moving back to on topic
same
I'm on windows, time to investigate
mostly because I think its very much a 3.6 bug
or
does black support 3.6?
OK, so to summarize the details we have so far:
- We'll need varying levels of intro docs -- in particular the project-specific kind.
- Structure-wise, a clear kickoff and finale would be ideal to set expectations and the tone / wrap the event in a pretty bowtie.
- Outreach & promotion ... I'm just going to defer to the expertise, experience, and influence of PyDis for the time being.
- We should look into collaborating with other projects so the people ready to contribute have options
Finally ... I think moving to a dedicated space for event planning is probably best since these words will end up buried from day-to-day psf/black development and discussion eventually.
I don't know why I didn't assume this would get buried but it's painfully obvious to me now
looking further into it, they're getting their issue from a conda workflow on a fork of microsoft's qlib repository
I also don't know if that's even the official action
the official action's main logic is in a Python script so the output they provided doesn't make any sense.
its not
this is what I'm looking at fwiw https://github.com/microsoft/qlib/compare/main...Wangwuyi123:main
since it shows a nice diff of all of their changes to the main repo, where it works, if it exists
So cool, they basically want us to debug their github actions workflow ... great! /s
And honestly it sounds like a problem with pip and how they are using it
.github/workflows/conda.yml line 15
os: [windows-latest, ubuntu-16.04, ubuntu-18.04, ubuntu-20.04]```
that's my favorite line!
why are you testing on ubuntu-16.04
aaaaaa
although this does make me realise I probably need to start running my tests on windows... hm..
If I knew anything about conda I would be open (even if rather begrudgingly) to helping them out but I don't know anything about conda
cool, you can do it begrudgingly since https://github.com/Wangwuyi123/qlib/blob/3557c112998f291b2eea2a3a82f43bfcd493b80a/.github/workflows/test.yml is the file in question and nowhere does it mention conda! ๐
just why
.github/workflows/test.yml lines 33 to 34
sudo python -m pip install black
python -m black qlib -l 120 --check --diff```
I think this is the problem lol
WHY ARE THEY USING SUDO WITH PIP
also they need to set pip to not use a cache because pip is dumb
honestly I'd bet that using pip with sudo is the source of their problems
they sent that in their (poorly formatted) issue
The directory '/home/runner/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/runner/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Oh nice, there's literally a line about sudo in there ^^
That works. We can share it with the orgs/people we already have close ties with and not throw it wildly into the wind~
I'll drop a category in here open to black formatter devs and admins for lax planning.
darn, I want access to it... ๐
I mean, its incomprehensible..
psf/black#2438 
I sometimes wonder how they make connection that a failure to install black means it's black's problem
especially when the cache is at all
@bright glacier channel made~ gave you some permissions that looked alright at first glance. Feel free to bug me if it needs to be adjusted
I commented on it
Alright perfect! Thank you! I'll go and figure out an intro (pun not intended :p) post so when the rest of the black / admin team comes by they hopefully aren't too confused
oh, huh. When did I get the contributor badge on the black repo
when you fixed an unnecessary backslash escape in some YAML file
yep, psf/black#2423
how did you remember that ๐
the admin team is a little too used to me just... doing event stuff and then letting them know later >_>
How little of a short notice are we talking here? haha ^^
inb4 30 minutes sometimes
I mean, some folks were confused that there was a new bot so I assume not too long lol
"Kat ... why are there 3 new channels in Event Planning"
"Don't worry! It'll make sense! Just uhhhh... hold on"
there's like, 6 bots now
oh, 7.
jeez
I was not alone in that! Scale was my accomplice
7 if you count the 3.10 bot that doesn't have access here if i'm not mistaken
]e heh
You can only use this command in the following channel(s): #878695047112040448, #878694844212592670, #878694948810137621, #878694991784972309, #476196062214750219, #310-release-stream
in4b the bot says something mean to you
is it going to be shutdown soon enough to make that moot?
It... is? It's a listed channel
no?
OH HA. It's our test server bot commands
it lists #878694948810137621, #878694991784972309 but not #bot-commands
ah
that's the deleted channel
totally not confusing at a glance
Scale set it up for me in our test server while I prepped for the event
Worked pretty well since they got the blame when Jake asked questions heh!
lol
so uh, is it going to be added to #bot-commands or is it not going to be kept around long enough to matter?
I'll ask scale about it when he's avail, but we already have two dedicated bot command channels for it
right, just thinking those seem like they're going to be removed soon since that category doesn't have an emoji
They'll probably stay up for a little bit after the video goes up on the PyDis channel causing the next wave of traffic to to the bot command channels.
Weee thank you @dense jungle for the reviews ^^
I see you are trying to up your closed issue count tho ๐
just my unread notifs count ๐
How was the land of too many boxes?
Mostly cleared up! Except that Ikea is apparently out of bookcases so I still have some boxes of books
Wait what ... heh, what how is IKEA out of bookcases ๐
they bought them all, somehow
I didn't know Jelle was an avid book collector ๐ * 2
It's great finishing up that last box though, marks the end of an adventure that is moving wayyyy too much cargo and realizing you own far too much *stuff*.
You sure do realize just how much stuff you own when packing up things ^^
I think this is why
This site canโt be reached
The web page at https://www.vice.com/en/article/88nvva/lumber-shortage-2021-explained might be temporarily down or it may have moved permanently to a new web address.
whelp no reading for me today.
we did throw a lot of things away too, but the new place is bigger ๐
How much time are we betting before every last storage nook and cranny is filled up?
works for me
try refreshing
yeah I'm just going to assume my internet is being dumb again
Actually I just tried on my phone and it works now ๐ค
I love how they call it "the great lumber crisis of 2021", y'know gotta make it super dramatic for 'em kids these days.
yeah, its like saying The Great Country of Britain
Should we reopen this? https://github.com/psf/black/issues/2435 Cleaning trailing whitespace in docstrings is a reasonable request
The OP seems to be having some... issues though
@bright glacier not sure if you're still there since you're typing
I commented on it, thanks
it was previously discussed in greater detail in this channel, as well
most notable/memorable against it was @glad pilot
clicks linked issue
well that was obvious
Oh I was writing up a summary to send to the event planning channel ^^
aha
I was typing here mostly because so I could reference things more easily.
yeah makes sense
aside: if you haven't sent it yet, I would send a message link in the event channel to the conversation had here so its easier to find later
oh I definitely added some links because I can't write up everything that was discussed since it's 11:55 over here
I don't think so but I'd probably would if it was up to me
Yeah, I would appreciate docstring stuff removed too
I'll respond to the ping by noting: yep, I don't think that Black ought to change the contents of string literals, because it has no way of knowing whether those changes will affect the program's behavior. Changes to trailing whitespace within string literals are syntactically significant.
Adding on to that, whenever formatting tests, those can be extremely and easily affected by trimmed whitespaces, in a way that has immediate results. When changing the ast of a main project, that could add a bug that lasts for months.
Just noting that we do in fact change the contents of docstrings (but not other strings) right now
I believe it's mostly whitespace at the beginning/end of strings
Is there not a way to turn that off?
no
I find that as a bad thing
docstrings are another piece of ast that is changed
which IMO should not be
https://github.com/psf/black/issues/2150 was where we discussed this in depth.
I read that.
hmmm
does https://github.com/psf/black/issues/2188 change the ast too?
Lets move CI + then the default of black to use the --experimental-string-processing behavior. Today, if enabled on all black-primer projects, sqlalchemy fails AST check for parenthesis: https://pa...
no, it doesn't
ai
how it's significant?
it can be if the program does something with the trailing whitespace
sure it's frowned upon but Black can't really assume anything there
Black is said to produce "a valid AST that is effectively equivalent to the original"
it is IMO one of its selling features
but ye, docstrings are currently exempt from that and Black cleans up leading and trailing whitespace of docstrings
!e ```py
class Foo:
""" X """
print("1", "2", "3", sep=Foo.doc)
@glad pilot :white_check_mark: Your eval job has completed with return code 0.
1 X 2 X 3
Run that through black and then run it, and the output changes to 1X2X3 without any spaces.
--- test.py 2021-08-23 16:18:15.618015 +0000
+++ test.py 2021-08-23 16:18:19.539408 +0000
@@ -1,4 +1,5 @@
class Foo:
- """ X """
+ """X"""
+
print("1", "2", "3", sep=Foo.__doc__)
Leading and trailing spaces inside string literals are obviously syntactically significant. Black today recognizes if a string literal is a docstring and if so chooses to modify it anyway, but that can change the behavior of a valid program, since docstrings are introspectable, @silent void
tl;dr Its no longer a functionally equivalent ast, which is one of black's selling points
no rights formatter
?
its black
Yes black is the tool's name, but it has no relation to the race. It's used as a reference to a color and a quote from Henry Ford (which admittedly is apparently a pretty questionable figure doing some research)
"You can have any color you want"
Well ford is famous for saying you can only have black
Also, would having the repo / contributing links pinned to the channel be helpful for others?
and walt disney was anti semetic
!warn 863274087010533396 That joke was wildly inappropriate. In the future, if you know something is too far, you shouldn't say it.
:incoming_envelope: :ok_hand: applied warning to @mint barn.
are you going to delete them?
Ahh yeah we planned to do this but none of us got around to doing that -- I should do that, thanks for the reminder!
We generally don't delete messages unless they violate the Discord terms of service. We can, but we prefer not to, since other people have responded and deleting messages makes it harder to follow what was said
Github Repo: https://github.com/psf/black
Docs: https://black.readthedocs.io/en/latest/
Contributing Guidelines: https://black.readthedocs.io/en/latest/contributing/
Thank you 
No worries! Figured it would save someone a few minutes of searching lol
yeah....
granted given the current conversation I would repost it in an hour or so and pin it then lol
aight - if we want to pin that message, I can do some deleting to clean things up around the pinned message. @bright glacier want that?
I mean, the stuff above it is about how the ast is changed ๐
I don't really care either way shrug
I'll leave it alone for now, then - feel free to reach out if you want something deleted.
Good to know, thanks!
Now I'm curious, why is black named black?
Henry Ford quote regarding car paint colors
"you can have any colour you want as long it's black" -- I'm paraphrasing
Ichard has manage message perms anyhow iirc lol
Now I'm curious, why is named named "named"
Wait what, I can delete messages too ??? mind blown
I thought deletion was a higher privilege operation
And where did the name "name" come from. If it was named, then where did named come from?!
right click this message ๐
Ah yeah, I remember now
On GitHub, a lot of delete operations require more privileges compared to other things of a similar nature.
yeah
But discord
discord perms bad
embrace the slack
side note: discord devs use slack when discord breaks
Does Slack have a Bot API ๐ค
Nah, Outlook email chains ๐ฏ
Raw HTML gmail >>
and what happens if slack and discord both break; let's also move this to #ot0-fear-of-python
huh I can delete messages too. such power
i think like github they support user account automation
So to start with helping out at black, should I just try to get a development environment setup and then tackle a "good first issue" label?
yeah, delete message and pin message come with the same permission
Sorry I got distracted in another channel. Yeah basically get an environment setup and find a good first issue, although there isn't many labeled as such. I'll quickly mark a few more as good first issue if I can.
It's all good, I should be able to find a few to get my feet wet
Is your feature request related to a problem? Please describe.
Unicode normalization in unicode identifier. c.f.
- 2. Lexical analysis โ Python 3.9.6 documentation
- Issue 44981: wildcard imports should normalise names in
__all__- Python tracker - [python - Identifier normalization: Why i...
I'm very nervous and unsure how we could do this safely
is black supposed to do that? If I read the issue correctly, you'd go from a an erroring state to a non erroring one, meaning black would have changed the actual code, not just the format
Ah yeah that's not great either
I just skimmed the issue and immediately went "that sounds hard to do safely"
The fix for #1688 in #1761 breaks help("modules") introspection and also leads to unhappy results when inadvertently importing blackd from python. E.g.:
$ python
Python 3.8.10 | packaged by conda-forge | (default, May 11 2021, 07:01:05)
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> help('modules')
Please wait a moment while I gather a list of all available modules...
aiohttp dependency is not installed: No module named ...
Ah yeah this makes sense. Thanks for the PR!
Lgtm, just one minor comment
Commented strings are currently realigned and repositioned.
Original:
# Matches:
# li>*:first-child:before -> li
# li:first-child>*:first-child:before -> li:first-child
# *:before -> *
SELECTORS_TO_RETARGET = re.compile(
r"(" + # Return this (as \1)...
r"[^\:\>\s]+" + # Anything before a pseudo (:), child (>) or descendant ( )
r"(:first-child)?" + # Include :first-child in the match if it's there
...
:O Zsolt was active on the repository
if you mention blackd it summons him ๐
whaaat is this
The real-time communication home of psf/black, a FOSS project all about building an uncompromising Python code formatter.
Github Repo: https://github.com/psf/black
Docs: https://black.readthedocs.io/en/latest/
Contributing Guidelines: https://black.readthedocs.io/en/latest/contributing/
Hi
Github Repo: <https://github.com/psf/black>
Docs: <https://black.readthedocs.io/en/latest/>
Contributing Guidelines: <https://black.readthedocs.io/en/latest/contributing/>
Suggest: edit those in to that message and pin it ๐
Aren't they already in the topic?
Remember yesterday?
Yeah and what so about it?
ยฏ\_(ใ)_/ยฏ
This
Didn't I do that yesterday?
Fine.
Nice!
Yay
Hopefully my edit via the web interface doesn't break the tests. Will merge afterwards.
5bb4da0 Add cpython Lib/ repository config into primer ... - cooperlees
Describe the bug
The issue with my code is I forgot to have a method to handle the route.
However black formatter is telling me it cannot parse what is otherwise valid code in a misleading / unexpected place.
Is this the default behavior of black or am I doing something wrong / having the wrong expectations?
To Reproduce
Run black on the following code snippet.
import json
from flask import Flask, render_template
app = Flask(__name__)
@app.route("/", meth...
Description
So we don't have to request changes on these basic requirements as
often - hopefully :)
Checklist - did you ...
- [x] Add a CHANGELOG entry if necessary?
- [x] Add / update tests if necessary?
- [x] Add new / update outdated documentation?
are you all black devs? :o
Describe the bug
I run pre-commit run -a and on a random python file, the following error is returned: INTERNAL ERROR: Black produced different code on the second pass of the formatter
To Reproduce
This error occurred randomly.
Describe the bug
If I have a string that is slightly too long for my column limit (usually 100 characters), then often I can make it fit by surrounding it in brackets and moving it into its own line:
LONG_TEXT = "The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog."
# Becomes
LONG_TEXT = (
"The quick brown fox jumps over the lazy dog. The quick brown fox jumps over the lazy dog."
)
Black will undo this formatting.
...
I'm still trying to wrap my head around how black works, so I can hopefully contribute some. Any recommendations?
Tldr black is about to be rewritten somewhat due to the parser not supporting 3.10
IIRC
Which is going to need a huge internal rewrite
Oh damn. Where should I try to learn more about the "behind the scenes" for the project?
What about 3.10 doesn't work?
match cases
psf/black#2318
match and parenthesized with are the only issues I believe. There is no new typing syntax in 3.10
There is.
though black may format the | in weird ways, it won't crash
Yeah that syntax
That is not new syntax
nope, pre-3.10 Python will parse it fine, it just used to not work at runtime
Technically, str | type(None) works :p
Wild
Works Pre 10?
The parser will accept it. You can use it in type annotations with from __future__ import annotations too
not at runtime, but pycharm doesn't complain
Nope-- importing annotations still prohibits the | syntax from working for some odd reason
In my experience at least
will from __future__ import annotations mess up libraries that rely on annotations like pydantic?
I know it has a function update_forward_refs()
@mint barn It won't work in places where the code is executed at runtime, like type aliases. It definitely does work in annotations.
Which are Type aliases?
@teal goblet It does make life harder for pydantic and friends. That's part of why turning on the feature by default was deferred from 3.10
I think that's a different thing?
@mint barn MyType = str | None def f(x: MyType) -> None: ...
That's deferred runtime annotations iirc
!pep 563
But the union operator and such are different
Yes, from __future__ import annotations
Then there's stringify everything
With that feature on, type annotations aren't executed at runtime, so the union or operator won't throw a runtime error
man youve been pinging the wrong person
LMFAO
its fine
Oops, sorry ๐
Lmao I only noticed the second time
@plain atlasyou can also just do ```py
a = 54
b = 6
c: a | b
But only in 3.10?
No, in any version that supports from __future__ import annotations (so 3.7+)
!eval
import sys
print(sys.version_info)
a = 54
b = 6
c: a | b
print(__annotations__)
@bright glacier :white_check_mark: Your eval job has completed with return code 0.
001 | sys.version_info(major=3, minor=9, micro=6, releaselevel='final', serial=0)
002 | {'c': 54}
Looks like GitHub either changed the styling while I was sleeping or while I was eating breakfast cause wow things look a lot harsher and grayer ._.
lmao
You may, have switched to the gray theme, which is the one I use
I'm on default light.
Oh rats.
I'm mildly annoyed that I can't find the OS option to have it automatically switch between light and dark mode so all of my websites can auto pick that up.
I'd prefer light mode most of the time but dark mode is well nice at night :)
It's in settings somewhere
I'm on Ubuntu, it's probably a command line options isn't it :/
after some quick searching I think I might have a way to make it automatic, but why does it involve extensions and maybe an apt install here or there, it's literally ubuntu, one of the Linux distros for less techy people I'd've thought this would be less involved
#black-formatter message
This was a recently pinned message
Basically psf/black is one of those autoformatters that are quite popular these days.
damn cool
I mean, yeah it's impressive but it does mean the decisions we make affect a lot of people ๐
Here's your reminder: maybe look into the viability of switching to poetry
[Jump back to when you created the reminder](#black-formatter message)
8a59528 Stop changing return type annotations to tuples... - ichard26
Sorry for dropping this for a while! I have a few more wording suggestions.
@bright glacier thanks for https://github.com/psf/black/issues/2407#issuecomment-906060619 this is great ๐ I had to stare at a[b:=0] for a while before I realized that's a walrus expression not a slice
Describe the bug
I cannot use black-jupyter in my precommit list
To Reproduce
I have the following .pre-commit-config.yaml :
default_language_version:
python: python3
repos:
- repo: https://github.com/psf/black
rev: 21.7b0
hooks:
- id: black
- id: black-jupyter
the precommit hook fails with the following error message :
[ERROR]
black-jupyteris not present in repository https://github.com/psf/black. Typo? Perhap...
@steel steppe please don't post rickrolls in random channels
Just make the right ones. Easy.
The release slipped for a while, @neon loom shall we just cut a release today?
I'm down
Before it's too late for 2021.8
Am I missing something or what's so particular about having an release in August ๐
Sorry @dense jungle I forgot to tell you that some of the new crashes need ESP to reproduce
Cooper's post above contains the list of the three files needing ESP to crash
IIRC it was test_base64, test_xml_etree, and test_tokenize
for me, test_tokenize actually never finished formatting even giving it a solid 8 minutes
I can only reproduce the crash if I set the recursion limit a bit lower from my default of 1000
Oh right, should have thought of that
aside from line length, where can I find a list of config options
by passing the --help flag ^^
i have image :
[enter image description here][1]
[1]: https://i.stack.imgur.com/2hkeg.jpg
i have code:
from urllib.request import urlopen
import pytesseract
import os
import cv2
from matplotlib imp...
yikes
FYI for getting help I'd suggest #python-discussion or a help channel #โ๏ฝhow-to-get-help ^^
Also, I just tried adding tests for the backport so unparentheized assignment expressions are allowed in slices indices, set literals & comprehensions. It hasn't gone very smoothly to say the least since parametrization is a pain with both pytest' and parameterized' implementation due to our mix of unittest and pytest style test cases.
Wait what, PEP 563 (Postponed Evaluation of Annotations) still stops people from using syntactically invalid expressions, TIL.
yes, they need to be parsed so that the parser knows where the annotation ends. There has been talk of allowing invalid syntax there via some PEG magic, but that is looking unlikely
Ah yea that makes sense. Should've realized that ^^
Description
Implementation stolen from PR davidhalter/parso#162. Thanks parso!
I could add support for these newer syntactical constructs in the target version detection logic, but until I get diff-shades up and running I don't feel very comfortable adding the code.
Checklist - did you ...
- [x] Add a CHANGELOG entry if necessary?
- [x] Add / update tests if necessary?
- [x] Add new / update outdated documentation? -- not applicable
Could you add a test ensuring that we don't remove parentheses from parenthesized walruses in 3.9?
!warn 860652150929883136 Can you not post rickrolls in this channel please. You were warned earlier today.
:incoming_envelope: :ok_hand: applied warning to @steel steppe.
Describe the bug
In a .pyi file, Black formats overload annotations in a compact way following PEP 484 (#210). However, overloads are also allowed in a regular .py file, where Black unfortunately explodes them with two blank lines between every variant and each ... on a line by itself.
The compact formatting should be allowed and/or enforced for overloads ...
Hmm I wonder if that's feasible with the current design of EmptyLineTracker (or whatever the class is called)
I'm sure hacks could be added, just curious if they would be necessary or not ^^
Heya, I'd appreciate quick look over for this PR: psf/black#2416. After that I don't have anything I want to add to the release.
Don't have a lot of time right now, but we can just merge it for now
and maybe follow up later on how to improve the thing with the version in the docs
Hey @bright glacier, don't know if you've seen it yet, but check out
https://python-poetry.org/docs/master/managing-dependencies/#dependency-groups
If you're considering moving to poetry, this'll address the multiple dep files issue, without compromising on speed. It's not released yet though
Currently
conda create --name test python==3.7.10 (just to have fresh environment of python 3.7 for showcase (not a conda issue)
conda activate test
pip install black==20.8b1
fails with
Collecting black==20.8b1
Using cached black-20.8b1.tar.gz (1.1 MB)
Installing build dependencies ... done
Getting requirements to build wheel ... done
Preparing wheel metadata ... error
ERROR: Command errored out with exit status 1:
command: /opt/conda/bin/python ...
Hi! I made this issue 2 months ago: https://github.com/psf/black/issues/2370
This is about blank lines between functions docstring and body.
It didn't get a lot of responses, but I still think this is a cause of inconsistency.
What's your opinion about it ?
Description
The setuptools-scm dependency in setup.cfg did not have a version specified, leading to the issues described in #2499 after a faulty release of setuptools-scm was published.
To avoid this issue in the future, the last version before that faulty update is now pinned.
Checklist - did you ...
- [x] Add a CHANGELOG entry if necessary?
- [x] Add / update tests if necessary? -> Not needed
- [x] Add new / update outdated documentation? -> Not needed
...
$ black .
[1] 25245 segmentation fault black .
$ pip install regex==2021.8.21
Collecting regex==2021.8.21
Using cached regex-2021.8.21-cp38-cp38-macosx_10_9_x86_64.whl (285 kB)
Installing collected packages: regex
Attempting uninstall: regex
Found existing installation: regex 2021.8.27
Uninstalling regex-2021.8.27:
Successfully uninstalled regex-2021.8.27
Successfully installed regex-2021.8.21
$ black . ...
Describe the bug
Using exclude with a regex causes a segfault
To Reproduce
$ .tox/format_style/bin/black --check -v --exclude "foo/[^/]+/baar" .
[1] 97566 segmentation fault .tox/format_style/bin/black --check -v --exclude "foo/[^/]+/baar" .
The issue is caused by https://bitbucket.org/mrabarnett/mrab-regex/issues/421/2021827-results-in-fatal-python-error
And get's fixed by forcing an older version of the package like regex==2021.8.21
No action to do ...
seems like a bad day for our dependencies
summary: a new release of regex made black segfault for some users; a new release of setuptools-scm made black uninstallable for some
Is your feature request related to a problem? Please describe.
It's simple, quite similar to the formatter of PyCharm. Would like black to break the strings into parts when the max length if the line max length is exceeded.
A clear and concise description of what the problem is.
None precisely? But well say if this is my string:
a = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
Here maximum...
Yeah, I do wish python somehow identified the dependency more clearly. I donโt have a suggestion tho. Itโs hard.
I donโt want to release with the pins personally - Iโm a pinning is the end users testing job IMO โฆ but agree there is benefits both ways
Im also not looking forward to mypyc set fault issues
*seg
I'm still reading through the code and docs to wrap my head around how everything works, is most of the heavy lifting done in black/src/black/_init_.py?
I guess the "critical path" is:
main() -> reformat_code() -> format_stdin_to_stdout() -> format_file_contents() -> format_str() -> transform_line() -> run_transformer()
Or maybe I'm going a bit cross-eyed trying to read through and build understanding
I feel like we should pin setuptools_scm, it's just too bad a user experience if an old release suddenly fails to install
If I understand correctly there's no way for a user to fix this
If it was a runtime dependency they could just pin the version of that dep themselves, but not for install-time deps
Correct me if I'm wrong though
Seems like it's fine now that the setuptools_scm release has been yanked?
That's true, this could happen again though
Good Evening, one small question, How can i configure black to not add extra , in last always? I mean this
There is no option for that
Technically they could disable build isolation and pep 518 (or whatever the right pep that handles the build-system field)
I'm personally a bit wary of pinning setuptools-scm
I'd at least prefer it to be pinned in pyproject.toml
Ah ok, Any possibility to get something for this in future? ๐
Also, wow last night was a fire wasn't it ๐ฅ
Usually we try to minimize the amount of options black (in the same spirit as in gofmt for eg.) so it's unlikely we'll add a flag for this
That sounds about right! run_transformer() is only part of the formatting pipeline though, and if I recall correctly it's only used when the --experimental-string-processing flag is used
doesn't run_transformer also handle right hand side splitting?
Oh yes, that's right. It's the Transformer classes that are ESP-specific
Oh wow primer got rekted by the borked regex release
well, yeah, these could be an issue, I do plan on pinning most of the dependencies used during the transcompilation and wheel build so hopefully this should be less of an issue?
I'm not a big fan of pinning setuptools-scm but if we are going to go down this route, I'd ask that we move the setuptools-scm requirement definition to the build-system.requires field in pyproject.toml.
Should we temporarily pin the dependencies troubles issues?
The setuptools one should be resolved since they yanked the bad release, right?
https://bitbucket.org/mrabarnett/mrab-regex/issues/421/2021827-results-in-fatal-python-error no update
For the SmokeDetector project, as soon as our CI testing started using 2021.8.27, we consistently see "Fatal Python error: Segmentation fault" errors across all versions of Python on which we test (3.6, 3.8, and 3.9, using GitHub Actions and Circle CI). The first commit where the CI problems starte...
whelp :/
is this just a preference or do you have some reason for not wanting that extra , in last?
asking because there is a flag for skipping magic trailing comma handling which would not change this style but it would make it so that this extra , doesn't prevent black from shortening it in the future if it can
Hmm, looks like the latest release of regex has been yanked as like with setuptools-scm?
I don't like it there to be honest because like in last it's just a bit irritating sometimes when i read my code. , is useless there too if there is no option after it ๐
the trailing comma is not used for the magic trailing comma feature, but also as a way to reduce diff noise FWIW
I don't know how important that is, but that is one of the selling points Black uses so yea
Any thoughts?
I have a feeling that that won't be released for a while, although that is technically a feature already
16 hours ago
account deleted
@bright glacier ffs. 2021.8.28 has been released
.
it feels like regex is not handled that well
Well it's definitely worse than how setuptools-scm handled their fire but it's good enough
I just wished the yanking happened earlier
I mean yeah I understand why you'd like a reproducer but I think preventing further harm via yanking is more important first
weed
Hmm, now since the version of black is untied to the value of - uses: psf/black@whatever should we still promote pinning?
wdym?
So there's this PR I want to resolve: psf/black#1574
And it adds a comment suggesting to change the stable value for a tag
BUT since then the action allows configuration of what version of black is used
so now the action version != black version
my question is that should we still suggest pinning the action version (that just happens to be linked to black's versions because we host the action in the same repo - I know it's not the best idea don't @ me)
I don't have enough knowledge on this, after reading this lol
Black uses CalVer not SemVer, so a full version tag may be best.
My main concern is that if we suggest pinning people may assume that's also the version of black it'll use -- which is not true!
Hm, does anyone remember why setuptools-scm is defined both in pyproject.toml PLUS setup.cfg?
I guess technically it does help the people who 1) aren't using build isolation, 2) aren't using PEP 517 builds, and 3) want to use a setuptools-scm version older than 42.0, but like that seems like a tiny minority.
So, @bright glacier
My problem is:
I downloaded the black module and then opened the Powershell in the folder that my Python file was in and then I typed in "black characters.py", and then it gave me an error.
What is that error?
I need to know the error message so I can figure out whether it's an installation issue, an issue with black, or something else.
black: The term 'black' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
Ah sounds like an issue with your PATH.
an alternative is use python -m black
Basically whatever the python command you regularly use and installed to (eg. python, python3, python3.9, etc.) + -m black
instead of relying on the python scripts to be added during the pip install, you're asking Python to search the package via the normal lookup process and run the package.
How do I do so?
well, given that its windows, its a bit complicated, so first try what ichard suggested, and see if what they said above works
yeah also if you mess it up system executables can end up shadowed which well .. isn't great to say the least ๐
I cleaned my path yesterday
had 1800+ characters in it
and apparently there's a 2047 or 4095 character limit on some windows versions
>>> len(os.environ["PATH"])
225
its now 1400 which is a lot happier
"only" 1400 chars :p
It says no module named black.
how did you install black?
or: what command did you run to install black on windows?
@bright glacier The irony of E501
# noqa: E501
tests/modmail/utils/addons/test_sources.py:59:111: E501 line too long (113 > 110 characters)
yeesh, this is happening in my tests
@pytest.mark.parametrize("entry, user, repo, plugin, reflike, githost",
[("onerandomusername/addons planet", "onerandomusername", "addons", "planet", None, "github"),
("github onerandomusername/addons planet @master", "onerandomusername", "addons", "planet", "master", "github"),
("gitlab onerandomusername/repo planet @v1.0.2", "onerandomusername", "repo", "planet", "v1.0.2", "gitlab"),
("github onerandomusername/repo planet @master", "onerandomusername", "repo", "planet", "master", "github"),
("gitlab onerandomusername/repo planet @main", "onerandomusername", "repo", "planet", "main", "gitlab"),
("https://github.com/onerandomusername/repo planet", "onerandomusername", "repo", "planet", None, "github"),
("https://gitlab.com/onerandomusername/repo planet" , "onerandomusername", "repo", "planet", None, "gitlab"),
]
)
black makes that so much longer
@pytest.mark.parametrize(
"entry, user, repo, plugin, reflike, githost",
[
("onerandomusername/addons planet", "onerandomusername", "addons", "planet", None, "github"),
(
"github onerandomusername/addons planet @master",
"onerandomusername",
"addons",
"planet",
"master",
"github",
),
(
"gitlab onerandomusername/repo planet @v1.0.2",
"onerandomusername",
"repo",
"planet",
"v1.0.2",
"gitlab",
),
(
"github onerandomusername/repo planet @master",
"onerandomusername",
"repo",
"planet",
"master",
"github",
),
(
"gitlab onerandomusername/repo planet @main",
"onerandomusername",
"repo",
"planet",
"main",
"gitlab",
),
(
"https://github.com/onerandomusername/repo planet",
"onerandomusername",
"repo",
"planet",
None,
"github",
),
(
"https://gitlab.com/onerandomusername/repo planet",
"onerandomusername",
"repo",
"planet",
None,
"gitlab",
),
],
)
pip install black
hm, pip --version and then send the output of that command here.
I was going to say use where python and where pip but that works too
It's where right, or is it which on windows?
as a windows user, I still have no idea. I added where.exe to my profile as where. since powershell has a built in where ๐
pip 21.2.4 from C:\Users\Gamoup\AppData\Roaming\Python\Python36\site-packages\pip (python 3.6)
Get-Command
and also python --version?
is PS7 equivalent of where
which I believe is aliased to the first word of this message ||which||
uh, which isnt a thing in ps i dont think
it is
its aliased
lemme double check I didn't put that in my profile
oop
yep I aliased that
Python 3.6.8
python -m pip install black && python -m black should get a working black installed then
I tend to not run pip directly since that can sometimes be for a different python
Do I run the Powershell in a different directory?
no, you can run it wherever
But do I have to run it in Powershell or CMD?
It says no module named black.
Is the installation even working correctly?
I might have to run cmd as administrator.
oh did the installation error out?
Idk
but installing packages as administrator sounds unnecessary since you usually do user installations of python on windows
When I check black in cmd, it says:
No Path provided. Nothing to do
well, that's good
you need to pass a filepath or directory to black
what's your full dev tool chain
it won't ever run automatically in the CWD because that's too unsafe
yes I know it was a typo but: Lightweight blac: now with less K
How?
black . --diff which works on the CWD
I'd recommend the black . --diff --color option first
just so you can see what it'll do first before actually touching your files
ehhh, color may not work on CMD
well we use colorama for that reason but I guess it can still go wrong even with that?
It says:
No Python files are present to be formatted. Nothing to do โก
Oh does the current directory have any python files?
No, not really
Well black operates on python files (so it can reformat 'em) so yea..
I switched directories and used Powershell lmao
To fix it
lol
I use
- powershell with a custom profile and starship
- pyenv for windows
- pipx
- black
in that specific order
And it works! It organized my code!
nice
yes, I know this is probably somewhat overkill
but highly recommend pipx for certain dev tools
pipx is amazing
I used to use this setup where my Python installation wasn't on PATH nor in a standard location and then I'd would manually symlink the scripts when adding a new global python tool but pipx does it way better ^^
that sounds... cursed
TL;DR the python command is symlinked to /opt/python3.8.5/bin/python3 which isn't on PATH
ah
via update-alternatives of course
you built python from source..?
yes sir-e
drwxr-xr-x - root root 21 Dec 2020 python3.6.0
drwxr-xr-x - root root 26 Oct 2020 python3.6.12
drwxr-xr-x - root root 16 Sep 2020 python3.7.8
drwxr-xr-x - ichard26 ichard26 9 Sep 2020 python3.8.5
drwxr-xr-x - root root 26 Sep 2020 python3.9.0b1
drwxr-xr-x - root root 24 Dec 2020 python3.9.1
drwxr-xr-x - ichard26 ichard26 9 May 12:06 python3.9.5
drwxr-xr-x - ichard26 ichard26 9 May 12:16 python3.9.5-support
these are my python installations
yeah I know the permission setup is dumb but oh well
>>> pyenv versions
system
3.10.0rc1
3.7.11
* 3.8.11 (set by /home/aru/discord-modmail/modmail/.python-version)
* 3.9.6 (set by /home/aru/discord-modmail/modmail/.python-version)
those are mine
pyenv >>> building from source
do you never delete old versions?!
Yeah, sometimes I need to test out stuff on 3.6.0
and not 3.6.12??
3.6.X was painful in terms of the typing changes
also why not, they aren't that big anyway
you should use pyenv
Maybe one day
mostly because you could write a quick and dirty script to install all python versions ever ๐
!paste
Pasting large amounts of code
If your code is too long to fit in a codeblock in discord, you can paste your code here:
https://paste.pydis.com/
After pasting your code, save it by clicking the floppy disk icon in the top right, or by typing ctrl + S. After doing that, the URL should change. Copy the URL and post it here so others can see it.
how would that work on linux?
does it build from source or use the system package repos?
List of pyenv supported python versions: https://paste.pythondiscord.com/apomokamed.txt
note: it was made for linux originally
builds from source
the one for windows downloads installers from the python.org website and installs them
I think it's 4095 characters on the newer Windows systems
>>> import os
>>> len(os.environ["PATH"])
2518
it is, yeah
!remind 16H figure out more details on that thing y'all been discussing
Your reminder will arrive on <t:1630178536:F>!
!pypi that
that's not what I was reminding myself about but sure
hehe
I don't want to share any details of this tho
let's just leave it at "we may or may not be planning events"
you do realise you could probably set the reminder in that channel then lol
although I presume you did it here intentionally
I'd missed out coverage of
in #2357
so here's a test case to cover it
From https://github.com/pre-commit/mirrors-mypy/issues/43 it looks like this should address the issue reported in https://github.com/psf/black/issues/2238#issuecomment-900231018
psf/black#2360 Any updates on this? I had a working fix for this, so wanted to know
I'm afraid not, we still would need to agree what to do with it exactly
^ isn't that just because of blank lines between import groups?
@dense jungle what is even going on, the case of you and I writing at the same time (although you type out a response faster than me :p) in reply to the same issue happened again
I guess we both got reminded of this issue when discord got a message when I merged the other PR? ๐
IDK, I just started going through my GitHub notifications. Moments before I looked over the PRs you merged haha
Huh, while looking at the imports I see this funky line: https://github.com/psf/black/blob/8b0680533420c2ea367860fcbb08df99317a6b44/src/black/__init__.py#L51
src/black/__init__.py line 51
from black.parsing import InvalidInput # noqa F401```
we should make a release for real today
Maybe because people were doing except black.InvalidInput: in third-party code?
ah yeah
let me run on our codebase just to make sure there's no regressions
I should've thought of that, I literally contributed code to the black playground that used black.InvalidInput ๐
Context?
And if you're referencing the name. Yes black is the tool's name, but it has no relation to the race. It's used as a reference to a color and a quote from Henry Ford (which admittedly is apparently a pretty questionable figure doing some research)
Is it worth pinning setuptools-scm?
I think we should pin it when it's being used at install time
Alright, I'll get it merged then.
I wouldn't mind driving the release process for this one, looks like our resident BRMFN aka Cooper is a bit busy :p
gurd darn it
sounds good! the run on our codebase completed and found no problems
whew 
!remind 30M r/agedlikemilk /s
Oh, I don't have permissions to write to the setuptools-scm PR's branch :(
how not
1โฏ git push -u https://github.com/FabianNiehaus/black.git FabianNiehaus/main
Enumerating objects: 9, done.
Counting objects: 100% (9/9), done.
Delta compression using up to 2 threads
Compressing objects: 100% (5/5), done.
Writing objects: 100% (5/5), 700 bytes | 700.00 KiB/s, done.
Total 5 (delta 3), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (3/3), completed with 3 local objects.
To https://github.com/FabianNiehaus/black.git
! [remote rejected] FabianNiehaus/main -> FabianNiehaus/main (permission denied)
error: failed to push some refs to 'https://github.com/FabianNiehaus/black.git'
not sure, but oh well I'll just comment what I'd like to see changed even tho I literally have a commit ready locally :/
heh, fork their repo and make a pull request
Im homeless but can do a release if we want
ichard said they wouldn't mind doing it.
And seems like you have some other stuff going on right now.... take care of your self regardless
Just fires approaching my home so Iโve left and gone to a friends. Itโs fine. Only a house. Can always get another.
smh
true, better than staying
Price of living in the Woods. @bright glacier - Hola if you need anything or want me to cut the PR for release. I have some time until 16:00 pacific today.
wait a sec, I can just open a new PR and then credit the original author so I don't have to wait for them ugh why did that take so long to cross my mind
even create a new PR with the original author's commits
Oh no! The Caldor Fire? Down here it's just smoke, hope your house survives
Ya ya, that's the winner. I'm in Oakland. So sorry to have the smoke follow me.
I'm not "technically" homeless yet ...
It's still there
so close! I just moved to Orinda
O nice. I'm going to Walnut Creek tonight to see mates.
Funnily enough Tahoe looks a lot clearer today but still AQI of ~200
https://wildwoodcommons.net - My driveway
Uh that's horrible, never lived on the west side so I've been disconnected from this disaster ๐
Seems the new norm in California
Yeah sadly enough, seems to be getting more common for BC over here too :(
lmao
Image updated every minute if Cooper's Internet is Up!
well that's a disappointing way to find out if it goes down
Description
The setuptools-scm dependency in setup.cfg did not have a version specified, leading to the issues described in #2449 after a faulty release of setuptools-scm was published. To avoid this issue in the future, the last version before that faulty update is now pinned.
richard's tweaks and comments:
Mostly since it's non-build-backend specific configuration and more
widely standardized file. Not sure what benefits pinning in setup.cfg
gives us on top of pyproje...
Here's your reminder: figure out more details on that thing y'all been discussing
[Jump back to when you created the reminder](#black-formatter message)
My house is totally over engineered + grafana'd everything. Even my fire place has graphs.
what are your specs?
I suppose this is what happens when I'm from Canada, but I'm looking at the temperatures here and the 30C+ I'm seeing is scaring me from going outside by a little bit :p Explains the heat warning tho!
For what?
your server running your website
this guy has multiple websites :)
lmao
This server could not verify that you are authorized to access the document requested. Either you supplied the wrong credentials (e.g., bad password), or your browser doesn't understand how to supply the credentials required.
Lovely error message, about the browser being dumb
O, that's just a Linode VPS running that shitty html and I have a systemd timer that (over a VPN) pulls the latest picture from the camera on my hosue
ah
oh lovely it just occurred to me that we planned to add a warning when formatting python 2 code.
we can push that off for 21.9b0 tho
what kind of warning?
a warning that support will be dropped or that python 2 should be dead but its your fault it isn't?
in more polite terms
"WARNING: black will drop support formatting for Python 2 $insert-date / $insert-in-X-releases"
ah
"WARNING: You are formatting what we wish to be the last remaining python 2 codebase. Please stop that."
"Why do you hate yourself enough to be dealing with python 2 still?"
"your business planned for this, right?"
the earliest that pyenv will install is 2.4
oh btw, I've been wondering. Why does a lot of stuff support 2.7 or exactly 3.5.3 ?
what was so bad with 3.0 to 3.5.2??
I wouldn't be surprised if they brought back compatibility shims in the bugfix versions. I don't actually know though, so don't quote me on this.
Before 3.5 python2 was faster than 3.X - 3.5 was the first real usable 3.X release
In many ways
aha
crap, I forgot to run prettier before commiting
...
everything feels wrong with this statement
huh?
why do you not use black to format black itself??
@stuck vapor whelp good job, you just saved me from a dumb mistake already :D
Check pre-commit rev in example..........................................Failed
- hook id: check-pre-commit-rev-in-example
- exit code: 1
Please set the rev in ``source_version_control.md`` to be the latest one.
Expected 21.8b0, got 21.7b0.
sorry, that was a but too abrasive
We use prettier for formatting everything else other than python code
like Markdown
๐ this made me smile, and more than I'm proud to admit
lol
all right pre-commit run -a passed, hopefully there isn't another problem
hm, what is action.yml?
other than my ability to type apparently
the definition and metadata for the official github action for black
ah
Description
Hopefully my first release doesn't end up in flames :fire:
Checklist - did you ...
- [x]
Add a CHANGELOG entry if necessary?I thought the release was the NEWS itself, no? - [x]
Add / update tests if necessary?Who needs tests when you got Quora's codebase? - [x]
Add new / update outdated documentation?No one reads them anyway, there's no point.
Add a CHANGELOG entry if necessary?I thought the release was the NEWS itself, no?Add / update tests if necessary?Who needs tests when you got Quora's codebase?Add new / update outdated documentation?No one reads them anyway, there's no point.
Got a bit sassy in the release PR :p
๐ about quora
we usually test the development version of black on quora's codebase to verify the code we might release isn't terribly broken
Remember that Jelle works at Quora?
docs/usage_and_configuration/the_basics.md line 176
black, version 21.5b0```
oh yeah I should add a check for that lol
except to be fair I'm a fan of non-existant versions on bug reports or related stuff
Jelle is going to be very annoyed or disappointed with me ๐ฐ .
that way when a person reports a bug, its obvious if they used the version already there or found their version
people don't like it when they can't control-C + control-P so yeah.. about that
why are they control p-ing?
its ctrl-v to paste
why are they printing the black docs
~yes i know it was a typo~~ ๐
Look, I'm driving a release at the same time, give me a break /hj.
~`if you're driving you should focus on the road~~
...i'll be back in a few moments when i don't want to respond with a snappy answer to everything
ok.
I'd prefer we just remove the version here (i.e. just put X's) or automate updating it. Keep this up to date is a waste of human time
or make it a fake version ๐
Yeah
Wait what Jelle is going to be very disappointed with me.
โฏ black --version
black, version 21.5b2
I thought my local user install of black was up to date ๐ฅ
I'm doing that right now.
i actually didn't know your black was pipx installed
I thought I had told you I moved to pipx yesterday?
i didn't put 2 + 2
okay I did some researching
21.5.24b as a fake version, since that's the day that black moved to this channel
Python 3.5.0 and 3.5.1 have some badness / missing stuff in their versions of the typing module. <3.3 was much harder to switch to from Python 2 (e.g. no unicode literals)
heck even typing's constant changes were an issue in 3.6.X
xref https://github.com/psf/black/pull/2458/commits/3231829914f808f6ad88209764ded41ab33319a8 , cc @ichard26
Did someone say..."we need a check for this"?
lmao
Thanks!
Yeah let's find some ways to get rid of manually updating those versions in the docs.
thonk
this is not a bug and is already supported, to 99%
https://pycqa.github.io/isort/docs/configuration/multi_line_output_modes.html
tldr the compatiable mode is 3.
The magic trailing comma handling is not supported in isort
Everything else is
Best to just use the black profile
How does black compare to VSCode?
It doesn't. VSCode is an editor and black is a code formatter
But you can use one in the other 
It is.
The black profile is just configuring other isort values
Ohhh wait. Okay, yeah.
I'm talking about magic trailing comma specifically
Yea
isort will put it in one line if it meets the line length limit while Black respects the existing trailing comma
causes a bit of churn in git diffs
Right
Hmmmm, how does the github action work
Thinking of switching to the action given that if it reports errors as annotations that would be nice
What kind of errors?
annotations don't support multi-line
Ex black . --diff
well, the GH Actions annotations that is
How would annotations be much better than just the coloured diff?
And printing the lines to the format which github expects for annotations
I think the API does support the mutiline annotations
They show up when you view the commits, I can find one that shows some flake8 annotations soon
Yea, but it's a linter so it's better suited to annotations
black doesn't operate on this formatting violations -> fix them model
it just formats the file to whatever the logic makes it
auto-fixing GH Action or app is probably better than annotations when it comes to code formatters
To get flake8 we pass flake8 a special format string for output, so when it outputs like that we can view it in the pr order
True
That'd be nice, ofc with an option to have it on or not.
Would 30 GitHub annotations all saying "this line / block of lines doesn't follow black's style" really be useful?
One per problematic file, OK, I can see the value in that, but that's simple enough to not really require first-party support.
especially this :P
but annotations are going to be more clunky than just having the action comment with a diff or having you manually go to the logs
Tbf that would be more useful big time
this is a GH App feature so not something for black maintainers to do though
I'm already hesitant to add a JUnit XML report mode to black and atleast that has some value, even if it's of limited value
3rd-party app could easily be made if one wanted it
but there's probably not enough demand if there isn't one already lol
a "technically" working example of this is pre-commit.ci
True
I can't exactly use that right now tho
It can't use local hooks ๐
(Yes I know how to get around that I just don't want to rn)
Well actually
I'm using it on one project right now, since I didn't feel the need to have a work flow, and because it only needs to lint, everything else about the repo is seperate, kind of a monorepo, if you will
I can't use it on black either unfortunately for that reason but oh well
So
The way to get around it is to set the skip variable in pre-commit-config.yaml, and skip the local ones-- this is documented on pre-commit.ci
kinda kills the value by still requiring gha to run the local hooks imo :/
true...
ooooo
Weird failure re. fuzz on 3.10-dev
๐
Traceback (most recent call last):
File "/home/runner/work/black/black/fuzz.py", line 10, in <module>
import hypothesmith
File "/home/runner/work/black/black/.tox/fuzz/lib/python3.10/site-packages/hypothesmith/__init__.py", line 3, in <module>
from hypothesmith.cst import from_node
File "/home/runner/work/black/black/.tox/fuzz/lib/python3.10/site-packages/hypothesmith/cst.py", line 18, in <module>
import libcst
File "/home/runner/work/black/black/.tox/fuzz/lib/python3.10/site-packages/libcst/__init__.py", line 7, in <module>
from libcst._exceptions import MetadataException, ParserSyntaxError
File "/home/runner/work/black/black/.tox/fuzz/lib/python3.10/site-packages/libcst/_exceptions.py", line 9, in <module>
from typing_extensions import final
File "/home/runner/work/black/black/.tox/fuzz/lib/python3.10/site-packages/typing_extensions.py", line 2390, in <module>
class _ConcatenateGenericAlias(list):
File "/home/runner/work/black/black/.tox/fuzz/lib/python3.10/site-packages/typing_extensions.py", line 2394, in _ConcatenateGenericAlias
__class__ = _GenericAlias
NameError: name '_GenericAlias' is not defined
hmmm
ah OK, I'm not actually too worried about it since everything else passes anyway including 3.6-3.9 fuzz
wait 3.10
huh?
cc @dense jungle know what's up here?
thats the issue for this
Maybe pin out typing-extensions 3.10.0.1 for now
i must have misread
Hopefully we'll be able to release a fixed typing-extensions soon
Or maybe I should yank the release
then again 3.10 is unreleased so maybe it's not worth it to yank
Is the impact widespread on 3.10-dev? In that case, pinning on black seems like a drop in the bucket
I think it breaks everything uses typing-extension in 3.10
ah I see it was recently released
whys the class defined for 3.10?
honestly I haven't really looked into what's going on
the fact that typing's CI was still on Travis and it just stopped working completely isn't helping
Yeah I saw that issue, looks like someone made a PR?
it needs some work
well looks like I'm not powerful enough to yank typing-extensions releases anyway
I can yank Black releases though
๐ that seems scary actually
you can make a release, but not yank it
don't worry I'll yank all of @bright glacier 's releases
