{"id":13501584,"url":"https://github.com/peterjc/flake8-black","last_synced_at":"2025-04-14T17:00:00.612Z","repository":{"id":39621648,"uuid":"165075936","full_name":"peterjc/flake8-black","owner":"peterjc","description":"flake8 plugin to run black for checking Python coding style","archived":false,"fork":false,"pushed_at":"2025-04-07T19:30:34.000Z","size":167,"stargazers_count":164,"open_issues_count":4,"forks_count":11,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-14T16:59:22.886Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/peterjc.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.rst","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-01-10T14:40:26.000Z","updated_at":"2025-04-07T19:30:36.000Z","dependencies_parsed_at":"2024-04-01T18:28:26.447Z","dependency_job_id":"c3b5e8ab-c882-47ce-b9c9-b4bb645336d4","html_url":"https://github.com/peterjc/flake8-black","commit_stats":{"total_commits":184,"total_committers":10,"mean_commits":18.4,"dds":"0.23369565217391308","last_synced_commit":"654756ceede426c9b4e23becb014c86cfbcf8e1f"},"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterjc%2Fflake8-black","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterjc%2Fflake8-black/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterjc%2Fflake8-black/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/peterjc%2Fflake8-black/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/peterjc","download_url":"https://codeload.github.com/peterjc/flake8-black/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248923721,"owners_count":21183951,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-07-31T22:01:42.422Z","updated_at":"2025-04-14T17:00:00.570Z","avatar_url":"https://github.com/peterjc.png","language":"Python","readme":"flake8-black\n============\n\n.. image:: https://img.shields.io/pypi/v/flake8-black.svg\n   :alt: Released on the Python Package Index (PyPI)\n   :target: https://pypi.org/project/flake8-black/\n.. image:: https://img.shields.io/conda/vn/conda-forge/flake8-black.svg\n   :alt: Released on Conda\n   :target: https://anaconda.org/conda-forge/flake8-black\n.. image:: https://results.pre-commit.ci/badge/github/peterjc/flake8-black/master.svg\n   :target: https://results.pre-commit.ci/latest/github/peterjc/flake8-black/master\n   :alt: pre-commit.ci status\n.. image:: https://img.shields.io/github/actions/workflow/status/peterjc/flake8-black/test.yml?logo=github-actions\n   :alt: GitHub workflow status\n   :target: https://github.com/peterjc/flake8-black/actions\n.. image:: https://img.shields.io/pypi/dm/flake8-black.svg\n   :alt: PyPI downloads\n   :target: https://pypistats.org/packages/flake8-black\n.. image:: https://img.shields.io/badge/code%20style-black-000000.svg\n   :alt: Code style: black\n   :target: https://github.com/python/black\n\nIntroduction\n------------\n\nThis is an MIT licensed `flake8 \u003chttps://github.com/pycqa/flake8\u003e`_ plugin\nfor validating Python code style with the command line code formatting tool\n`black \u003chttps://github.com/python/black\u003e`_. It is available to install from\nthe `Python Package Index (PyPI) \u003chttps://pypi.org/project/flake8-black/\u003e`_.\n\nBlack, *\"The Uncompromising Code Formatter\"*, is normally run to edit your\nPython code in place to match their coding style, a strict subset of the\n`PEP 8 style guide \u003chttps://www.python.org/dev/peps/pep-0008/\u003e`_.\n\nThe point of this plugin is to be able to run ``black --check ...`` from\nwithin the ``flake8`` plugin ecosystem. You might use this via a ``git``\npre-commit hook, or as part of your continuous integration testing.\n\nIf you are using `pre-commit \u003chttps://pre-commit.com/\u003e`_ configure it to call\nblack and/or flake8 directly - you do not need flake8-black at all.\n\nFlake8 Validation codes\n-----------------------\n\nEarly versions of flake8 assumed a single character prefix for the validation\ncodes, which became problematic with collisions in the plugin ecosystem. Since\nv3.0, flake8 has supported longer prefixes, therefore this plugin uses ``BLK``\nas its prefix.\n\n====== =======================================================================\nCode   Description (*and notes*)\n------ -----------------------------------------------------------------------\nBLK100 Black would make changes.\nBLK9## Internal error (*various, listed below*):\nBLK900 Failed to load file: ...\nBLK901 Invalid input.\nBLK997 Invalid TOML file: ...\nBLK998 Could not access flake8 line length setting (*no longer used*).\nBLK999 Unexpected exception.\n====== =======================================================================\n\nNote that if your Python code has a syntax error, ``black --check ...`` would\nreport this as an error. Likewise ``flake8 ...`` will by default report the\nsyntax error, but importantly it does not seem to then call the plugins, so\nyou will *not* get an additional ``BLK`` error.\n\n\nInstallation\n------------\n\nPython 3.8 or later is required, but ``black`` can be used on Python code\nwritten for older versions of Python.\n\nYou can install ``flake8-black`` using ``pip``, which should install ``flake8``\nand ``black`` as well if not already present::\n\n    $ pip install flake8-black\n\nAlternatively, if you are using the Anaconda packaging system, the following\ncommand will install the plugin with its dependencies::\n\n    $ conda install -c conda-forge flake8-black\n\nThe new validator should be automatically included when using ``flake8`` which\nmay now report additional validation codes starting with ``BLK`` (as defined\nabove). For example::\n\n    $ flake8 example.py\n\nYou can request only the ``BLK`` codes be shown using::\n\n    $ flake8 --select BLK example.py\n\nPython package management\n-------------------------\n\nFor large projects especially, you should consider pinning the exact\nversion of black you want to use as their updates do sometimes introduce\nchanges which would show up as new ``BLK100`` violations via flake8.\n\nYou should be able to specify your black version in your conda or pip\nrequirements or environment, or using using pipenv or poetry etc.\n\nConfiguration\n-------------\n\nWe assume you are familiar with `flake8 configuration\n\u003chttp://flake8.pycqa.org/en/latest/user/configuration.html\u003e`_ and\n`black configuration\n\u003chttps://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html#configuration-via-a-file\u003e`_.\n\nWe recommend using the following settings in your ``flake8`` configuration,\nfor example in your ``.flake8``, ``setup.cfg``, or ``tox.ini`` file::\n\n    [flake8]\n    # Recommend matching the black line length (default 88),\n    # rather than using the flake8 default of 79:\n    max-line-length = 88\n    extend-ignore =\n        # See https://github.com/PyCQA/pycodestyle/issues/373\n        E203,\n\nNote currently ``pycodestyle`` gives false positives on the spaces ``black``\nuses for slices, which ``flake8`` reports as ``E203: whitespace before ':'``.\nUntil `pyflakes issue 373 \u003chttps://github.com/PyCQA/pycodestyle/issues/373\u003e`_\nis fixed, and ``flake8`` is updated, we suggest disabling this style check.\n\nSeparately ``pyproject.toml`` is used for ``black`` configuration - if this\nfile is found, the plugin will look at the following ``black`` settings:\n\n* ``target_version``\n* ``skip_string_normalization``\n* ``line_length``\n\nYou can specify a particular path for the ``pyproject.toml`` file (e.g.\nglobal development settings) using ``--black-config FILENAME`` at the\ncommand line, or using ``black-config = FILENAME`` in your ``flake8``\nconfiguration file.\n\nIgnoring validation codes\n-------------------------\n\nUsing the flake8 no-quality-assurance pragma comment is not recommended (e.g.\nadding ``# noqa: BLK100`` to the first line black would change). Instead use\nthe black pragma comments ``# fmt: off`` at the start, and ``# fmt: on`` at\nthe end, of any region of your code which should not be changed. Or, add\n``# fmt: skip`` to single lines. Or, exclude the entire file by name (see\nbelow).\n\nIgnoring files\n--------------\n\nThe plugin does *NOT* currently consider the ``black`` settings ``include``\nand ``exclude``, so if you have certain Python files which you do not use\nwith ``black`` and have told it to ignore, you will *also* need to tell\n``flake8`` to ignore them (e.g. using ``exclude`` or ``per-file-ignores``).\n\n\nVersion History\n---------------\n\n======= ============ ===========================================================\nVersion Release date Changes\n------- ------------ -----------------------------------------------------------\nv0.3.7  *Pending*    - Now tested on Python 3.8 though 3.13.\n                     - Using `black.Mode` class name in place of legacy alias\n                       `black.FileMode` from beta release era.\nv0.3.6  2022-12-13   - Use standard library ``tomllib`` on Python 3.11 onwards,\n                       contribution from\n                       `Ganden Schaffner \u003chttps://github.com/gschaffner\u003e`_.\nv0.3.5  2022-11-21   - Fix regression clashing with ``flake8-rst-docstrings``.\nv0.3.4  2022-11-17   - Replaces ``setup.py`` with ``pyproject.toml`` for build.\nv0.3.3  2022-05-16   - Cope with line-length as string in pyproject.toml config.\nv0.3.2  2022-02-25   - Use ``tomli`` library to match black, contribution from\n                       `Brian Helba \u003chttps://github.com/brianhelba\u003e`_.\n                     - Adopted GitHub Actions to replace TravisCI testing.\n                     - Python 3.7 or later required.\nv0.3.0  2022-02-25   - Requires black v22.1.0 (first non-beta release) or later.\n                     - Support options \"preview\", \"skip-magic-trailing-comma\"\n                       in the black TOML file, contribution from\n                       `Ferdy \u003chttps://github.com/ferdynice\u003e`_.\nv0.2.4  2022-01-30   - Support black v22.1.0 which changed a function call,\n                       contribution from\n                       `Raffaele Salmaso \u003chttps://github.com/rsalmaso\u003e`_.\nv0.2.3  2021-07-16   - Made ``toml`` dependency explicit in ``setup.py``.\nv0.2.2  2021-07-16   - Declared ``toml`` dependency (for black 21.7b0).\nv0.2.1  2020-07-25   - Detect ``*.pyi`` files via extension.\nv0.2.0  2020-05-20   - Minimum requirement on black 19.3b0 or later is now\n                       implicit. This is a workaround for `pipenv issue 3928\n                       \u003chttps://github.com/pypa/pipenv/issues/3928\u003e`_. Upgrade\n                       black if running flake8 gives an error like this:\n                       ``Flake8 failed to load plugin \"BLK\" due to __call__()\n                       got an unexpected keyword argument 'target_versions'.``\nv0.1.2  2020-05-18   - Removed test broken by flake8 v3.8 change to resolve\n                       configuration files relative to current directory.\nv0.1.1  2019-08-26   - Option to use a (global) black configuration file,\n                       contribution from\n                       `Tomasz Grining \u003chttps://github.com/098799\u003e`_.\n                     - New ``BLK997`` if can't parse ``pyproject.toml`` file.\n                     - Logs configuration files, use ``-v`` or ``--verbose``.\n                     - Fixed flake8 \"builtins\" parameter warning.\n                     - Now requires black 19.3b0 or later.\nv0.1.0  2019-06-03   - Uses main black settings from ``pyproject.toml``,\n                       contribution from `Alex \u003chttps://github.com/ADKosm\u003e`_.\n                     - WARNING: Now ignores flake8 ``max-line-length`` setting.\nv0.0.4  2019-03-15   - Supports black 19.3b0 which changed a function call.\nv0.0.3  2019-02-21   - Bug fix when ``W292 no newline at end of file`` applies,\n                       contribution from\n                       `Sapphire Becker \u003chttps://github.com/sapphire-janrain\u003e`_.\nv0.0.2  2019-02-15   - Document syntax error behaviour (no BLK error reported).\nv0.0.1  2019-01-10   - Initial public release.\n                     - Passes flake8 ``max-line-length`` setting to black.\n======= ============ ===========================================================\n\n\nDevelopers\n----------\n\nThis plugin is on GitHub at https://github.com/peterjc/flake8-black\n\nDevelopers may install the plugin from the git repository with optional build\ndependencies::\n\n    $ pip install -e .[develop]\n\nTo make a new release once tested locally and online::\n\n    $ git tag vX.Y.Z\n    $ python -m build\n    $ git push origin master --tags\n    $ twine upload dist/flake8?black-X.Y.Z*\n\nThe PyPI upload should trigger an automated pull request updating the\n`flake8-black conda-forge recipe\n\u003chttps://github.com/conda-forge/flake8-black-feedstock/blob/master/recipe/meta.yaml\u003e`_.\n","funding_links":[],"categories":["Wrappers","Python","Linters \u0026 Style Checkers"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterjc%2Fflake8-black","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeterjc%2Fflake8-black","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeterjc%2Fflake8-black/lists"}