root/alpine313/: black-25.9.0 metadata and description

Simple index PyPI page

The uncompromising code formatter.

author_email Łukasz Langa <lukasz@langa.pl>
classifiers
  • Development Status :: 5 - Production/Stable
  • Environment :: Console
  • Intended Audience :: Developers
  • License :: OSI Approved :: MIT License
  • Operating System :: OS Independent
  • Programming Language :: Python
  • Programming Language :: Python :: 3 :: Only
  • Programming Language :: Python :: 3.9
  • Programming Language :: Python :: 3.10
  • Programming Language :: Python :: 3.11
  • Programming Language :: Python :: 3.12
  • Programming Language :: Python :: 3.13
  • Topic :: Software Development :: Libraries :: Python Modules
  • Topic :: Software Development :: Quality Assurance
description_content_type text/markdown
keywords automation, autopep8, formatter, gofmt, pyfmt, rustfmt, yapf
license_expression MIT
license_file
  • AUTHORS.md
  • LICENSE
project_urls
  • Documentation, https://black.readthedocs.io/
  • Changelog, https://github.com/psf/black/blob/main/CHANGES.md
  • Repository, https://github.com/psf/black
  • Issues, https://github.com/psf/black/issues
requires_dist
  • click>=8.0.0
  • mypy-extensions>=0.4.3
  • packaging>=22.0
  • pathspec>=0.9.0
  • platformdirs>=2
  • pytokens>=0.1.10
  • tomli>=1.1.0; python_version < '3.11'
  • typing-extensions>=4.0.1; python_version < '3.11'
  • colorama>=0.4.3; extra == 'colorama'
  • aiohttp>=3.10; extra == 'd'
  • ipython>=7.8.0; extra == 'jupyter'
  • tokenize-rt>=3.2.0; extra == 'jupyter'
  • uvloop>=0.15.2; extra == 'uvloop'
requires_python >=3.9
File Tox results History
black-25.9.0-py3-none-any.whl
Size
199 KB
Type
Python Wheel
Python
3

Black Logo

The Uncompromising Code Formatter

Actions Status Documentation Status Coverage Status License: MIT PyPI Downloads conda-forge Code style: black

“Any color you like.”

Black is the uncompromising Python code formatter. By using it, you agree to cede control over minutiae of hand-formatting. In return, Black gives you speed, determinism, and freedom from pycodestyle nagging 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.

Black makes code review faster by producing the smallest diffs possible.

Try it out now using the Black Playground. Watch the PyCon 2019 talk to learn more.


Read the documentation on ReadTheDocs!


Installation and usage

Installation

Black can be installed by running pip install black. It requires Python 3.9+ to run. If you want to format Jupyter Notebooks, install with pip install "black[jupyter]".

If you can't wait for the latest hotness and want to install from GitHub, use:

pip install git+https://github.com/psf/black

Usage

To get started right away with sensible defaults:

black {source_file_or_directory}

You can run Black as a package if running it as a script doesn't work:

python -m black {source_file_or_directory}

Further information can be found in our docs:

Black is already successfully used by many projects, small and big. Black has a comprehensive test suite, with efficient parallel tests, and our own auto formatting and parallel Continuous Integration runner. Now that we have become stable, you should not expect large formatting changes in the future. Stylistic changes will mostly be responses to bug reports and support for new Python syntax. For more information please refer to The Black Code Style.

Also, as a safety measure which slows down processing, Black will check that the reformatted code still produces a valid AST that is effectively equivalent to the original (see the Pragmatism section for details). If you're feeling confident, use --fast.

The Black code style

Black is a PEP 8 compliant opinionated formatter. Black reformats entire files in place. Style configuration options are deliberately limited and rarely added. It doesn't take previous formatting into account (see Pragmatism for exceptions).

Our documentation covers the current Black code style, but planned changes to it are also documented. They're both worth taking a look at:

Changes to the Black code style are bound by the Stability Policy:

Please refer to this document before submitting an issue. What seems like a bug might be intended behaviour.

Pragmatism

Early versions of Black used 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, Black does make some exceptions to rules it otherwise holds.

Please refer to this document before submitting an issue just like with the document above. What seems like a bug might be intended behaviour.

