-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
black formatting #3092
Comments
I would be v keen. I find it great. I don't think it's possible to apply incrementally, unfortunately (e.g. only on changed lines). So it would require a single sweeping change. Interested to know how other projects are handling. IIRC they're applying it to some parts of stdlib too. |
If we do this, which I am +1 on, we should add a pre-commit hook so we don't have to think about the manual applications. We should probably just copy the dask approach: dask/dask#4983. |
+1 from me, too. It's definitely going to cause some nasty merge conflicts for any work in progress, but hopefully it's straightforward to fix those by running black on the PRs and then merging in master. We should be able to simply add another job on Azure for this. The |
Since Black requires Python >=3.6, which would set the minimum Python version to 3.6 for contributing to xarray (which currently requires Python >= 3.5), are there any plans of dropping Python 3.5 support in the near future? |
I don't think these decisions need to be coupled. It's OK to make contributors upgrade to a newer version of Python before all our users. There are no immediate plans to drop Python 3.5 support, but we haven't really discussed it either. I think it would definitely make sense to drop Python 3.5 after Python 3.8 is available, maybe sooner. Four major Python versions would definitely be too many. |
I'm happy to do this today |
Let's wait a little while for the burst of activity from SciPy to die down
first.
…On Mon, Jul 15, 2019 at 8:03 AM Maximilian Roos ***@***.***> wrote:
I'm happy to do this today
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#3092?email_source=notifications&email_token=AAJJFVR2KNJP3PXHPG4ZZK3P7SGTXA5CNFSM4IA3BF72YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZ57I3A#issuecomment-511439980>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAJJFVUQ4OMMUZJ5LQEFF7TP7SGTXANCNFSM4IA3BF7Q>
.
|
@shoyer great TODOs (please add where I've missed)
|
flake8 is not just about formatting; none of the pyflakes errors (e.g. double/unused imports) are covered by black. I didn't know about isort, nice. However, from a very quick test, it's not compatible with black e.g. if you run black -> isort -> black, the two tools keep touching each other's changes. |
I just ran isort on my own project. Besides the aforementioned incompatibilities with black, I hate when it changes
to
which in my opinion flies in the face of the PEP8 rule of never importing two modules on the same line. So my opinion is: +1 for a manually vetted one-time run; -1 for automatic integration in CI. |
There's a specific isort config that's compatible with black; this is what we use internally (there's a similar official version I believe):
|
I tried your setup.cfg above but still getting inconsistencies with black when I have comments in the imports. black: import foo
# Let me explain why we do this
import bar isort: import foo
# Let me explain why we do this
import bar and I strongly agree with black. |
@max-sixty - closed by #3142 I think? |
Thanks @Zac-HD |
I, like many others, have irreversibly fallen in love with black.
Can we apply it to the existing codebase and as an enforced CI test?
The only (big) problem is that developers will need to manually apply it to any open branches and then merge from master - and even then, merging likely won't be trivial.
How did the dask project tackle the issue?
The text was updated successfully, but these errors were encountered: