Package: blacksin
This is a fork which adds an option to prefer single quotes. Nothing else has been
changed.Its cli is still calledblack, but the distribution name to use inpip installis
namedblacksin(because some people may consider a single-quote fork a mortal sin,
and single quotes...)The 'Uncompromising' Code Formatter“Any color you like.”Blackis the uncompromising Python code formatter. By using it, you agree to cede
control over minutiae of hand-formatting. In return,Blackgives you speed,
determinism, and freedom frompycodestylenagging about formatting. You will save time
and mental energy for more important matters.Blackened code looks the same regardless of the project you're reading. Formatting
becomes transparent after a while and you can focus on the content instead.Blackmakes code review faster by producing the smallest diffs possible.Try it out now using theBlack Playground. Watch thePyCon 2019 talkto learn more.Contents:Installation and usage|Code style|Pragmatism|pyproject.toml|Editor integration|blackd|black-primer|Version control integration|GitHub Actions|Ignoring unmodified files|Used by|Testimonials|Show your style|Contributing|Change log|AuthorsInstallation and usageInstallationBlackcan be installed by runningpip install blacksin. It requires Python 3.6.0+ to
run but you can reformat Python 2 code with it, too.Install from GitHubIf you can't wait for the latesthotnessand want to install from GitHub, use:pip install git+git://github.com/ThiefMaster/blacksinUsageTo get started right away with sensible defaults:black{source_file_or_directory}You can runBlackas a package if running it as a script doesn't work:python-mblack{source_file_or_directory}Command line optionsBlackdoesn't provide many options. You can list them by runningblack --help:Usage: black [OPTIONS] [SRC]...

  The uncompromising code formatter.

Options:
  -c, --code TEXT                 Format the code passed in as a string.
  -l, --line-length INTEGER       How many characters per line to allow.
                                  [default: 88]

  -t, --target-version [py27|py33|py34|py35|py36|py37|py38|py39]
                                  Python versions that should be supported by
                                  Black's output. [default: per-file auto-
                                  detection]

  --pyi                           Format all input files like typing stubs
                                  regardless of file extension (useful when
                                  piping source on standard input).

  -S, --skip-string-normalization
                                  Don't normalize string quotes or prefixes.
  --single-quotes                 Prefer single quotes when normalizing strings.
  --check                         Don't write the files back, just return the
                                  status.  Return code 0 means nothing would
                                  change.  Return code 1 means some files
                                  would be reformatted. Return code 123 means
                                  there was an internal error.

  --diff                          Don't write the files back, just output a
                                  diff for each file on stdout.

  --color / --no-color            Show colored diff. Only applies when
                                  `--diff` is given.

  --fast / --safe                 If --fast given, skip temporary sanity
                                  checks. [default: --safe]

  --include TEXT                  A regular expression that matches files and
                                  directories that should be included on
                                  recursive searches.  An empty value means
                                  all files are included regardless of the
                                  name.  Use forward slashes for directories
                                  on all platforms (Windows, too).  Exclusions
                                  are calculated first, inclusions later.
                                  [default: \.pyi?$]

  --exclude TEXT                  A regular expression that matches files and
                                  directories that should be excluded on
                                  recursive searches.  An empty value means no
                                  paths are excluded. Use forward slashes for
                                  directories on all platforms (Windows, too).
                                  Exclusions are calculated first, inclusions
                                  later.  [default: /(\.eggs|\.git|\.hg|\.mypy
                                  _cache|\.nox|\.tox|\.venv|\.svn|_build|buck-
                                  out|build|dist)/]

  --force-exclude TEXT            Like --exclude, but files and directories
                                  matching this regex will be excluded even
                                  when they are passed explicitly as arguments.

  -q, --quiet                     Don't emit non-error messages to stderr.
                                  Errors are still emitted; silence those with
                                  2>/dev/null.

  -v, --verbose                   Also emit messages to stderr about files
                                  that were not changed or were ignored due to
                                  --exclude=.

  --version                       Show the version and exit.
  --config FILE                   Read configuration from FILE path.
  -h, --help                      Show this message and exit.Blackis a well-behaved Unix-style command-line tool:it does nothing if no sources are passed to it;it will read from standard input and write to standard output if-is used as the