Configuration

Black is able to read project-specific default values for its command line options from a pyproject.toml file. This is especially useful for specifying custom --include and --exclude/--force-exclude/--extend-exclude patterns for your project.

You can find more details in our documentation:

And if you're looking for more general configuration documentation:

Pro-tip: If you're asking yourself "Do I need to configure anything?" the answer is "No". Black is all about sensible defaults. Applying those defaults will have your code in compliance with many other Black formatted projects.

Used by

The following notable open-source projects trust Black with enforcing a consistent code style: pytest, tox, Pyramid, Django, Django Channels, Hypothesis, attrs, SQLAlchemy, Poetry, PyPA applications (Warehouse, Bandersnatch, Pipenv, virtualenv), pandas, Pillow, Twisted, LocalStack, every Datadog Agent Integration, Home Assistant, Zulip, Kedro, OpenOA, FLORIS, ORBIT, WOMBAT, and many more.

The following organizations use Black: Dropbox, KeepTruckin, Lyft, Mozilla, Quora, Duolingo, QuantumBlack, Tesla, Archer Aviation.

Are we missing anyone? Let us know.

Testimonials

Mike Bayer, author of SQLAlchemy:

I can't think of any single tool in my entire programming career that has given me a bigger productivity increase by its introduction. I can now do refactorings in about 1% of the keystrokes that it would have taken me previously when we had no way for code to format itself.

Dusty Phillips, writer:

Black is opinionated so you don't have to be.

Hynek Schlawack, creator of attrs, core developer of Twisted and CPython:

An auto-formatter that doesn't suck is all I want for Xmas!

Carl Meyer, Django core developer:

At least the name is good.

Kenneth Reitz, creator of requests and pipenv:

This vastly improves the formatting of our code. Thanks a ton!

Show your style

Use 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/black

Looks like this: Code style: black

License

MIT

Contributing

Welcome! Happy to see you willing to make the project better. You can get started by reading this:

You can also take a look at the rest of the contributing docs or talk with the developers:

Change log

The log has become rather long. It moved to its own file.

See CHANGES.

Authors

The author list is quite long nowadays, so it lives in its own file.

See AUTHORS.md

Code of Conduct

Everyone participating in the Black project, and in particular in the issue tracker, pull requests, and social media activity, is expected to treat other people with respect and more generally to follow the guidelines articulated in the Python Community Code of Conduct.

At the same time, humor is encouraged. In fact, basic familiarity with Monty Python's Flying Circus is expected. We are not savages.

And if you really need to slap somebody, do it with a fish while dancing.

Change Log

25.9.0

Highlights

Stable style

Preview style

Parser

Performance

Integrations

Documentation

25.1.0

Highlights

