#black-formatter

1 messages Β· Page 14 of 1

bright glacier
#

Gee thanks! No worries, better done than never πŸ™‚

flat krakenBOT
#

Currently, Black uses a vendored version of lib2to3 for parsing. This works well for parsing Python 2 and early Python 3, but Python has now moved on to a PEG-based parser (PEP 617), and lib2to3 is no longer being maintained.

So we need a new parser. There are a few existing options that we could leverage (Parso, LibCST), but it's going to be a lot of work to do the migration. WE're d...

dense jungle
#

there you go

flat krakenBOT
bright glacier
#

@dense jungle do you want to do a quick lookover for the above docs PR or are happy with it (and I'll merge if so)?

bright glacier
#

whelp that's my answer lol.

dense jungle
#

I think it's good to go

plain atlas
#

hm, no checks passed/failed webhook sending?

bright glacier
#

I think the service that's handling the communication between GH and this channel is filtering that sort of messages out

plain atlas
#

ah, it isn't being sent directly to a discord webhook then?

bright glacier
#

That would be way too noisy since there's pretty much no filtering configuration on their side

plain atlas
#

uh lemme view the source

#

workers#1

toxic stormBOT
bright glacier
#

You get to choose "no webhook", "push events", or "or let me know of everything" IIRC

delicate marsh
#

yeah, that's not handled in the worker source @plain atlas, that's just disabled in the repo πŸ™‚

bright glacier
#

Well it turns out I was wrong on the last option, but overall, you don't get much choice πŸ™‚

plain atlas
#

ah lol

bright glacier
#

Completely OT but I'm developing the ability to just know where to add line breaks in the little commit message box GitHub gives you when merging. I managed to nail the 72 character rule of thumb without checking somehow.

bright glacier
#

I think 2 is safe to land (although it needs a review), 1 might be okay although I have no real experience in this area, and 3 seems like it's awaiting discussion on our support policy for Python 2.

bright glacier
#

Although it definitely could be possible 3 is OK and I just managed to miss all of the relevant discussion. IIRC Cooper said they wanted to get it in.

flat krakenBOT
bright glacier
#

Thank you for the review @dense jungle !

errant barn
flat krakenBOT
lament crow
#

Sooo after trying to contribute I've noticed some small issues with local testing:

  • pre-commit run --all-files fails because src/black/output.py has one line that exceeds the line length
    • perhaps this command should be included in CI to stop a PR that would break this requirement? This was it wouldn't affect a contributor who hasn't actually done anything wrong.
  • tox -e py is failing on the optional no_python2 test when I run it locally. I followed the contributing guide (the pipenv way) from Black's docs (https://black.readthedocs.io/en/stable/contributing/the_basics.html) before I was running any testing so the way I installed shouldn't be a problem? perhaps something causes the typed-ast dependency to be installed? Testing on Windows

I ignored both of these since I knew neither of these problems were caused by me but I just wanted to share some feedback as first-time contributor

errant barn
toxic stormBOT
lament crow
#

I'll add later if I don't forget lol

#

Or I could, just copy-paste now I guess

#

Done, thanks for linking the right place to put it on

flat krakenBOT
tribal thistle
lament crow
#
Ξ» pre-commit run --all-files
black....................................................................Passed
flake8...................................................................Failed
- hook id: flake8
- exit code: 1

src/black/output.py:48:92: B950 line too long (91 > 80 characters)

mypy.....................................................................Passed
prettier.................................................................Passed
tribal thistle
#

Could you try running pipenv run flake8 in the root directory?

errant barn
#

Ah is it another case of psf/black#2299

toxic stormBOT
tribal thistle
#

Sorta, my best guess is it isn't using the correct flake config

#

We've run into this a lot in #dev-contrib because our setup has a ton of plugins, and people would usually be running their own flakes without them

#

Hmm not sure that's it anymore. I couldn't repro it

#

I tried with 39

errant barn
#

It does say that the line length limit is 80 though

#

So something's fishy. Any updates @lament crow?

#

But now that I think about it, I don't think I've had problems running other than Black with precommit even though I have basically nothing installed on the system interpreter

lament crow
#

ah sorry

#

forgot

errant barn
#

And the linked issue was about not finding black..

lament crow
#

running pipenv run flake8 in root is wrong because that runs it on tests data as well

#

so I've got a big wall of errors :P

#

a wall that is apparently so big that I'm past console's history buffer

#

but anyway

#

line length limit is 88, right?

#

so 91 is still past 88

tribal thistle
#

88 + 10%

lament crow
#

80+10%

#

or 79

tribal thistle
#

I should better explain

lament crow
#

it's a bugbear thing

tribal thistle
#

the specified length is 80, bugbear adds 10% on it's own

#

ya

errant barn
#

Oh so it doesn't show in the error, the increased line length?

lament crow
#

well, 80+10% is 88 so however we look at it, 91 is higher

errant barn
#

yea

lament crow
#
        for lineno, line in enumerate(self.lines, start=1):
            length = len(line) - 1
            if length > 1.1 * self.max_line_length:
                yield B950(lineno, length, vars=(length, self.max_line_length))
errant barn
late dewBOT
#

src/black/output.py line 48

# See https://www.gnu.org/software/diffutils/manual/html_node/Incomplete-Lines.html```
errant barn
#

It's within line length for me though nvm, it's not

tribal thistle
#

Funny enough, I can't get any length to trigger it

#

What other flake8 rules are there to break

lament crow
#

only pre-commit config does

errant barn
#

(does discord have strikethrough MD?)

tribal thistle
#

~~something~~

lament crow
#

not that this is the issue here

errant barn
#

yeah the line is longer than it should

tribal thistle
#

So flake definitely works, just not for this rule

#

Which is

#

interesting

errant barn
#

I'm proper confused now :D after removing .flake8 I can lint the file and it does complain

lament crow
#

do you run flake8 with cwd of the project root?

errant barn
#

Ah, E501 is the very line len error that is ignored in the config

lament crow
#

oh ye no

#

I'm getting the B950 one

errant barn
#

Yep, for some reason it doesn't trigger

tribal thistle
#

Actually, all B9 errors aren't triggering for me

#

I wonder if it's a bugbear bug

errant barn
#

the difference in this was the exclusion

lament crow
#

exclusion?

#

you removed it from .pre-commit-config.yaml?

errant barn
#

Exclusion of E501 in .flake8

lament crow
#

huh

errant barn
#

I think it's time to MWE this up :D

tribal thistle
#

Hmm

#

do you have a clean environment to test bugbear?

#

If so, do you get any errors on this:

class Test:
    def abc(xyz):
        pass

This should in theory be failing, but I can't get it to fail

errant barn
#

Yeah that fails

tribal thistle
#

Does it fail in black

errant barn
#

No!

#

Also I couldn't repro the line length issue alone

#

Even when straight up copying the file

tribal thistle
#

Seems bugbear isn't working at all

bright glacier
#

Completely lost at what is going on really but does flake8 even recognize bugbear?

#

Does flake8 --version include bugbear?

errant barn
#

yup

tribal thistle
#

3.9.2 (flake8-bugbear: 21.4.3, mccabe: 0.6.1, pycodestyle: 2.7.0, pyflakes: 2.3.1) CPython 3.9.4 on Windows

bright glacier
#

OK that's the end of me being useful since I'm on my phone πŸ˜…

errant barn
#

The interesting thing would be why did it work for Jackenmen then

lament crow
#

ye, I do find it interesting it only works for me lol

#

actually, I'm gonna check one thing in a sec

errant barn
#

Normally it's the bug that can't be reproduced, not the other way around :D

lament crow
#

ye, I found the reason it works differently for me

#

I do have a "global" flake8 config

#

since if a project doesn't have one, I like to have sensible defaults

#
[flake8]
max-line-length = 88
select = B,C,E,F,W
ignore = E203, W503
errant barn
#

Could you share that?

#

Perfect

lament crow
#

but project-specific one should override it

#

well

#

extend it

errant barn
#

Yeah..

lament crow
#

extend-ignore seems to be what's causing the issues here

#

like, if you replace it with ignore then it works fine (as in, fails) in CI

errant barn
#

But it doesn't ignore any bugbear errors πŸ€”

lament crow
#

Bugbear's opinionated warnings require explicit selection.

#

so perhaps it doesn't work well with extending smh

#

perhaps bugbear in some way adds into the default ignores

errant barn
#

would you try removing your select?

#

and maybe set the line length to 80

lament crow
#

I did, bugbear still fails for me

#

only thing that matters is the ignore

#

if I remove that from mine, then it works

errant barn
#

Black's ignore you mean?

lament crow
#

mine

errant barn
#

right

lament crow
#

if you replace Black's extend-ignore with ignore then it also works so it's really something about the extending working in unexpected way

errant barn
#

So for some reason the extend-ignore is handled in some odd ways

#

Yeah

#

YAY a reproduction!

#

Paste your config in a fresh environment, then call flake8 file.py --extend-ignore=E501

#

And actually, having an empty configuration named .flake8 and calling like above produces that same situation, whereas without it bugbear errors are still selected

lament crow
#

I'm confused, did you reproduce it yourself or do you want me to do something lol

errant barn
#

Which I'm not sure should happen either, since B9XX is opt-in if I remember correctly :D

#

Yeah I did

lament crow
#

btw, this is in bugbear's code

    @staticmethod
    def add_options(optmanager):
        """Informs flake8 to ignore B9xx by default."""
        optmanager.extend_default_ignore(disabled_by_default)

...

disabled_by_default = ["B901", "B902", "B903", "B950"]
errant barn
#

Yeah this is just getting more complicated by the minute :D

lament crow
#

I don't know why this default ignore doesn't actually do anything when I don't have a "global" configuration file with ignore in it but well

#

Do you plan on reporting that on flake's repo or should I look into it

#

maybe at least we will get a clearer answer lol

errant barn
#

I think we should really nail down a list of different situations and the behaviors

#

Because this is confusing as hell

#

I'll reset my venv and start from scratch

lament crow
#
  1. Install flake8 and flake8-bugbear
  2. Put this into a ~/.flake8 (or %userprofile\.flake8):
[flake8]
ignore = E203, W503
  1. Create a simple project directory with .flake8 file:
[flake8]
max-line-length = 80
extend-ignore = E203, E266, E501
select = B,C,E,F,W,T4,B9
  1. Make a test.py file:
# very long comments, which is certainly longer than 88 characters which is what bugbear should error on
  1. Run flake8
  2. See results (or rather, lack of any)
#

now that I wrote this, I need to actually see if I can reproduce it like that :D

#

oh wait, it was the other way around, right

#

so it's not a bug

#

because bugbear extend default ignores

#

which you guys extend further

#

so it's black's config fault after all, yay

errant barn
#

I have to go for some time but I'll get back to this

#

Or I'll have to go soon, but in the meantime I can't get flake8 alone to complain about line length

lament crow
#

flake8 alone, you mean without bugbear?

errant barn
#

yeah...

lament crow
#

are you ignoring E501

errant barn
#

nowhere, also explicitly selecting every error

lament crow
#

oh right

#

pycodestyle is disabled by default

#

from bugbear's readme:

Note that pycodestyle also has a bunch of warnings that are disabled by default. Those get enabled as soon as there is an ignore = line in your configuration.

#

:D

errant barn
#

Yeah, flake8 file.py --select=C,E,F,W does nothing

lament crow
#

what what

errant barn
#

flake8 file.py --select=C,E,F,W --ignore=E001 does work

lament crow
#

I should have quoted more:

I think this behavior is surprising so Bugbear's opinionated warnings require explicit selection.

#

YE, I think it's surprising too!

errant barn
#

Yeah, but I'm still on the flake8 only errors :D

#

I'd expect selecting the damn errors is enough

lament crow
#

ignore takes priority over select

errant barn
#

Maybe I'm just confused, if I'm ignoring nothing, shouldn't and explicit --select=E select all E-class errors :D

lament crow
#

are you ignoring nothing though?

#

because not saying you ignore something equals ignoring defaults

#

confusing, I know :D

errant barn
#

that's sooo dumb xD

#

--ignore= works too

lament crow
#

I'm not going to say it's dumb because I'm sure there must have been some reason to do it that way

#

but I sure can say it's confusing the hell out of me lol

errant barn
#

Yeah most probably

#

But kay well we'll move on from this

lament crow
#

so basically, you guys need to use regular ignore or else you run into surprising behaviors of flake8

errant barn
#

OOOH everything clicked!

#

I see now :D you're the best dude

lament crow
#

I'll look into making a PR considering I already spent time on this anyway lol

errant barn
#

Yeah that would be much appreciated

bright glacier
#

and I'm still thoroughly confused, looks like I will have to read over this chat a few times over at least

errant barn
#

Having the extends is convenient, but I guess it's better to enforce a list, people can then extend on the command line

bright glacier
#

anyway, great work y'all

flat krakenBOT
flat krakenBOT
#

Describe the bug

INTERNAL ERROR: Black produced different code on the second pass of the formatter.

The first bad commit is https://github.com/psf/black/commit/586d24236e6b57bc3b5da85fdbe2563835021076 according to git bisect.

To Reproduce

Take this file:

def test(self, othr):
    return (1 == 2 and
            (name, description, self.default, self.selected, self.auto_generated, self.parameters, self.meta_data, self.schedule) ==
            (name, description,...
lament crow
#

πŸ‘€ I just noticed that your changelog entry check doesn't duplicate despite having label as an event

#

did GitHub finally fix it :o

flat krakenBOT
tribal thistle
#

I wonder why it was using extend in the first place

errant barn
#

For CLI usage I would imagine

tribal thistle
#

Would that be something not worth keeping then?

errant barn
#

I mean, ignore in config and extend in CLI is functionally similar to extend in config and ignore in CLI

tribal thistle
#

What's been done seems like the best solution currently possible, but it seems the most ideal solution would be getting flake8(-bugbear) to support extend

#

Alright, sounds good

tribal thistle
#

On a slightly different note, does anyone review PSF projects locally? I wasn't able to submit my review due to oauth apps restrictions

lament crow
#

gh cli?

dense jungle
tribal thistle
#

pycharm, but I imagine the cli would suffer from the same thing

lament crow
#

you could use a PAT instead of oauth authentication as a workaround

tribal thistle
#

That would probably work, but pycharm signs out on restart, which would mean generating a new token every time I start it up

lament crow
#

I would tell you to just make an oauth app request, I would assume nobody's going to come to your home and murder you for it, maybe they just won't accept :)

tribal thistle
#

Hahaha

lament crow
#

but then again, I'm not part of PSF

#

or a PSF project

#

so maybe they do murder

tribal thistle
#

Anyways, it's just clicking the submit button that needs to be done on site, so it's probably not a big deal

#

Oh, I take that back

flat krakenBOT
lament crow
neon loom
#

Wow - much activity

bright glacier
#

What are we waiting for @neon loom in terms of new release?

#

Or are you hoping I know so I can let you know so we do a release?... cause in that case, I don't exactly know. psf/black#2319 seems OK but I have no real skills in this area of the codebsae.

toxic stormBOT
errant barn
#

Yeah it seems to be okay, my last comment can be ignored for now

neon loom
#

I’ve just been waiting for a slow down in action to draw the lone in the same personally

bright glacier
#

lol

neon loom
#

*line in the sand

bright glacier
#

blame the apple

#

it's not "an apple keeps the doctor away", it's actually "an apple causes a breakout of typos"

errant barn
#

Named escapes could be good since it's related to the string processing

bright glacier
#

(for context, cooper has an iphone)

bright glacier
#

Oh right, I think that's Jack's first contribution so it's time to bust out my saved reply... Well sorta, I mean, they saw the "improving the contributing experience" issue already.

#

I'll just say thank you as always πŸ˜„

errant barn
#

Also if you're still looking for easy wins, the AST errors just need a decisive mypy guru ;) but the impact is minimal though psf/black#2304

toxic stormBOT
bright glacier
#

TBH, I've been hesitant since I may end rewriting the whole the module during my mypyc work.

errant barn
#

Oh!

bright glacier
#

But it's not 100% likely so I'll merge I guess.

#

Honestly I'm a fan of asserts for this sort of things.

errant barn
#

Yeah consider it done, gimme a minute

bright glacier
#

I was just gonna check it out and do the changes myself and push but that also works πŸ™‚

#

My GitHub Notifications are always a mess, I can never keep my inbox empty πŸ˜‘

tribal thistle
#

Someone once told me β€œselect all -> mark read”, and get a fresh start

#

Ofc I didn’t but oh well

bright glacier
#

"View all 164 notifications" - oh how fun

tribal thistle
#

How do you even have that many lol

#

Are you subscribed to a bunch of things?

bright glacier
#

I watch two repositories and have a bad habit of not clicking "done".

errant barn
#

Oh actually, the assert doesn't work, so should we go with the test instead?

bright glacier
#

It's psf/black and pypa/bandersnatch by the way.

errant barn
#

still produces the error

#

but moving to the if doesn't

bright glacier
#

............

errant barn
#

Yeah fun

#

So maybe we'll go with that since you're already working on it and type: ignore seems kinda bad

#

pushed

lament crow
lament crow
#

I get email notifications and I kinda don't have time to mark those as done on GitHub

bright glacier
#

Ooo I wonder if typeshed's overloads for ast.parse don't have version based conditionals

errant barn
#

But how would that change assert vs if? πŸ€”

bright glacier
#

actually let's just move on, I don't know what I am saying πŸ˜…

#

yeah typeshed does have the version based conditionals anyway

#

wonder why the assert doesn't work then

errant barn
#

Yeah seems weird since it's equivalent in the code flow

neon loom
#

So we trying to get that 1 more PR in for the push? I think I'm gonna merge my own primer STDIN as it hurts nothing, is fast and might catch something one day ...

plain atlas
#

or was that third person?

bright glacier
#

very much third person I believe

plain atlas
#

Ah, aru is sorry he didn't understand. πŸ˜„

errant barn
#

Yup checks passed! Feel free to mrrg

bright glacier
#

Richard hates your usage of third person /s

plain atlas
#

Felix just passed checks

bright glacier
#

That sounds like Felix was sus for something out of context πŸ˜…

errant barn
#

All the checks: health, IQ, not-a-pedo, you name it

bright glacier
#

Uhh, strange reference but OK

errant barn
#

Am I going too far again :D

#

Maybe it's time to dial it down again

plain atlas
#

Purple name, check
Too far, check

errant barn
#

:E

#

Yeah I might consider acting like someone responsible

plain atlas
#

Contributor of black, check

bright glacier
#

It's like saying "I'm no criminal...", sounds suspicious doesn't it :p

errant barn
#

:D trust me, I'm trustworthy

neon loom
#

What is acting responsible?

plain atlas
#

Lol

#

who

plain atlas
#

And follows black too

#

Definitely 100%

#

I'd never write code in a different style ever

errant barn
#

Aaanyways, the thing before all this stuff: merge and then release?

plain atlas
#

Oops sorry for derailing the channel lol

bright glacier
#

I certainly without a shred of doubt am the most qualified person to lead the psf/black project. My experience goes far beyond the skyline into outer-space. My knowledge runs deep, as deep as the ocean. I have the will of 1000 developers... OK that's enough of me being ridiculous lol (so much /s)

neon loom
#

Yeah, I'm defering to @errant barn + @bright glacier to declare when release is wanted and I'll do the few clicks

neon loom
plain atlas
neon loom
#

returns to $dayJob painful work

plain atlas
errant barn
#

Naah, just the next beta release

#

Eventually? Yeah

plain atlas
#

Ah, whew

neon loom
plain atlas
#

Whew :+1:

neon loom
#

Then get experimental string formatting on by default. Then we can discuss the stable

plain atlas
#

Good, good

bright glacier
#

Hmm, the stable tag only includes changes before and on May 10th even though the newest release is from May 31st

neon loom
#

O yeah, I never moved that.

#

I dislike that tag. We need to automate it somehow. lol

flat krakenBOT
bright glacier
#

The only thing I'm not sure about with the AST PR is this:

#

Also, target versions include Pythons all the way from 3.3. Should they be here (and in the version list below) too?

errant barn
#

Yeah that's fair

#

I initially removed them because they overlapped with the typed_ast versions 6 and 7

solid adder
#

Open a bakery in Provence

#

Or buy a fishing boat in the Maldives

#

OK that's enough silliness from me, I get seasick real easy

plain atlas
#

Ah yes. I knew changing notifications to all messages for this channel would be a bad decision. Too much fun stuff happens here, and it's distracting in a good way πŸ™‚

bright glacier
#

You can never have too much fun

flat krakenBOT
bright glacier
#

I am not the biggest fan of pastries tbh

dense jungle
#

that's almost as bad as using tabs for formatting

plain atlas
bright glacier
#

It's a reference to ambv's (maybe dream) of running and starting a bakery in southern france

flat krakenBOT
errant barn
toxic stormBOT
lament crow
#

I call myself "the bug magnet"

#

:P

solid adder
#

I'm fetching a package

flat krakenBOT
bright glacier
#

actually I was wrong in that PR review

#

the bandersnatch issue is similar but not the same 😞

#

sometimes checking before doing something is better ay

plain atlas
#

uh--
should the docker workflow only run on pushes to main?

lament crow
#

yes

#

you don't want the branches created on psf repo to be pushed to dockerhub

plain atlas
#

ah, it already runs on main only

#

good

lament crow
#

also iirc, to keep the ambv/black->psf/black redirect, Łukasz needs to make branches on psf/black repo and can't use the fork I suppose

#

unless GitHub changed something

#

a bit annoying that you can't choose a fork name if you ask me :P

bright glacier
#

I'm pretty sure that's current behaviour ATM still

plain atlas
#

yeah it sucks

#

if ambv were to ever press the fork button it will break the redirect.

#

because it will just fork without asking if you really meant to fork ;-;

lament crow
#

unless you have repo creation access on a different org

bright glacier
#

Well, sorta

lament crow
#

in that case you have a popup

plain atlas
#

true

bright glacier
#

yep!

lament crow
#

where you have to choose where you want to fork

plain atlas
#

unless its already forked there

#

then i'm not sure

lament crow
#

it still asks

bright glacier
#

I considered adding a conditional to block the docker workflow from running if the test workflow fails, but I suck at conditionals so yeah no. Also, the chances of people pushing directly to main with breaking changes is low, right?

lament crow
#

do you guys use protected branches?

errant barn
#

Yeah seems reasonable

bright glacier
lament crow
#

ah well

plain atlas
lament crow
#

could make sense to make a dep then if someone does push stuff directly to main

errant barn
#

Using them could be a good thing though, since we have a reasonable number of people available for review

plain atlas
#

not using protected branches is a bad idea imo

#

means that anyone with push access can just push to main

bright glacier
bright glacier
errant barn
#

That's convenient to be fair

bright glacier
#

protected branches would obviously help but not 100% block danger

lament crow
#

you can make github releases with just write perms anyway

bright glacier
#

Well I consider PyPI releases to be a lot more meaningful than GH releases πŸ˜›

#

I think it's worth bringing up with the rest of the core team later

plain atlas
#

this is a portion of the required status checks on my repo

lament crow
#

don't your gh release workflow push to pypi?

plain atlas
bright glacier
plain atlas
#

🀦

lament crow
plain atlas
#

i legit just looked at my own repo's workflows to see what black had

lament crow
#

that would then actually require a review before push

bright glacier
plain atlas
#

where is the guide for this

bright glacier
#

I gave up on environments when it didn't work with github pages

lament crow
#

it's in beta rn

bright glacier
#

but I think that's just something specific with pages

plain atlas
#

to note, i'm pretty sure you don't need that to set up automatic pushes to the other stuff and yada yada

lament crow
#

environments are additional layer of security

bright glacier
#

@errant barn @dense jungle while I have your attention, would it be worth implementing (or discussing) stronger requirements / protections for pushes (direct or merges) to main?

lament crow
#

it depends on the project but imo it's not always that great, especially if you want to release a hotfix

#

and nobody's around

dense jungle
#

Don't feel a strong need for changes. @solid adder actually likes to push straight to main

#

as far as I can tell

lament crow
#

but generally, it's quite cool, just not for everyone's tastes

dense jungle
#

I'd like to be able to merge my own PRs without review if I feel it's urgent

bright glacier
#

I think protecting the PyPI upload might be a good call but in general I don't care about the rest

dense jungle
#

(if you disagree later we'd be able to revert)

lament crow
#

repo admins can overcome the branch protection

plain atlas
#

^

lament crow
#

I don't know if you are one though

dense jungle
#

none of us are repo admins I believe

#

maybe Lukasz is

bright glacier
#

well he is one but even his powers are limited due to the repo being under the psf org

lament crow
#

they're not limited by much, he can't block people from the repo since that can only be org-wide but pretty much anything concerning the repo can be done by repo's admins

errant barn
#

Yeah I think it's a good idea, but I'm not against the current flow since it seems to work. The Encode org (responsible for HTTPX and Starlette and such) has used it to a great effect, since they give write access for essentially all contributors. But here I don't think it's essential

lament crow
#

oh and he can't remove the repo :3

plain atlas
bright glacier
errant barn
bright glacier
#

lol

lament crow
#

Yeah, it's a bit meh, but sadly GitHub only has global blocking

bright glacier
#

in that case, I would consider myself a part of pypa/pip

plain atlas
#

aa, i find httpx pretty nice but one thing is very wonky to me lol

bright glacier
#

cause I made one docs commit

lament crow
#

per-org/user

plain atlas
#

i'm also surprised that starlette still uses requests and not httpx for the test client

dense jungle
#

I contributed one space to PHP, so I'm part of PHP

errant barn
#

But my point was that the branch protection works for them since they have a massive amount of people with write access, but for us not as much

lament crow
#

well, there are different kinds of protections

#

you don't have to require reviewers

plain atlas
#

^

lament crow
#

you could just require passing status checks

plain atlas
#

the minimum that branch protection does is just prevent deleting the branch and pushing directly to main

bright glacier
#

gh blocks you from deleting the default branch right lol

lament crow
#

the minimum is preventing force-push

bright glacier
#

I'd hope so

plain atlas
#

but repo admins override that anyways

plain atlas
solid adder
#

Yeah I sometimes push to main but not when code changes are involved. But changing docs or tests esp. for some typo or inclusion of a new sentence (or testimonial by zzzeek πŸ˜‚) I'd just do in main for convenience.

But if we find that we should protect main then I'm fine with that.

lament crow
#

well, then minimum is nothing lol

plain atlas
#

no, minimum prevents pushing directly to main

#

that's all

lament crow
#

it doesn't

#

I have branch protections that just prevent me from force-pushing

bright glacier
#

I mean, admins powers are supposed to be not given out like candy lol

plain atlas
errant barn
lament crow
#

yes, but I include administrators in the protection

solid adder
#

Fun fact, in cpython I have to push the merge to the release branch for the signed tags to remain immutable. So I would untick "include administrators" every release I'm making for a single push.

#

But our release workflow in Black is much less involved so this problem doesn't really exist here

plain atlas
bright glacier
#

I have never used code owners

lament crow
#

yeah, it's quite granular

plain atlas
#

turning that off and this off allows pushes to main

lament crow
#

I use code owners but not the requirements of the review from code owner

bright glacier
#

Also, y'all use dark mode for GH? I'm still using the light theme

lament crow
#

I use the extension for that

#

I don't like the one that GH has

plain atlas
lament crow
bright glacier
lament crow
#

I still have it set to dark in case I decide to open it in mobile browser

bright glacier
#

and because I can't stop myself from being even more hated, I also use light mode for discord πŸ˜›

lament crow
#

I'm wondering how the new high contrast ones will look

bright glacier
#

now that's a threat πŸ˜‰

lament crow
#

:)

bright glacier
lament crow
#

wow

#

rude /s

plain atlas
#

believe it or not, I use VSC with the github dark theme

bright glacier
#

"why you gotta be so damn rude" or how ever that song goes just popped into my head lol

lament crow
#

I don't use VSC 😬

#

I wanted to

#

repeatedly

plain atlas
#

Β―_(ツ)_/Β―

#

all of my stuff is ssh so i use vsc

lament crow
#

but there was always some small thing that annoyed me when I tried to switch and I went back to Sublime

plain atlas
#

this channel is no longer about black, this is the community within the community

bright glacier
#

it's the monkeys within the community

errant barn
#

Yeah we're going off road and fast :D

lament crow
plain atlas
bright glacier
#

Developers and users of Black are invited to use this channel for discussions on the development and usage of the tool.
Yeah screw that. πŸ˜„

plain atlas
#

Developers and users of Black are invited to use this channel for discussions.
FTFY

lament crow
#

hey, to smoothly develop the tool, we need tools like GitHub!

bright glacier
#

cooper is waiting on us (me and felix) to declare black ready for a new release and he's gonna come back and discover that we have been -100% productive

lament crow
#

or well, text editor :D

plain atlas
#

fwiw @lament crow, i find sublime better than n++

lament crow
#

aaand that's why you shouldn't do ETAs in OSS, takes the fun out of it :)

errant barn
#

I'm just waiting on Wu-cash to receive his package

lament crow
plain atlas
#

because i really hate one thing about sublime

#

this is n++, @bright glacier will love it

bright glacier
#

I actually used to use N++ when I still used Windows

plain atlas
#

this is sublime

lament crow
#

there is a light mode in sublime

bright glacier
#

I switch my VSC theme like every two weeks

silent apex
#

Saaaame

plain atlas
#

and why i hate sublime is visible in the screenshot above

#

you might not see it

bright glacier
#

I'm currently using "Solarized Light"

plain atlas
#

UNREGISTERED

#

i hate that text πŸ˜”

#

and I won't register it either

lament crow
#

then buy it

plain atlas
#

so we have a stalemate here

lament crow
bright glacier
#

although I am a big fan of Notis themes too for VSC

lament crow
#

Mariana

errant barn
plain atlas
lament crow
#

that's not that much for 3 years

bright glacier
#

"hey google, translate 99 freedom dollars into maple surup dollars"

lament crow
#

I'm actually disappointed google doesn't answer to that properly

plain atlas
# bright glacier "hey google, translate 99 freedom dollars into maple surup dollars"
Mail Online

The national treasury released a new polymer bank note in November 2011, and they have received hundreds of emails from residents who are convinced that the bills have an added fragrance.

bright glacier
#

omg I found this awesome wiki article

lament crow
#

honestly, Netflix subscription costs more than Sublime if you split Sublime's cost into months :P

lament crow
#

well, buy one coffee less per month or sth?

bright glacier
#

Coffee is bitter.

plain atlas
#

nope i buy very few things lol

silent apex
plain atlas
#

i mean

lament crow
#

if you're happy with your editor then sure

plain atlas
#

pycharm and sublime are both free i think

#

just they remind you to pay them 😦

bright glacier
#

Nagware IIRC

errant barn
bright glacier
#

Vive le Canada!

lament crow
#

no nagging

#

pro is paid, probs with like 30 days trial

plain atlas
#

so this is my vsc theme

tribal thistle
#

Pycharm pro is free if you have the right connections 🀑

lament crow
#

Sublime Text technically has this clause:

Sublime Text may be downloaded and evaluated for free, however a license must be purchased for continued use. There is currently no enforced time limit for the evaluation.

plain atlas
lament crow
plain atlas
silent apex
bright glacier
tribal thistle
#

you can convert currency directly here

lament crow
#

did you mean winrar

tribal thistle
#

.wa short 100 freedom units to goose

toxic stormBOT
plain atlas
#

LOL

tribal thistle
#

Close enough

bright glacier
lament crow
#

lol

bright glacier
#

can't spell lol

plain atlas
bright glacier
plain atlas
#

here i ran it on a bot that returns the errors lol

bright glacier
#

it doesn't understand freedom

#

oh no

#

we're screwed

errant barn
#

turns out WolframAlpha servers contain oil - the foreign ministry

bright glacier
#

ok it's american enough then

#

.wa what is canada

plain atlas
#

@tribal thistle when can sirlancebot allow the command in this channel πŸ₯Ί

bright glacier
#

it's not necessary honestly

plain atlas
#

personally lance and @late dew have the worst errors

tribal thistle
#

I honestly don’t even know what’s filtering it

plain atlas
#

like, one of them deletes the invoke, the other doesn't

tribal thistle
#

.wa what is canada

#

Wa does not know

toxic stormBOT
plain atlas
tribal thistle
#

Wdym?

plain atlas
#

it doesn't allow the partners to use the cmd here but since you are staff it allows you to use them here

tribal thistle
#

I know that much, I don’t know if it’s a whitelist or a perm problem

plain atlas
#

ah

#

whitelist i think

bright glacier
#

"Canada is home to overilypolite maple syrup eating bearded axe wielding lumberers who say 'a-boat'"

#

may be true or not, I cannot confirm or deny

tribal thistle
#

Can you confirm?

#

Ah

errant barn
#

@bright glacier To bring it back on topic once more, I think I'll call it a night. IMO the AST error messages don't have to be in the release since the impact is so small, so feel free to ask Cooper to release.

#

I've had heaps of fun tonight though :D thanks everyone!

bright glacier
#

Alright, sounds good. Sleep tight and don't let the bed bugs bite πŸ˜†

plain atlas
#

yeah, imma head out too

#

typescript and rust await

#

or, await typescript and rust

solid adder
#

Commented on the PR

neon loom
#

*on

bright glacier
#

I feel bad for Felix, his review circles are only dull greys, no pretty green or sharp reds :/

plain atlas
errant barn
#

Any Vim plugin wizards here? We've been considering (re)moving our Black plugin for a while now. It's in poor condition and none of us really works on it. Would love to hear from you! psf/black#2027

toxic stormBOT
tired shard
#

echos godlygeek ||using vim for than 15 years iirc||

bright glacier
#

I guess at that point you would have used a ton of plugins. Personnel I use vim as my lightweight editor (VSCode for anything complex) and I have zero plugins (that might change once I finally upgrade my vim config). It's been like a year and a half of vim so far.

indigo depot
#

i just use the terminal to run black in vim Β―_(ツ)_/Β―

tired shard
#

yeah same

glad pilot
#

I know vimscript well. If you're looking for help bringing the plugin into a supportable state, I might be able to help.

errant barn
#

Aye, that's great to hear!

errant barn
bold sierra
#

is this where the smart people talk?

glad pilot
#

You may know me from here as a mod, or from Black as the guy who complained loudly about Black changing docstrings in a way that changes the AST. Other than that, maybe a mailing list or something πŸ™‚

#

I'm familiar with Black as a user, but I've never poked into its implementation at all.

#

I'm moderately shocked to learn that it has a vim plugin - never knew that, and it seems... odd

errant barn
glad pilot
#

yep, that'd be me. I came on a bit strong, I think, heh

errant barn
#

no worries, strong personalities are needed too

errant barn
bold sierra
#

Haha nahh bro

#

One day maybe

errant barn
glad pilot
#

the existence of a vim plugin is totally reasonable - I use a neovim plugin that has a mapping for running Black. Maintaining it first party as part of the Black repo seems like an odd choice, though - especially if none of the Black maintainers have much vimscript expertise

errant barn
#

Yeah πŸ˜… hence the discussion to drop it

dense jungle
#

Yes, we're not too happy about it either. Theoretically it has benefits for discoverability but not sure it works well in practice

glad pilot
#

it seems to not be mentioned by the README.md, so I'm not sure how discoverable it is in practice.

#

if you decide you want to keep it, I probably can help you work through the open PRs. Nothing stands out to me as too complicated.

errant barn
#

Another option we discussed was pulling it out in a dedicated repo or combining with some existing plugins

glad pilot
#

I'm a bit unclear on how users would even install this plugin. I guess they could point a vim plugin manager at the Black repo - the plugin manager would clone the repo into one of vim's runtime customization directories, and vim would see the autoload/ and plugin/ directories and use them as a vim plugin - and there would just be a vestigial copy of Black that's also there and not used for anything

glad pilot
#

Plug 'psf/black', { 'branch': 'stable' } - so, yeah, that works the way I just said. They clone an entire copy of the Black repo, and only use 2 files out of that clone πŸ™‚

#

or maybe 3, if there's a help file I haven't spotted

#

Well, I dunno - if you guys decide you want to maintain it, I can probably help you maintain it, but I think there's a plenty good argument for not maintaining it and making it the problem of someone with more expertise.

And on the other-other hand, if you do remove it, any vim users who ask their plugin manager to update their plugins will pull down a new version of Black that doesn't include the vim plugin, and it'll just break for them. Which is pretty annoying.

errant barn
#

That's a pickle for sure. For now I think that it's worth at least taking care of current contributions. Then we can perhaps start asking around if there would be people interested in taking this on in a longer run and evaluating the options.

glad pilot
#

I'll try to take a closer look at those PRs tonight

dense jungle
#

thank you!

bright glacier
#

whelp, I'mma probably get a review request for that πŸ˜„

bright glacier
#

somehow this is crashing mypyc (heavily simplified from src/black/parsing)

import ast
from typing import Any, Union

ast3: Any
from typed_ast import ast3


def stringify_ast(value: Any) -> None:
    # this line is the issue, removing it or removing the typed_ast AST types avoids the crash
    if isinstance(value, (ast.AST, ast3.AST)):
        pass

    else:
        stripped = [line for line in value.splitlines()]

I get:

❯ mypyc test.py
Traceback (most recent call last):
  File "mypyc/irbuild/builder.py", line 158, in accept
  File "mypy/nodes.py", line 1956, in accept
  File "mypyc/irbuild/visitor.py", line 242, in visit_list_comprehension
  File "mypyc/irbuild/expression.py", line 651, in transform_list_comprehension
  File "mypyc/irbuild/for_helpers.py", line 97, in translate_list_comprehension
  File "mypyc/irbuild/for_helpers.py", line 156, in comprehension_helper
  File "mypyc/irbuild/for_helpers.py", line 122, in handle_loop
  File "mypyc/irbuild/for_helpers.py", line 58, in for_loop_helper
  File "mypyc/irbuild/for_helpers.py", line 278, in make_for_loop_generator
  File "mypyc/irbuild/builder.py", line 702, in _analyze_iterable_item_type
test.py:14: KeyError: <mypy.nodes.CallExpr object at 0x7f2753e2af20>

If I get rid of the Any type annotation for ast3, mypyc stops crashing ...

flat krakenBOT
neon loom
dense jungle
#

@bright glacier did you already update to the latest release of mypy? it just came out after a long time, so there's a lot of changes

bright glacier
#

oh yeah I forgot one came like what in this week?

dense jungle
#

I guess that error would happen if it didn't run type inference for some expressions?

#

yes

neon loom
late dewBOT
#

.pre-commit-config.yaml line 22

rev: v0.812```
neon loom
#

*no

dense jungle
#

updating may give you new bugs or new features πŸ˜„

neon loom
#

We need precommit cit

#

*ci

bright glacier
#

I think that's a no-go for us unfortunately since we use a local hook

neon loom
#

Hmm - I wonder if we can PR that. I might look one day.

#

O seems there is an issue at least

bright glacier
#

It's marked with a "pro" label so probably out of reach for us.

#

oh of course I already forgot third-party stubs need to be installed seperately

#

oops πŸ˜›

lament crow
#

you could just always make a workflow running pre-commit autoupdate right

bright glacier
#

I do have an abandoned script somewhere on my HDD that handles that lol

#

not really keen on actually using it tho

#

and yeah no, mypy 0.902 did not fix the KeyError sadly

dense jungle
#

Probably it thinks the else branch is unreachable and therefore doesn't analyze it

#

also Quora is now running black 21.6b0 πŸ˜„

bright glacier
#

oh yeaaa now I'm a traitor again because my local black is outdated

#

gimme a moment

#
❯ python -m pip install black --upgrade
Requirement already satisfied: black in /opt/python3.8.5/lib/python3.8/site-packages (21.5b2)
Collecting black
  Downloading black-21.6b0-py3-none-any.whl (140 kB)
     |β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ| 140 kB 206 kB/s 
Requirement already satisfied: mypy-extensions>=0.4.3 in /opt/python3.8.5/lib/python3.8/site-packages (from black) (0.4.3)
Requirement already satisfied: toml>=0.10.1 in /opt/python3.8.5/lib/python3.8/site-packages (from black) (0.10.1)
Requirement already satisfied: regex>=2020.1.8 in /opt/python3.8.5/lib/python3.8/site-packages (from black) (2020.7.14)
Requirement already satisfied: appdirs in /opt/python3.8.5/lib/python3.8/site-packages (from black) (1.4.4)
Requirement already satisfied: pathspec<1,>=0.8.1 in /opt/python3.8.5/lib/python3.8/site-packages (from black) (0.8.1)
Requirement already satisfied: click>=7.1.2 in /opt/python3.8.5/lib/python3.8/site-packages (from black) (7.1.2)
Installing collected packages: black
  Attempting uninstall: black
    Found existing installation: black 21.5b2
    Uninstalling black-21.5b2:
      Successfully uninstalled black-21.5b2
  WARNING: The scripts black, black-primer and blackd are installed in '/opt/python3.8.5/bin' which is not on PATH.
  Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Successfully installed black-21.6b0
WARNING: You are using pip version 21.0.1; however, version 21.1.2 is available.
You should consider upgrading via the '/usr/bin/python -m pip install --upgrade pip' command.
#

totally readable

neon loom
#

Your pip much old

bright glacier
#

fixed as well πŸ˜„

dense jungle
#

Python 3.8 though?

neon loom
bright glacier
#

I do have Python 3.9.5 compiled on my machine I just haven't migrated my main env yet

dense jungle
bright glacier
#

hmm, I might have found a simple workaround for the KeyError, I'm hoping that it still works in src/black/parsing.py

#

yeah I think you're right on the general issue @dense jungle , removing the Any annotation or using this discovered workaround makes mypy yell at me to put back a type ignore (there was originally one in that branch but then using Any, it wasn't needed)

#

YAY, I fixed it with an actually not too invasive workaround πŸ˜„

#
diff --git a/src/black/parsing.py b/src/black/parsing.py
index c912348..79808ca 100644
--- a/src/black/parsing.py
+++ b/src/black/parsing.py
@@ -5,6 +5,11 @@ import ast
 import sys
 from typing import Any, Iterable, Iterator, List, Set, Tuple, Type, Union
 
+if sys.version_info < (3, 8):
+    from typing_extensions import Final
+else:
+    from typing import Final
+
 # lib2to3 fork
 from blib2to3.pytree import Node, Leaf
 from blib2to3 import pygram, pytree
@@ -134,6 +139,10 @@ def parse_ast(src: str) -> Union[ast.AST, ast3.AST, ast27.AST]:
     return ast27.parse(src)
 
 
+ast3_AST: Final[Type] = ast3.AST
+ast27_AST: Final[Type] = ast27.AST
+
+
 def stringify_ast(
     node: Union[ast.AST, ast3.AST, ast27.AST], depth: int = 0
 ) -> Iterator[str]:
@@ -173,7 +182,7 @@ def stringify_ast(
                 elif isinstance(item, (ast.AST, ast3.AST, ast27.AST)):
                     yield from stringify_ast(item, depth + 2)
 
-        elif isinstance(value, (ast.AST, ast3.AST, ast27.AST)):
+        elif isinstance(value, (ast.AST, ast3_AST, ast27_AST)):
             yield from stringify_ast(value, depth + 2)
 
         else:
#

OK, next release we're turning on the improved string handling features, what bugs do we still have to squash first?

lament crow
#

2313 is related to string splitter removing the parent of originally passed line here and never being set back by anything else (so in-place change of something passed by the caller and something else assuming that the parent will exist somewhere else):
https://github.com/psf/black/blob/main/src/black/trans.py#L1038
But that's as far as I went before deciding that it's out of my league for now lol

late dewBOT
#

src/black/trans.py line 1038

insert_str_child = insert_str_child_factory(LL[string_idx])```
neon loom
#

GVR is all over the new parser doc …

dense jungle
#

nice!

bright glacier
#

I'm bored while I wait for clang to compile black :p

dense jungle
#
#

and suggested we write our own πŸ˜„

flat krakenBOT
neon loom
#

I did lol @ that

bright glacier
#

oh wow lol

#

I'm thoroughly surprised

#

It would be relatively easy to adapt the PEG parser generator used by CPython to generate Python instead of C

#

I mean, that's a valid suggestion

plain atlas
#

hi :D

flat krakenBOT
neon loom
#

We have money to pay someone to try do the GVR suggestion too …

plain atlas
#

althoughveryminordetailitsTBDnotTBA

dense jungle
#

it stands for "to be ascertained"

weak path
#

no

plain atlas
#

oh

#

well

#

i read it as to be announced lol

dense jungle
#

yes, just kidding

plain atlas
#

i did add a con of one of them for you πŸ˜›

dense jungle
plain atlas
#

lmao

#

this is very funny

flat krakenBOT
#

Describe the bug

If concatenating 2 comprehensions, content is indented and surrounded by a pair of parentheses.

To Reproduce

This is an example. The first variable (pre_grid) is assigned the concatenation of two comprehensions, while the second one (gr_grid) concatenates five. The difference in formatting is misleading in this context because both variables have similar semantics. I'm unable to find a good reason why they should be formatted different.

pr...
plain atlas
dense jungle
#

yes I just found that issue too, let me link it to the doc

plain atlas
#

πŸ‘

#

well this is a bit of a turn off Instagram/LibCST#341 πŸ‘€

toxic stormBOT
flat krakenBOT
bright glacier
#

the benefits of doing all of this mypyc related benchmarking is that I have reasonable decent benchmarking tools, which is great because I had planned to create some a long time ago but never did

#

FYI: I'm just going to say random stuff as I wait for this benchmarking to finish

plain atlas
# toxic storm

@dense jungle you miiiight want to take a look at this open issue

bright glacier
#

Uhm

dense jungle
#

yes, that one could cause issues if we end up using libcst

#

@bright glacier there's only one right answer

bright glacier
#

Blue and Pink are both great colours

dense jungle
#

wrong

bright glacier
#

purple

dense jungle
#

wrong

plain atlas
#

black ofc

bright glacier
#

no!,

plain atlas
#

and favourite colour with at least one bit flipped on?

bright glacier
#

told ya already

plain atlas
#

this is the best pink

#

vscode colorized pink logo

bright glacier
#

that looks awesome!

plain atlas
#

i'm just gonna keep vsc as my discord pfp but colorized it for the seasons lol

#

anyways, cya

bright glacier
#

see ya later

plain atlas
#

oo

#

I just realized

#

I have now contributed to the same google document that the founder of python has contributed to

#

my life has reached its climax, there is nothing higher than this honour.

bright glacier
#

whelp, initial work on further optimizing black after getting mypyc working ain't so successful 😦

plain atlas
#

uh

#

why is this in a foreign language?

#

send help I can't read the docs of python

#

was trying to read the ast docs right now to help with the doc above

bright glacier
#

the universe is trying to convince you to not use Python by removing one of its strengths, its docs /j

plain atlas
#

imagine if the docs were python's strengths /s

plain atlas
bright glacier
#

oh fun

plain atlas
#

there's even a built in formatter

glad pilot
#

I took a stab at 2 of the 3 open C: vim PRs, and commented with patches in lieu of being able to push to the PR branch. The third, I don't much like - https://github.com/psf/black/pull/1319/files is proposing to change the public interface of the plugin, so that the :Black command takes arguments. It wants to take them in a strange format - comma-separated pairs of key=val pairs - which I don't think I've ever seen another vim command take. Vim commands that take arguments usually look more like how CLIs take flags and arguments, and I don't think I've ever seen a vim command take comma-separated arguments instead of space-separated. It's strange.

The approach here is basically a hack, I think - the format they chose for the arguments was chosen so that they could be passed directly to a Python function as kwargs, despite that being a non-idiomatic way to pass arguments to a vim command.

#

I'm not even sure that I buy the argument that it makes sense to be able to pass arguments to a single call to Black, instead of saving settings into a pyproject.toml file or at least setting the g:black_* variables in your vimrc. The whole point of Black should be that you're running it repeatedly to keep the style consistent over time - I'm not sure I understand why you'd want to make it easy to run with different settings than it has been configured to use.

errant barn
errant barn
#

Also, the stable docs seem to be missing the 21.5b2 and the latest release. I suspect this is because of the stable git tag, so it should probably be moved!

mint barn
#

hELLO

errant barn
#

@keen oasis I'm not so sure this is appropriate here. The rules of PyDis are quite strict about advertising, and this is a channel about a specific project!

keen oasis
#

@errant barn deleted

errant barn
#

Thank you, much appreciated. Though I hope that you find what you were looking for elsewhere!

flat krakenBOT
#

Add a new line at the end of python file or not to remove it

Currently black removes extra blank line after python code at the end of file.
Tested inside the docker build from the repository.

root@8c79a371a51b:/# black test.py --check --diff --verbose
--- test.py	2021-06-11 09:53:10.665099 +0000
+++ test.py	2021-06-11 09:53:15.809714 +0000
@@ -1,6 +1,5 @@
 def main():
     print(11)


 main()
-
would reformat test.py
Oh no! πŸ’₯ πŸ’” πŸ’₯
1 file would be reformatte...
magic bison
#

whats this?

#

a code formatter but what exactly

errant barn
#

For Python! Have a look at the pinned issues messages mate πŸ˜„

magic bison
#

how does it work?

#

like how does it know what to fix

bright glacier
#

I think you meant pinned messages

errant barn
#

Already there mate ;)