filename;it only outputs messages to users on standard error;exits with code 0 unless an internal error occurred (or--checkwas used).UsingBlackwith other toolsWhileBlackenforces formatting that conforms to PEP 8, other tools may raise warnings
aboutBlack's changes or will overwriteBlack's changes. A good example of this isisort. SinceBlackis barely configurable, these tools
should be configured to neither warn about nor overwriteBlack's changes.Actual details onBlackcompatible configurations for various tools can be found incompatible_configs.Migrating your code style without ruining git blameA long-standing argument against moving to automated code formatters likeBlackis
that the migration will clutter up the output ofgit blame. This was a valid argument,
but since Git version 2.23, Git natively supportsignoring revisions in blamewith the--ignore-revoption. You can also pass a file listing the revisions to ignore
using the--ignore-revs-fileoption. The changes made by the revision will be ignored
when assigning blame. Lines modified by an ignored revision will be blamed on the
previous revision that modified those lines.So when migrating your project's code style toBlack, reformat everything and commit
the changes (preferably in one massive commit). Then put the full 40 characters commit
identifier(s) into a file.# Migrate code style to Black
5b4ab991dede475d393e9d69ec388fd6bd949699Afterwards, you can pass that file togit blameand see clean and meaningful blame
information.$gitblameimportant.py--ignore-revs-file.git-blame-ignore-revs7a1ae265 (John Smith 2019-04-15 15:55:13 -0400 1) def very_important_function(text, file):abdfd8b0 (Alice Doe  2019-09-23 11:39:32 -0400 2)     text = text.lstrip()7a1ae265 (John Smith 2019-04-15 15:55:13 -0400 3)     with open(file, "r+") as f:7a1ae265 (John Smith 2019-04-15 15:55:13 -0400 4)         f.write(formatted)You can even configuregitto automatically ignore revisions listed in a file on every
call togit blame.$gitconfigblame.ignoreRevsFile.git-blame-ignore-revsThe one caveat is that GitHub and GitLab do not yet support ignoring revisions using
their native UI of blame.So blame information will be cluttered with a reformatting
commit on those platforms. (If you'd like this feature, there's an open issue forGitLaband please let GitHub
know!)NOTE: This is a beta productBlackis alreadysuccessfully usedby many
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 "Beta"
trove classifier, as well as by the "b" in the version number. What this means for you
is thatuntil the formatter becomes stable, 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,Blackwill check that the reformatted code still
produces a valid AST that is equivalent to the original. This slows it down. If you're
feeling confident, use--fast.TheBlackcode styleBlackis a PEP 8 compliant opinionated formatter.Blackreformats entire files in
place. It is not configurable. It doesn't take previous formatting into account. Your
main option of configuringBlackis that it doesn't reformat blocks that start with# fmt: offand end with# fmt: on.# fmt: on/offhave to be on the same level of
indentation. To learn more aboutBlack's opinions, to gothe_black_code_style.Please refer to this document before submitting an issue. What seems like a bug might be
intended behaviour.PragmatismEarly versions ofBlackused to be absolutist in some respects. They took after its
initial author. This was fine at the time as it made the implementation simpler and
there were not many users anyway. Not many edge cases were reported. As a mature tool,Blackdoes make some exceptions to rules it otherwise holds. Thissectionofthe_black_code_styledescribes what those exceptions are and why this is the case.Please refer to this document before submitting an issue just like with the document
above. What seems like a bug might be intended behaviour.pyproject.tomlBlackis able to read project-specific default values for its command line options
from apyproject.tomlfile. This is especially useful for specifying custom--includeand--excludepatterns for your project.Pro-tip: If you're asking yourself "Do I need to configure anything?" the answer is
"No".Blackis all about sensible defaults.What on Earth is apyproject.tomlfile?PEP 518definespyproject.tomlas a
configuration file to store build system requirements for Python projects. With the help
of tools likePoetryorFlitit can fully replace the need forsetup.pyandsetup.cfgfiles.WhereBlacklooks for the fileBy defaultBlacklooks forpyproject.tomlstarting from the common base directory of
all files and directories passed on the command line. If it's not there, it looks in
parent directories. It stops looking when it finds the file, or a.gitdirectory, or a.hgdirectory, or the root of the file system, whichever comes first.If you're formatting standard input,Blackwill look for configuration starting from
the current working directory.You can also explicitly specify the path to a particular file that you want with--config. In this situationBlackwill not look for any other file.If you're running with--verbose, you will see a blue message if a file was found and
used.Please noteblackdwill not usepyproject.tomlconfiguration.Configuration formatAs the file extension suggests,pyproject.tomlis aTOMLfile. It contains separate sections for
different tools.Blackis using the[tool.black]section. The option keys are the
same as long names of options on the command line.Note that you have to use single-quoted strings in TOML for regular expressions. It's
the equivalent of r-strings in Python. Multiline strings are treated as verbose regular
expressions by Black. Use[ ]to denote a significant space character.Examplepyproject.toml[tool.black]line-length=88target-version=['py37']include='\.pyi?$'exclude='''(/(\.eggs         # exclude a few common directories in the| \.git          # root of the project| \.hg| \.mypy_cache| \.tox| \.venv| _build| buck-out| build| dist)/| foo.py           # also separately exclude a file named foo.py in# the root of the project)'''Lookup hierarchyCommand-line options have defaults that you can see in--help. Apyproject.tomlcan
override those defaults. Finally, options provided by the user on the command line
override both.Blackwill only ever use onepyproject.tomlfile during an entire run. It doesn't
look for multiple files, and doesn't compose configuration from different levels of the
file hierarchy.Editor integrationBlackcan be integrated into many editors with plugins. They let you runBlackon
your code with the ease of doing it in your editor. To get started usingBlackin your
editor of choice, please seeeditor_integration.Patches are welcome for editors without an editor integration or plugin! More
information can be found ineditor_integration.blackdblackdis a small HTTP server that exposes Black's functionality over a simple
protocol. The main benefit of using it is to avoid paying the cost of starting up a new
Black process every time you want to blacken a file. Please refer toblackdto get the ball
rolling.black-primerblack-primeris a tool built for CI (and humans) to haveBlack--checka number of
(configured inprimer.json) Git accessible projects in parallel.black_primerhas more
information regarding its usage and configuration.(A PR adding Mercurial support will be accepted.)Version control integrationUsepre-commit. Once youhave it installed, add this to the.pre-commit-config.yamlin your repository:repos:-repo:https://github.com/psf/blackrev:20.8b1# Replace by any tag/version: https://github.com/psf/black/tagshooks:-id:blacklanguage_version:python3# Should be a command that runs python3.6+Then runpre-commit installand you're ready to go.Avoid usingargsin the hook. Instead, store necessary configuration inpyproject.tomlso that editors and command-line usage of Black all behave consistently
for your project. SeeBlack's ownpyproject.tomlfor an
example.If you're already using Python 3.7, switch thelanguage_versionaccordingly. Finally,stableis a branch that tracks the latest release on PyPI. If you'd rather run on
master, this is also an option.GitHub ActionsCreate a file named.github/workflows/black.ymlinside your repository with:name:Linton:[push,pull_request]jobs:lint:runs-on:ubuntu-lateststeps:-uses:actions/checkout@v2-uses:actions/setup-python@v2-uses:psf/black@stableIgnoring unmodified filesBlackremembers files it has already formatted, unless the--diffflag is used or
code is passed via standard input. This information is stored per-user. The exact
location of the file depends on theBlackversion and the system on whichBlackis
run. The file is non-portable. The standard location on common operating systems is:Windows:C:\\Users\<username>\AppData\Local\black\black\Cache\<version>\cache.<line-length>.<file-mode>.picklemacOS:/Users/<username>/Library/Caches/black/<version>/cache.<line-length>.<file-mode>.pickleLinux:/home/<username>/.cache/black/<version>/cache.<line-length>.<file-mode>.picklefile-modeis an int flag that determines whether the file was formatted as 3.6+ only,
as .pyi, and whether string normalization was omitted.To override the location of these files on macOS or Linux, set the environment variableXDG_CACHE_HOMEto your preferred location. For example, if you want to put the cache
in the directory you're runningBlackfrom, setXDG_CACHE_HOME=.cache.Blackwill
then write the above files to.cache/black/<version>/.Used byThe following notable open-source projects trustBlackwith enforcing a consistent
code style: pytest, tox, Pyramid, Django Channels, Hypothesis, attrs, SQLAlchemy,
Poetry, PyPA applications (Warehouse, Bandersnatch, Pipenv, virtualenv), pandas, Pillow,
every Datadog Agent Integration, Home Assistant.The following organizations useBlack: Facebook, Dropbox, Mozilla, Quora.Are we missing anyone? Let us know.TestimonialsDusty Phillips,writer:Blackis opinionated so you don't have to be.Hynek Schlawack,creator ofattrs, core developer of
Twisted and CPython:An auto-formatter that doesn't suck is all I want for Xmas!Carl Meyer,Djangocore developer:At least the name is good.Kenneth Reitz, creator ofrequestsandpipenv:This vastly improves the formatting of our code. Thanks a ton!Show your styleUse the badge in your project's README.md:[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)Using the badge in README.rst:.. image:: https://img.shields.io/badge/code%20style-black-000000.svg
    :target: https://github.com/psf/blackLooks like this:LicenseMITContributing toBlackIn terms of inspiration,Blackis about as configurable asgofmt. This is
