Skip to content

Commit

Permalink
Merge branch 'master' into ki-in-new-task
Browse files Browse the repository at this point in the history
  • Loading branch information
pquentin authored May 22, 2020
2 parents 5028426 + 15facd9 commit b322aea
Show file tree
Hide file tree
Showing 95 changed files with 1,182 additions and 1,349 deletions.
185 changes: 0 additions & 185 deletions .style.yapf

This file was deleted.

4 changes: 2 additions & 2 deletions check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ python ./trio/_tools/gen_exports.py --test \
# see https://forum.bors.tech/t/pre-test-and-pre-merge-hooks/322)
# autoflake --recursive --in-place .
# pyupgrade --py3-plus $(find . -name "*.py")
yapf -rpd setup.py trio \
black --diff setup.py trio \
|| EXIT_STATUS=$?

# Run flake8 without pycodestyle and import-related errors
Expand All @@ -31,7 +31,7 @@ Problems were found by static analysis (listed above).
To fix formatting and see remaining errors, run
pip install -r test-requirements.txt
yapf -rpi setup.py trio
black setup.py trio
./check.sh
in your local checkout.
Expand Down
25 changes: 12 additions & 13 deletions docs/source/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ in separate sections below:
adding a test to make sure it stays fixed.

* :ref:`pull-request-formatting`: If you changed Python code, then did
you run ``yapf -rpi setup.py trio``? (Or for other packages, replace
you run ``black setup.py trio``? (Or for other packages, replace
``trio`` with the package name.)

* :ref:`pull-request-release-notes`: If your change affects
Expand Down Expand Up @@ -285,31 +285,30 @@ of eyes can be helpful when trying to come up with devious tricks.
Code formatting
~~~~~~~~~~~~~~~

Instead of wasting time arguing about code formatting, we use `yapf
<https://github.com/google/yapf>`__ to automatically format all our
Instead of wasting time arguing about code formatting, we use `black
<https://github.com/psf/black>`__ to automatically format all our
code to a standard style. While you're editing code you can be as
sloppy as you like about whitespace; and then before you commit, just
run::

pip install -U yapf
yapf -rpi setup.py trio
pip install -U black
black setup.py trio

to fix it up. (And don't worry if you forget – when you submit a pull
request then we'll automatically check and remind you.) Hopefully this
will let you focus on more important style issues like choosing good
names, writing useful comments, and making sure your docstrings are
nicely formatted. (Yapf doesn't reformat comments or docstrings.)
nicely formatted. (black doesn't reformat comments or docstrings.)

Very occasionally, yapf will generate really ugly and unreadable
formatting (usually for large literal structures like dicts nested
inside dicts). In these cases, you can add a ``# yapf: disable``
comment to tell it to leave that particular statement alone.
Very occasionally, you'll want to override black formatting. To do so,
you can can add ``# fmt: off`` and ``# fmt: on`` comments.

If you want to see what changes yapf will make, you can use::
If you want to see what changes black will make, you can use::

yapf -rpd setup.py trio
black --diff setup.py trio

(``-d`` displays a diff, versus ``-i`` which fixes files in-place.)
(``--diff`` displays a diff, versus the default mode which fixes files
in-place.)


.. _pull-request-release-notes:
Expand Down
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
[tool.black]
target-version = ['py36']


[tool.towncrier]
# Usage:
# - PRs should drop a file like "issuenumber.feature" in newsfragments
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
# cffi 1.14 fixes memory leak inside ffi.getwinerror()
# cffi is required on Windows, except on PyPy where it is built-in
"cffi>=1.14; os_name == 'nt' and implementation_name != 'pypy'",
"contextvars>=2.1; python_version < '3.7'"
"contextvars>=2.1; python_version < '3.7'",
],
# This means, just install *everything* you see under trio/, even if it
# doesn't look like a source file, so long as it appears in MANIFEST.in:
Expand Down
2 changes: 1 addition & 1 deletion test-requirements.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pylint # for pylint finding all symbols tests
jedi # for jedi code completion tests

# Tools
yapf ==0.30.0 # formatting
black; implementation_name == "cpython"
flake8
astor # code generation

Expand Down
17 changes: 13 additions & 4 deletions test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,24 @@
#
# pip-compile --output-file test-requirements.txt test-requirements.in
#
appdirs==1.4.4 # via black
appnope==0.1.0 # via ipython
astor==0.8.1 # via -r test-requirements.in
astroid==2.4.1 # via pylint
async-generator==1.10 # via -r test-requirements.in
attrs==19.3.0 # via -r test-requirements.in, outcome, pytest
attrs==19.3.0 # via -r test-requirements.in, black, outcome, pytest
backcall==0.1.0 # via ipython
black==19.10b0 ; implementation_name == "cpython" # via -r test-requirements.in
cffi==1.14.0 # via cryptography
click==7.1.2 # via black
contextvars==2.4 ; python_version < "3.7" # via -r test-requirements.in, sniffio
coverage==5.1 # via pytest-cov
cryptography==2.9.2 # via pyopenssl, trustme
decorator==4.4.2 # via ipython, traitlets
flake8==3.8.1 # via -r test-requirements.in
idna==2.9 # via -r test-requirements.in, trustme
immutables==0.14 # via -r test-requirements.in
immutables==0.14 # via -r test-requirements.in, contextvars
importlib-metadata==1.6.0 # via flake8, pluggy, pytest
ipython-genutils==0.2.0 # via traitlets
ipython==7.14.0 # via -r test-requirements.in
isort==4.3.21 # via pylint
Expand All @@ -26,6 +32,7 @@ more-itertools==8.3.0 # via pytest
outcome==1.0.1 # via -r test-requirements.in
packaging==20.4 # via pytest
parso==0.7.0 # via jedi
pathspec==0.8.0 # via black
pexpect==4.8.0 # via ipython
pickleshare==0.7.5 # via ipython
pluggy==0.13.1 # via pytest
Expand All @@ -41,12 +48,14 @@ pyopenssl==19.1.0 # via -r test-requirements.in
pyparsing==2.4.7 # via packaging
pytest-cov==2.8.1 # via -r test-requirements.in
pytest==5.4.2 # via -r test-requirements.in, pytest-cov
regex==2020.5.14 # via black
six==1.15.0 # via astroid, cryptography, packaging, pyopenssl, traitlets
sniffio==1.1.0 # via -r test-requirements.in
sortedcontainers==2.1.0 # via -r test-requirements.in
toml==0.10.1 # via pylint
toml==0.10.1 # via black, pylint
traitlets==4.3.3 # via ipython
trustme==0.6.0 # via -r test-requirements.in
typed-ast==1.4.1 ; python_version < "3.8" and implementation_name == "cpython" # via -r test-requirements.in, astroid, black
wcwidth==0.1.9 # via prompt-toolkit, pytest
wrapt==1.12.1 # via astroid
yapf==0.30.0 # via -r test-requirements.in
zipp==3.1.0 # via importlib-metadata
Loading

0 comments on commit b322aea

Please sign in to comment.