errant barn
bright glacier
magic bison
#

ok

bright glacier
#

it has no true sense of whether code is good or bad it just knows how to take some code and make changes that follow the black code style

magic bison
#

so its like pylint but it fixes stuff instead of telling you whats wrong

errant barn
#

eexactly!

magic bison
#

oh ok

bright glacier
#

in a way yes, but we don't have error messages and we can't, black is a formatter not linter

lament crow
#

black is just about style, pylint is about more

#

but black is very good at style ;)

#

basically let the computers worry for code style, not humans

neon loom
bright glacier
#

!remind 1D check on 21.6b0 release status and maybe move stable tag

late dewBOT
#
Fat chance.

Sorry, you can't do that here!

bright glacier
#

oh lol

#

I guess I'll just use the bot commands channel 😦

tribal thistle
#

Uhh

#

We could probably enable that here

bright glacier
#

ah looking at the code, it seems like staff can make a reminder anywhere while everyone else (including me!) can make in these places:

late dewBOT
#

config-default.yml lines 244 to 246

reminder_whitelist:
    - *BOT_CMD
    - *DEV_CONTRIB```
tribal thistle
#

Should be a single line change

#

Would you like to PR this category into that?

#

I would do it, but not at PC

bright glacier
#

Would it need an issue for further discussion first?

tribal thistle
#

A core dev can sign off with no issue

#

You can link to my messages here

bright glacier
#

Cool then, I can PR it later once my time is freed up in an hour and a half

#

me wishes I could use reminders here so I don't forget to do the PR

tribal thistle
#

Hahahaha

#

Cool trick I got

bright glacier
#

i.e. privliiges

tribal thistle
#

!remind 90M 429445826251587616 dew it

bright glacier
#

lol

dense jungle
#

such power

tribal thistle
#

!remind 429445826251587616 90M dew it

late dewBOT
#
ROGER THAT

Your reminder will arrive in 1 hour and 30 minutes and will mention 1 other(s)!

tribal thistle
#

Or I could just fuck it up

bright glacier
#

you could ping me in that reminder too can't you with your admin powers

#

OH

tribal thistle
#

Ye

bright glacier
#

that is my id

#

I didn't recognize it lol

tribal thistle
#

I wouldn’t at a glance either haha

dense jungle
#

just curious, how do you find that id?

tribal thistle
#

Press/right click on a user and click β€œcopy ID”

#

You may need to enable developer mode first

bright glacier
dense jungle
#

thanks, that did it

late dewBOT
#

@tribal thistle @bright glacier

It has arrived!

Here's your reminder: dew it.
[Jump back to when you created the reminder](#black-formatter message)

plain atlas
#

very nice reminder mentions

#

now dew it πŸ‘€

#

oh since I'm making a bunch of vsc logos

#

i made one for black

#

nah this is the real one

bright glacier
#

the contrast is so bad it's beautiful /s

bright glacier
#

ugh, the setup required for testing changes for pydis-bot seems to be really involved

frozen yacht
#

We know and have plans to address it, but not enough time to work on that stuff lately.

bright glacier
#

It's acceptable, I've just gotten used to being really simple to get a dev env quickly for the python projects I work on

frozen yacht
#

If you're just whitelisting this channel, it should only be a config change and could forego testing.

bright glacier
#

We'll see, I don't trust myself enough to do an one line change and I might need a pydis-bot test env later so I'll try for now and see how much effort it will really take πŸ™‚

bright glacier
#

Yeah no I do not feel like setting this up, got like half way done and I don't feel like doing this lol

#

Does show how big this server really is though

tribal thistle
#

Yeah it’s not fun to set up lol

bright glacier
#

everything except for the channels is acceptable, but my goodness there is a lot of channels

tribal thistle
#

Lol

#

The list is terrifying

bright glacier
#

it really is

tribal thistle
#

Anyways, you could add it in without testing, or I could have a look at it in the morning

bright glacier
#

The good news out of it is that it was my first time using poetry lol

tribal thistle
#

Yeah? How was it πŸ‘€

bright glacier
#

I had a not so great experience with pipenv (although I still use it for black) so I gave up on that class of tools forever until now

#

But poetry actually felt polished, I'm not sure if the "handle everything" nature of these tools is something I'll grow to like, but at least I feel like care was taken :p

tribal thistle
#

Poetry actually is less β€œhandle everything” than pipenv

#

It doesn’t have scripts

#

Ofc we have a plug-in to do it…

bright glacier
#

So wait, I just make the oneliner change in /config-default.yml right?

tribal thistle
#

This category is probably not in the constants file, so it’ll have to be added in as well

bright glacier
#

oh fun

tribal thistle
#

That just involves adding the ID to the yaml, and the type (int) to the constants.py

bright glacier
#

So correct me if I'm wrong, but I need to do:

#
  • get the ID of this category and put in the YAML file
tribal thistle
#

Yeah that’s basically it

bright glacier
#
  • and finally add this channel to that other section
tribal thistle
#

Yeah that step is pretty important too lol

bright glacier
#

OK, not too bad although I'm the guy who would make 10 force pushes for a small change πŸ˜…

tribal thistle
#

I can’t remember if the filter handles categories. If it does, I think it would make sense to add the entire OSS category, if not, we could add just black. I should check lol

tribal thistle
bright glacier
#

Is the server template up to date? It didn't exactly look like it

#

I mean, it sounds like a pain to keep up to date, but I'm curious

tribal thistle
#

So basically, yeah, but, it doesn’t have all the channels. It has all the channels you need to setup and run the bot, but fewer channels than the main server to keep it navigable

plain atlas
tribal thistle
#

The only things you’d have to add on to the template are one emoji of your choice

#

Oh we probably drowned this channel

bright glacier
#

This should probably be documented somewhere lol

tribal thistle
plain atlas
bright glacier
#

although honestly

#

this channel gets derailed constantly by me

tribal thistle
#

Lol I’ll take this one

#

I can get excited inducting a new sacrificial goat to the academy of pydis contributing

bright glacier
#

!remind 20H check on 21.6b0 ~release~ bugginess status and maybe move stable tag

late dewBOT
#
Sure.

Your reminder will arrive in 20 hours!

bright glacier
#

I make that reminder and yet I don't see any new bugs since the release yesterday

#

just psf/black#2328 which doesn't seem like it should exist, IIRC it was fixed in 20.8b1

toxic stormBOT
flat krakenBOT
#

Describe the bug

I have this file header in my source that I'd like to not mess with since it's got license information for code that isn't mine. So I wrap it in # fmt: off; ...; # fmt: on to preserve the block, but the block gets formatted anyway (a space gets added after the #).

Before black:

# fmt: off
#===- cindex-dump.py - cindex/Python Source Dump -------------*- python -*--===#
#
# Part of the LLVM Project, under the Apache License v2.0 with LLVM Excepti...
bright glacier
#

that issue is a duplicate fyi

#

I see we are both triaging it at the same time

bright glacier
#

our reaction time is sometimes nuts

plain atlas
#

this is an odd Testimonial

bright glacier
#

Alright, I got the 2 vim PRs godlygeek suggested patches for updated, they should be ready for review (not sure by who tho) and then merging

#

Trying to get the open PR count lower to reduce the burden on PR review resources

plain atlas
#

oof

bright glacier
#

one of mine I take it as?

plain atlas
#

its not πŸ˜›

#

the funny thing is, its old enough that it only had 26 checks

#

rather than the now 36

bright glacier
#

and we might get more once I hook up mypyc to black

plain atlas
#

😦

#

what's mypc?

#

do ping im gonna go back to the rust server for now~~

bright glacier
#

a compiler for statically typed python code, turns such code into a Python C extension for speed improvements @plain atlas

plain atlas
#

so black will be a c extension?

bright glacier
#

Perhaps obvious by the name, it's based off mypy

bright glacier
#

The main one is that monkeypatching will break (this does actually break some of our test suite) but expecting that to work (and stay supported) for an application that technically isn't officially a library is IMO a stretch

glad pilot
tribal thistle
#

Hey @gritty marsh please keep messages on topic

muted haven
# dense jungle he added some comments to https://docs.google.com/document/d/1QPqm01E7MIRi_l4jrg...

Is the lib2to3 parser framework powerful enough to support features from the new PEG parser? CPython docs say lib2to3 is deprecated because it can’t support PEG syntax.
Chiming in late, it depends on the complexity though it is possible (at least as far as my experimentations go). Both parenthesized context managers and soft-keywords can be implemented, though in case of ambiguity it might require a bit more annotations (something like cut in the PEP 617, to commit to a rule). It is kinda harder when you try to do it on a parser with error handling (parso) but for black it should be easier to implement those 'hacks'.

dense jungle
#

Thank you!

glad pilot
# bright glacier Alright, I got the 2 vim PRs godlygeek suggested patches for updated, they shoul...

The third vim PR - https://github.com/psf/black/pull/1319 - is a feature request, not a bug report.

Two features, in fact:

  1. the ability to set the target version for the plugin's call to Black (new vim variable for setting the default, plus ability to read a per project setting from pyproject.toml)
  2. the ability to override every setting on the vim command line by making the :Black command take arguments.

If a maintainer decides that the features should be implemented, I can help make a more idiomatic implementation of them, but I'm probably not in a position to be making decisions about the direction of the plugin on my own.

GitHub

The vim plugin takes now into consideration the target-version value of
the pyproject.toml file.
You can also specify a default target version with the configuration
variable g:black_target_version...

late dewBOT
#

@bright glacier

It has arrived!

Here's your reminder: check on 21.6b0 ~release~ bugginess status and maybe move stable tag.
[Jump back to when you created the reminder](#black-formatter message)

bright glacier
#

ah yes

bright glacier
#

@neon loom I suggest to move the stable tag, the newline being stripped issue is unreproducible for both me (using the docker steps the OP provided) and Felix (using a normal dev env since he doesn't know docker AFAIK)

neon loom
#

Got for it f you want

#

I can’t for an hour or so

#

It’s in the docs

bright glacier
#

Ah ok, sounds good!

#

Let's hope I don't break anything πŸ˜…

frozen yacht
#

Stable tag reminded me of something I wanted to ask. Does the pre-commit hook fail if it detects black needs to format something?

#

I was avoiding using stable because I figured I need to run it separately, and "stable" is obviously not on pypi

bright glacier
#

Well, honestly I wouldn't recommend using stable for pre-commit (even though IIRC that's what is in the pre-commit integrations docs)

#

pre-commit won't track changes to the stable tag

#

which is IMO a good thing (also git tag ]safety makes that annoying anyway)

#

But yes, the pre-commit hook should fail if it makes modifications to a file watched by pre-commit

#

although you can also use the --check flag to make black return a non zero return code if it would make changes (it doesn't actually touch the files tho)

frozen yacht
#

Ah okay I thought it was going to just fix it all and include it in the commit. Now that I think about it, I'm not sure if pre-commit even has the means to do that.

bright glacier
#

IIRC the pre-commit developer rejected an feature request for automatically adding the changes from a failing hook

frozen yacht
#

Wouldn't it be ideal to use --check in pre-commit always then? It's redundant to actually perform the fixes.

lament crow
#

how is it redundant?

frozen yacht
#

I mean in CI

bright glacier
#

in CI yes

frozen yacht
#

Sorry, important to mention that

lament crow
#

well

#

you can still benefit from diff in CI if you use --show-diff-on-failure

bright glacier
#

it doesn't really matter tho

lament crow
#

or rather contributors can

bright glacier
#

pre-commit and black both have diff options

lament crow
#

and speedwise should be mostly the same

frozen yacht
#

Would there be a nice way to integrate that output with GitHub annotations?

bright glacier
#

Not implemented although accepted: psf/black#1764

toxic stormBOT
plain atlas
#

Ugh so that's why

frozen yacht
#

Okay, cool. I'll look forward to that then.

bright glacier
#

I wouldn't hold your breath, our feature development leadtime ain't great, especially since I expect significant discussion for this implementation because that will be the first output format (other than diff) black will support

frozen yacht
plain atlas