deliberate.Bug reports and fixes are always welcome! However, before you suggest a new feature or
configuration knob, ask yourself why you want it. If it enables better integration with
some workflow, fixes an inconsistency, speeds things up, and so on - go for it! On the
other hand, if your answer is "because I don't like a particular formatting" then you're
not ready to embraceBlackyet. Such changes are unlikely to get accepted. You can
still try but prepare to be disappointed.More details can be found inCONTRIBUTING.Change logThe log's become rather long. It moved to its own file.SeeCHANGES.AuthorsGlued together byŁukasz Langa.Maintained withCarol Willing,Carl Meyer,Jelle Zijlstra,Mika Naylor,Zsolt Dollenstein, andCooper Lees.Multiple contributions by:Abdur-Rahmaan JanhangeerAdam JohnsonAdam WilliamsonAlexander HuynhAlex VandiverAllan SimonAnders-Petter LjungquistAndrew ThorpAndrew ZhouAndreyAndy FreelandAnthony SottileArjaan BuijkArnav BorbornahArtem MalyshevAsger Hautop DrewsenAugie FacklerAviskar KCBatuhan TaşkayaBenjamin WohlwendBenjamin WoodruffBharat RaghunathanBrandt BucherBrett CannonBryan BugyiBryan ForbesCalum LindCharlesCharles ReidChristian ClaussChristian HeimesChuck WootersChris RoseCodey OxleyCongCooper Ry LeesDan DavisonDaniel HahlerDaniel M. CapellaDaniele EspostiDavid HothamDavid LukesDavid SzottenDenis LaxaldeDouglas ThordylanjblackEli TreuherzEmil HessmanFelix KohlgrüberFlorent ThieryFranciscoGiacomo TagliabueGreg GandenbergerGregory P. SmithGustavo CamargohauntsaninjaHadi AlqattanHeafordHugo BarreraHugo van KemenadeHynek SchlawackIvan KatanićJakub KadlubiecJakub WarczarekJan HnátekJason FriedJason FriedlandjgirardetJim BrännlundJimmy JiaJoe AntonakakisJon DufresneJonas ObristJonty WareingJose NazarioJoseph LarsonJosh BodeJosh HollandJosé PadillaJuan Luis Cano RodríguezkaiixKatie McLaughlinKatrin LeinweberKeith SmileyKenyon RalphKevin KirscheKyle HausmannKyle SundenLawrence ChanLinus GrohLoren CarvalhoLuka SterbicLukasDrudeMahmoud HossamMariattaMatt VanEseltineMatthew ClappMatthew WalsterMax SmolensMichael AquilinaMichael FlaxmanMichael J. SullivanMichael McClimonMiguel GaiowskiMikemikehoyioMin ho KimMiroslav ShubernetskiyMomIsBestFriendNathan GoldbaumNathan HuntNerasteNikolaus WaxweilerOfek LevOsaetin DanielotstrelPablo GalindoPaul GansslePaul MeinhardtPeter BengtssonPeter GraysonPeter StensmyrpmacostaQuentin PradetRalf SchmittRamón VallesRichard FearnRichard SiRishikesh JhaRupert BedfordRussell DavisRémi VerscheldeSami SalonenSamuel Cormier-IijimaSanket DasguptaSergiScott StevensonShantanushaoranShinya FujinospringstanStavros KorokithakisStephen RosenSteven M. VascellaroSunil KapilSébastien EustaceTal AmuyalTerranceThom LuThomas GraingerTim GatesTim SwastTimoToby FlemingTom ChristieTony NarlockTsuyoshi HombashiTushar ChandraTzu-ping ChungUtsav Shahutsav-dbxvezeliVille SkyttäVishwas B SharmaVlad Emelianovwilliamfzcwouter bolsterleeYazdanYngve HøisethYurii KarabasZac Hatfield-DoddsChange LogUnreleasedBlackBlacknow respects--skip-string-normalizationwhen normalizing multiline
docstring quotes (#1637)Blackno longer removes all empty lines between non-function code and decorators
when formatting typing stubs. NowBlackenforces a single empty line. (#1646)Blackno longer adds an incorrect space after a parenthesized assignment expression
in if/while statements (#1655)fixed a crash when PWD=/ on POSIX (#1631)fixed "I/O operation on closed file" when using --diff (#1664)Prevent coloured diff output being interleaved with multiple files (#1673)Added support for PEP 614 relaxed decorator syntax on python 3.9 (#1711)20.8b1Packagingexplicitly depend on Click 7.1.2 or newer asBlackno longer works with versions
older than 7.020.8b0Blackre-implemented support for explicit trailing commas: now it works consistently within
any bracket pair, including nested structures (#1288 and duplicates)Blacknow reindents docstrings when reindenting code around it (#1053)Blacknow shows colored diffs (#1266)Blackis now packaged using 'py3' tagged wheels (#1388)Blacknow supports Python 3.8 code, e.g. star expressions in return statements
(#1121)Blackno longer normalizes capital R-string prefixes as those have a
community-accepted meaning (#1244)Blacknow uses exit code 2 when specified configuration file doesn't exit (#1361)Blacknow works on AWS Lambda (#1141)added--force-excludeargument (#1032)removed deprecated--py36option (#1236)fixed--diffoutput when EOF is encountered (#526)fixed# fmt: offhandling around decorators (#560)fixed unstable formatting with some# type: ignorecomments (#1113)fixed invalid removal on organizing brackets followed by indexing (#1575)introducedblack-primer, a CI tool that allows us to run regression tests against
existing open source users of Black (#1402)introduced property-based fuzzing to our test suite based on Hypothesis and
Hypothersmith (#1566)implemented experimental and disabled by default long string rewrapping (#1132),
hidden under a--experimental-string-processingflag while it's being worked on;
this is an undocumented and unsupported feature, you lose Internet points for
depending on it (#1609)Vim pluginprefer virtualenv packages over global packages (#1383)19.10b0added support for PEP 572 assignment expressions (#711)added support for PEP 570 positional-only arguments (#943)added support for async generators (#593)added support for pre-splitting collections by putting an explicit trailing comma
inside (#826)addedblack -cas a way to format code passed from the command line (#761)--safe now works with Python 2 code (#840)fixed grammar selection for Python 2-specific code (#765)fixed feature detection for trailing commas in function definitions and call sites
(#763)# fmt: off/# fmt: oncomment pairs placed multiple times within the same block of
code now behave correctly (#1005)Blackno longer crashes on Windows machines with more than 61 cores (#838)Blackno longer crashes on standalone comments prepended with a backslash (#767)Blackno longer crashes onfrom...importblocks with comments (#829)Blackno longer crashes on Python 3.7 on some platform configurations (#494)Blackno longer fails on comments in from-imports (#671)Blackno longer fails when the file starts with a backslash (#922)Blackno longer merges regular comments with type comments (#1027)Blackno longer splits long lines that contain type comments (#997)removed unnecessary parentheses aroundyieldexpressions (#834)added parentheses around long tuples in unpacking assignments (#832)added parentheses around complex powers when they are prefixed by a unary operator
(#646)fixed bug that ledBlackformat some code with a line length target of 1 (#762)Blackno longer introduces quotes in f-string subexpressions on string boundaries
(#863)ifBlackputs parenthesis around a single expression, it moves comments to the
wrapped expression instead of after the brackets (#872)blackdnow returns the version ofBlackin the response headers (#1013)blackdcan now output the diff of formats on source code when theX-Diffheader is
provided (#969)19.3b0new option--target-versionto control which Python versionsBlack-formatted code
should target (#618)deprecated--py36(use--target-version=py36instead) (#724)Blackno longer normalizes numeric literals to include_separators (#696)longdelstatements are now split into multiple lines (#698)type comments are no longer mangled in function signaturesimproved performance of formatting deeply nested data structures (#509)Blacknow properly formats multiple files in parallel on Windows (#632)Blacknow creates cache files atomically which allows it to be used in parallel
pipelines (likexargs -P8) (#673)Blacknow correctly indents comments in files that were previously formatted with
tabs (#262)blackdnow supports CORS (#622)18.9b0numeric literals are now formatted byBlack(#452, #461, #464, #469):numeric literals are normalized to include_separators on Python 3.6+ codeadded--skip-numeric-underscore-normalizationto disable the above behavior and
leave numeric underscores as they were in the inputcode with_in numeric literals is recognized as Python 3.6+most letters in numeric literals are lowercased (e.g., in1e10,0x01)hexadecimal digits are always uppercased (e.g.0xBADC0DE)addedblackd, seeits documentationfor more info (#349)adjacent string literals are now correctly split into multiple lines (#463)trailing comma is now added to single imports that don't fit on a line (#250)cache is now populated when--checkis successful for a file which speeds up
consecutive checks of properly formatted unmodified files (#448)whitespace at the beginning of the file is now removed (#399)fixed manglingpweaveandSpyder IDEspecial comments (#532)fixed unstable formatting when unpacking big tuples (#267)fixed parsing of__future__imports with renames (#389)fixed scope of# fmt: offwhen directly precedingyieldand other nodes (#385)fixed formatting of lambda expressions with default arguments (#468)fixedasync forstatements:Blackno longer breaks them into separate lines (#372)note: the Vim plugin stopped registering,=as a default chord as it turned out to
be a bad idea (#415)18.6b4hotfix: don't freeze when multiple comments directly precede# fmt: off(#371)18.6b3typing stub files (.pyi) now have blank lines added after constants (#340)# fmt: offand# fmt: onare now much more dependable:they now work also within bracket pairs (#329)they now correctly work across function/class boundaries (#335)they now work when an indentation block starts with empty lines or misaligned
comments (#334)made Click not fail on invalid environments; note that Click is right but the
likelihood we'll need to access non-ASCII file paths when dealing with Python source
code is low (#277)fixed improper formatting of f-strings with quotes inside interpolated expressions
(#322)fixed unnecessary slowdown when long list literals where found in a filefixed unnecessary slowdown on AST nodes with very many siblingsfixed cannibalizing backslashes during string normalizationfixed a crash due to symbolic links pointing outside of the project directory (#338)18.6b2added--config(#65)added-hequivalent to--help(#316)fixed improper unmodified file caching when-Swas usedfixed extra space in string unpacking (#305)fixed formatting of empty triple quoted strings (#313)fixed unnecessary slowdown in comment placement calculation on lines without comments18.6b1hotfix: don't output human-facing information on stdout (#299)hotfix: don't output cake emoji on non-zero return code (#300)18.6b0added--includeand--exclude(#270)added--skip-string-normalization(#118)added--verbose(#283)the header output in--diffnow actually conforms to the unified diff specfixed long trivial assignments being wrapped in unnecessary parentheses (#273)fixed unnecessary parentheses when a line contained multiline strings (#232)fixed stdin handling not working correctly if an old version of Click was used (#276)Blacknow preserves line endings when formatting a file in place (#258)18.5b1added--pyi(#249)added--py36(#249)Python grammar pickle caches are stored with the formatting caches, makingBlackwork in environments where site-packages is not user-writable (#192)Blacknow enforces a PEP 257 empty line after a class-level docstring (and/or
fields) and the first methodfixed 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: offsections (#224)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)fixed extra empty line between a class declaration and the first method if no class
docstring or fields are present (#219)fixed extra empty line between a function signature and an inner function or inner
class (#196)18.5b0call chains are now formatted according to thefluent interfacesstyle (#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)parentheses are now also managed automatically on the right-hand side of assignments
and return statements (#140)math operators now use their respective priorities for delimiting multiline
expressions (#148)optional parentheses are now omitted on expressions that start or end with a bracket
and only contain a single operator (#177)empty parentheses in a class definition are now removed (#145, #180)string prefixes are now standardized to lowercase anduis removed on Python 3.6+
only code and Python 2.7+ code with theunicode_literalsfuture import (#188, #198,
#199)typing stub files (.pyi) are now formatted in a style that is consistent with PEP
484 (#207, #210)progress when reformatting many files is now reported incrementallyfixed trailers (content with brackets) being unnecessarily exploded into their own
lines after a dedented closing bracket (#119)fixed an invalid trailing comma sometimes left in imports (#185)fixed non-deterministic formatting when multiple pairs of removable parentheses were
used (#183)fixed multiline strings being unnecessarily wrapped in optional parentheses in long
assignments (#215)fixed not splitting long from-imports with only a single namefixed Python 3.6+ file discovery by also looking at function calls with unpacking.
This fixed non-deterministic formatting if trailing commas where used both in function
signatures with stars and function calls with stars but the former would be
reformatted to a single line.fixed crash on dealing with optional parentheses (#193)fixed "is", "is not", "in", and "not in" not considered operators for splitting
purposesfixed crash when dead symlinks where encountered18.4a4don't populate the cache on--check(#175)18.4a3added a "cache"; files already reformatted that haven't changed on disk won't be
reformatted again (#109)--checkand--diffare no longer mutually exclusive (#149)generalized star expression handling, including double stars; this fixes
multiplication making expressions "unsafe" for trailing commas (#132)Blackno longer enforces putting empty lines behind control flow statements (#90)Blacknow splits imports like "Mode 3 + trailing comma" of isort (#127)fixed comment indentation when a standalone comment closes a block (#16, #32)fixed standalone comments receiving extra empty lines if immediately preceding a
class, def, or decorator (#56, #154)fixed--diffnot showing entire path (#130)fixed parsing of complex expressions after star and double stars in function calls
(#2)fixed invalid splitting on comma in lambda arguments (#133)fixed missing splits of ternary expressions (#141)18.4a2fixed parsing of unaligned standalone comments (#99, #112)fixed placement of dictionary unpacking inside dictionary literals (#111)Vim plugin now works on Windows, toofixed unstable formatting when encountering unnecessarily escaped quotes in a string
(#120)18.4a1added--quiet(#78)added automatic parentheses management (#4)addedpre-commitintegration (#103, #104)fixed reporting on--checkwith multiple files (#101, #102)fixed removing backslash escapes from raw strings (#100, #105)18.4a0added--diff(#87)add line breaks before all delimiters, except in cases like commas, to better comply
with PEP 8 (#73)standardize string literals to use double quotes (almost) everywhere (#75)fixed handling of standalone comments within nested bracketed expressions;Blackwill no longer produce super long lines or put all standalone comments at the end of
the expression (#22)fixed 18.3a4 regression: don't crash and burn on empty lines with trailing whitespace
(#80)fixed 18.3a4 regression:# yapf: disableusage as trailing comment would causeBlackto not emit the rest of the file (#95)when CTRL+C is pressed while formatting many files,Blackno longer freaks out with
a flurry of asyncio-related exceptionsonly allow up to two empty lines on module level and only single empty lines within
functions (#74)18.3a4# fmt: offand# fmt: onare implemented (#5)automatic detection of deprecated Python 2 forms of print statements and exec
statements in the formatted file (#49)use proper spaces for complex expressions in default values of typed function
arguments (#60)only return exit code 1 when --check is used (#50)don't remove single trailing commas from square bracket indexing (#59)don't omit whitespace if the previous factor leaf wasn't a math operator (#55)omit extra space in kwarg unpacking if it's the first argument (#46)omit extra space inSphinx auto-attribute comments(#68)18.3a3don't remove single empty lines outside of bracketed expressions (#19)added ability to pipe formatting from stdin to stdin (#25)restored ability to format code with legacy usage ofasyncas a name (#20, #42)even better handling of numpy-style array indexing (#33, again)18.3a2changed positioning of binary operators to occur at beginning of lines instead of at
the end, followinga recent change to PEP 8(#21)ignore empty bracket pairs while splitting. This avoids very weirdly looking
formattings (#34, #35)remove a trailing comma if there is a single argument to a callif top level functions were separated by a comment, don't put four empty lines after
the upper functionfixed unstable formatting of newlines with importsfixed unintentional folding of post scriptum standalone comments into last statement
if it was a simple statement (#18, #28)fixed missing space in numpy-style array indexing (#33)fixed spurious space after star-based unary expressions (#31)18.3a1added--checkonly put trailing commas in function signatures and calls if it's safe to do so. If
the file is Python 3.6+ it's always safe, otherwise only safe if there are no*argsor**kwargsused in the signature or call. (#8)fixed invalid spacing of dots in relative imports (#6, #13)fixed invalid splitting after comma on unpacked variables in for-loops (#23)fixed spurious space in parenthesized set expressions (#7)fixed spurious space after opening parentheses and in default arguments (#14, #17)fixed spurious space after unary operators when the operand was a complex expression
(#15)18.3a0first published version, Happy 🍰 Day 2018!alpha qualitydate-versioned (see:https://calver.org/)