]> git.madduck.net Git - etc/vim.git/blobdiff - README.md

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

tweak grammar in docs about fluent interfaces (#247)
[etc/vim.git] / README.md
index 3eb8ee4f131bb3bd234b457071895318932bf44c..5b5903b49887ff8082e490cb787be14f26f45b24 100644 (file)
--- a/README.md
+++ b/README.md
@@ -26,8 +26,23 @@ content instead.
 *Black* makes code review faster by producing the smallest diffs
 possible.
 
+---
 
-## Installation and Usage
+*Contents:* **[Installation and usage](#installation-and-usage)** |
+**[The *Black* code style](#the-black-code-style)** |
+**[Editor integration](#editor-integration)** |
+**[Version control integration](#version-control-integration)** |
+**[Ignoring unmodified files](#ignoring-unmodified-files)** |
+**[Testimonials](#testimonials)** |
+**[Show your style](#show-your-style)** |
+**[License](#license)** |
+**[Contributing](#contributing-to-black)** |
+**[Change Log](#change-log)** |
+**[Authors](#authors)**
+
+---
+
+## Installation and usage
 
 ### Installation
 
@@ -78,14 +93,16 @@ Options:
   used).
 
 
-### NOTE: This is an early pre-release
+### NOTE: This is a beta product
 
-*Black* can already successfully format itself and the standard library.
+*Black* is already successfully used by several projects, small and big.
 It also sports a decent test suite.  However, it is still very new.
 Things will probably be wonky for a while. This is made explicit by the
-"Alpha" trove classifier, as well as by the "a" in the version number.
+"Beta" trove classifier, as well as by the "b" in the version number.
 What this means for you is that **until the formatter becomes stable,
-you should expect some formatting to change in the future**.
+you should expect some formatting to change in the future**.  That being
+said, no drastic stylistic changes are planned, mostly responses to bug
+reports.
 
 Also, as a temporary safety measure, *Black* will check that the
 reformatted code still produces a valid AST that is equivalent to the
@@ -131,13 +148,13 @@ brackets and put that in a separate indented line.
 ```py3
 # in:
 
-l = [[n for n in list_bosses()], [n for n in list_employees()]]
+TracebackException.from_exception(exc, limit, lookup_lines, capture_locals)
 
 # out:
 
-l = [
-    [n for n in list_bosses()], [n for n in list_employees()]
-]
+TracebackException.from_exception(
+    exc, limit, lookup_lines, capture_locals
+)
 ```
 
 If that still doesn't fit the bill, it will decompose the internal
@@ -176,13 +193,13 @@ between two distinct sections of the code that otherwise share the same
 indentation level (like the arguments list and the docstring in the
 example above).
 
-If a line of "from" imports cannot fit in the allotted length, it's always split
-into one per line.  Imports tend to change often and this minimizes diffs, as well
-as enables readers of code to easily find which commit introduced a particular
-import.  This exception also makes *Black* compatible with
-[isort](https://pypi.org/p/isort/).  Use `multi_line_output=3`,
-`include_trailing_comma=True`, `force_grid_wrap=0`, and `line_length=88` in your
-isort config.
+If a data structure literal (tuple, list, set, dict) or a line of "from"
+imports cannot fit in the allotted length, it's always split into one
+element per line.  This minimizes diffs as well as enables readers of
+code to find which commit introduced a particular entry.  This also
+makes *Black* compatible with [isort](https://pypi.org/p/isort/).  Use
+`multi_line_output=3`, `include_trailing_comma=True`,
+`force_grid_wrap=0`, and `line_length=88` in your isort config.
 
 
 ### Line length
@@ -268,6 +285,7 @@ if you'd like a trailing comma in this situation and *Black* didn't
 recognize it was safe to do so, put it there manually and *Black* will
 keep it.
 
+
 ### Strings
 
 *Black* prefers double quotes (`"` and `"""`) over single quotes (`'`
@@ -297,7 +315,8 @@ a bit easier than double quotes.  The latter requires use of the Shift
 key.  My recommendation here is to keep using whatever is faster to type
 and let *Black* handle the transformation.
 
-### Line Breaks & Binary Operators
+
+### Line breaks & binary operators
 
 *Black* will break a line before a binary operator when splitting a block
 of code over multiple lines. This is so that *Black* is compliant with the
@@ -308,6 +327,7 @@ This behaviour may raise ``W503 line break before binary operator`` warnings in
 style guide enforcement tools like Flake8. Since ``W503`` is not PEP 8 compliant,
 you should tell Flake8 to ignore these warnings.
 
+
 ### Slices
 
 PEP 8 [recommends](https://www.python.org/dev/peps/pep-0008/#whitespace-in-expressions-and-statements)
@@ -321,6 +341,7 @@ This behaviour may raise ``E203 whitespace before ':'`` warnings in style guide
 enforcement tools like Flake8. Since ``E203`` is not PEP 8 compliant, you should
 tell Flake8 to ignore these warnings.
 
+
 ### Parentheses
 
 Some parentheses are optional in the Python grammar.  Any expression can
@@ -354,13 +375,14 @@ return not (this or that)
 decision = (maybe.this() and values > 0) or (maybe.that() and values < 0)
 ```
 
+
 ### Call chains
 
 Some popular APIs, like ORMs, use call chaining.  This API style is known
 as a [fluent interface](https://en.wikipedia.org/wiki/Fluent_interface).
-*Black* formats those treating dots that follow a call or an indexing
+*Black* formats those by treating dots that follow a call or an indexing
 operation like a very low priority delimiter.  It's easier to show the
-behavior than to explain it.  Look at the example::
+behavior than to explain it.  Look at the example:
 ```py3
 def example(session):
     result = (
@@ -374,6 +396,7 @@ def example(session):
     )
 ```
 
+
 ### Typing stub files
 
 PEP 484 describes the syntax for type hints in Python.  One of the
@@ -423,19 +446,25 @@ Use [proofit404/blacken](https://github.com/proofit404/blacken).
 
 1. Install `black`.
 
-        $ pip install black
+```console
+$ pip install black
+```
 
 2. Locate your `black` installation folder.
 
-  On MacOS / Linux / BSD:
+  On macOS / Linux / BSD:
 
-        $ which black
-        /usr/local/bin/black  # possible location
+```console
+$ which black
+/usr/local/bin/black  # possible location
+```
 
   On Windows:
 
-        $ where black
-        %LocalAppData%\Programs\Python\Python36-32\Scripts\black.exe  # possible location
+```console
+$ where black
+%LocalAppData%\Programs\Python\Python36-32\Scripts\black.exe  # possible location
+```
 
 3. Open External tools in PyCharm with `File -> Settings -> Tools -> External Tools`.
 
@@ -494,7 +523,7 @@ The plugin will use it.
 
 **How to get Vim with Python 3.6?**
 On Ubuntu 17.10 Vim comes with Python 3.6 by default.
-On macOS with HomeBrew run: `brew install vim --with-python3`.
+On macOS with Homebrew run: `brew install vim --with-python3`.
 When building Vim from source, use:
 `./configure --enable-python3interp=yes`. There's many guides online how
 to do this.
@@ -504,14 +533,17 @@ to do this.
 
 Use [joslarson.black-vscode](https://marketplace.visualstudio.com/items?itemName=joslarson.black-vscode).
 
+
 ### SublimeText 3
 
 Use [sublack plugin](https://github.com/jgirardet/sublack).
 
+
 ### IPython Notebook Magic
 
 Use [blackcellmagic](https://github.com/csurfer/blackcellmagic).
 
+
 ### Other editors
 
 Atom/Nuclide integration is planned by the author, others will
@@ -551,9 +583,9 @@ that is pinned to the latest release on PyPI.  If you'd rather run on
 master, this is also an option.
 
 
-## Ignoring non-modified files
+## Ignoring unmodified files
 
-*Black* remembers files it already formatted, unless the `--diff` flag is used or
+*Black* remembers files it has already formatted, unless the `--diff` flag is used or
 code is passed via standard input. This information is stored per-user. The exact
 location of the file depends on the black version and the system on which black
 is run. The file is non-portable. The standard location on common operating systems
@@ -619,9 +651,32 @@ More details can be found in [CONTRIBUTING](CONTRIBUTING.md).
 
 ## Change Log
 
-### 18.5a0 (unreleased)
+### 18.5b1 (unreleased)
+
+* Python grammar pickle caches are stored with the formatting caches, making
+  *Black* work in environments where site-packages is not user-writable (#192)
+
+* fixed invalid code produced when standalone comments were present in a trailer
+  that was omitted from line splitting on a large expression (#237)
+
+* fixed optional parentheses being removed within `# fmt: off` sections (#224)
 
-* call chains are now formatted according to the [fluent interfaces](https://en.wikipedia.org/wiki/Fluent_interface) style (#67)
+* fixed invalid code produced when stars in very long imports were incorrectly
+  wrapped in optional parentheses (#234)
+
+* fixed unstable formatting when inline comments were moved around in
+  a trailer that was omitted from line splitting on a large expression
+  (#238) 
+
+### 18.5b0
+
+* call chains are now formatted according to the
+  [fluent interfaces](https://en.wikipedia.org/wiki/Fluent_interface)
+  style (#67)
+
+* data structure literals (tuples, lists, dictionaries, and sets) are
+  now also always exploded like imports when they don't fit in a single
+  line (#152)
 
 * slices are now formatted according to PEP 8 (#178)
 
@@ -874,3 +929,18 @@ Multiple contributions by:
 * [Osaetin Daniel](mailto:osaetindaniel@gmail.com)
 * [Sunil Kapil](mailto:snlkapil@gmail.com)
 * [Vishwas B Sharma](mailto:sharma.vishwas88@gmail.com)
+
+---
+
+*Contents:*
+**[Installation and Usage](#installation-and-usage)** |
+**[The *Black* code style](#the-black-code-style)** |
+**[Editor integration](#editor-integration)** |
+**[Version control integration](#version-control-integration)** |
+**[Ignoring unmodified files](#ignoring-unmodified-files)** |
+**[Testimonials](#testimonials)** |
+**[Show your style](#show-your-style)** |
+**[License](#license)** |
+**[Contributing](#contributing-to-black)** |
+**[Change Log](#change-log)** |
+**[Authors](#authors)**