This release introduces the new 2025 stable style (#4558), stabilizing the following changes:

The following changes were not in any previous release:

Stable style

Preview style

Packaging

Performance

Integrations

24.10.0

Highlights

Stable style

Preview style

Caching

Packaging

Output

24.8.0

Stable style

Packaging

Parser

Performance

Blackd

24.4.2

This is a bugfix release to fix two regressions in the new f-string parser introduced in 24.4.1.

Parser

Performance

24.4.1

Highlights

Stable style

Parser

Integrations

24.4.0

Stable style

Preview style

Integrations

24.3.0

Highlights

This release is a milestone: it fixes Black's first CVE security vulnerability. If you run Black on untrusted input, or if you habitually put thousands of leading tab characters in your docstrings, you are strongly encouraged to upgrade immediately to fix CVE-2024-21503.

This release also fixes a bug in Black's AST safety check that allowed Black to make incorrect changes to certain f-strings that are valid in Python 3.12 and higher.

Stable style

Performance

Documentation

24.2.0

Stable style

Preview style

Configuration

Output

Integrations

24.1.1

Bugfix release to fix a bug that made Black unusable on certain file systems with strict limits on path length.

Preview style

Configuration

24.1.0

Highlights

This release introduces the new 2024 stable style (#4106), stabilizing the following changes:

There are already a few improvements in the --preview style, which are slated for the 2025 stable style. Try them out and share your feedback. In the past, the preview style has included some features that we were not able to stabilize. This year, we're adding a separate --unstable style for features with known problems. Now, the --preview style only includes features that we actually expect to make it into next year's stable style.

Stable style

Several bug fixes were made in features that are moved to the stable style in this release:

Preview style

Configuration

Integrations

23.12.1

Packaging

23.12.0

Highlights

It's almost 2024, which means it's time for a new edition of Black's stable style! Together with this release, we'll put out an alpha release 24.1a1 showcasing the draft 2024 stable style, which we'll finalize in the January release. Please try it out and share your feedback.

This release (23.12.0) will still produce the 2023 style. Most but not all of the changes in --preview mode will be in the 2024 stable style.

Stable style

Preview style

Configuration

Packaging

Integrations

23.11.0

Highlights

Stable style

Preview style

Configuration

Performance

Integrations

23.10.1

Highlights

Preview style

Packaging

Integrations

Documentation

23.10.0

Stable style

Preview style

Configuration

Parser

Output

Integrations

23.9.1

Due to various issues, the previous release (23.9.0) did not include compiled mypyc wheels, which make Black significantly faster. These issues have now been fixed, and this release should come with compiled wheels once again.

There will be no wheels for Python 3.12 due to a bug in mypyc. We will provide 3.12 wheels in a future release as soon as the mypyc bug is fixed.

Packaging

Performance

23.9.0

Preview style

Configuration

Performance

Blackd

Integrations

23.7.0

Highlights

Stable style

Preview style

Configuration

Packaging

Parser

Performance

Output

Blackd

Integrations

Documentation

23.3.0

Highlights

This release fixes a longstanding confusing behavior in Black's GitHub action, where the version of the action did not determine the version of Black being run (issue #3382). In addition, there is a small bug fix around imports and a number of improvements to the preview style.

Please try out the preview style with black --preview and tell us your feedback. All changes in the preview style are expected to become part of Black's stable style in January 2024.

Stable style

Preview style

Parser

Integrations

Documentation

23.1.0

Highlights

This is the first release of 2023, and following our stability policy, it comes with a number of improvements to our stable style, including improvements to empty line handling, removal of redundant parentheses in several contexts, and output that highlights implicitly concatenated strings better.

There are also many changes to the preview style; try out black --preview and give us feedback to help us set the stable style for next year.

In addition to style changes, Black now automatically infers the supported Python versions from your pyproject.toml file, removing the need to set Black's target versions separately.

Stable style

Preview style

Configuration

Packaging

Output

Integrations

Documentation

22.12.0

Preview style

Configuration

Parser

Integrations

22.10.0

Highlights

Stable style

Preview style

Configuration

Packaging

Blackd

Integrations

22.8.0

Highlights

Stable style

Preview style

Blackd

Configuration

Documentation

Integrations

Output

Parser

Performance

22.6.0

Style

Preview style

Integrations

Output

Packaging

Parser

Vim Plugin

22.3.0

Preview style

Configuration

Documentation

Integrations

Output

Packaging

Parser

22.1.0

At long last, Black is no longer a beta product! This is the first non-beta release and the first release covered by our new stability policy.

Highlights

Style

Parser

Performance

Configuration

Output

Packaging

Integrations

Documentation

21.12b0

Black

Jupyter Notebook support

Python 3.10 support

Packaging

21.11b1

Black

21.11b0

Black

Integrations

21.10b0

Black

Blackd

Black-Primer

Integrations

21.9b0

Packaging

21.8b0

Black

Blackd

Integrations

21.7b0

Black

Docker

Integrations

21.6b0

Black

Integrations

21.5b2

Black

Blackd

Packaging

Documentation

21.5b1

Black

Documentation

21.5b0

Black

Black-Primer

21.4b2

Black

Packaging

21.4b1

Black

Packaging

21.4b0

Black

Packaging

20.8b1

Packaging

20.8b0

Black

Vim plugin

19.10b0

19.3b0

18.9b0

18.6b4

18.6b3

18.6b2

18.6b1

18.6b0

18.5b1

18.5b0

18.4a4

18.4a3

18.4a2

18.4a1

18.4a0

18.3a4

18.3a3

18.3a2

18.3a1

18.3a0