black-mercor

The uncompromising Python code formatter

https://github.com/dsmith-oss-2/black-mercor

Science Score: 54.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
    12 of 470 committers (2.6%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (17.6%) to scientific vocabulary

Keywords from Contributors

autopep8 codeformatter formatter gofmt pre-commit-hook yapf closember pydantic json-schema parsing
Last synced: 6 months ago · JSON representation ·

Repository

The uncompromising Python code formatter

Basic Info
Statistics
  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • Open Issues: 0
  • Releases: 0
Created 10 months ago · Last pushed 10 months ago
Metadata Files
Readme Changelog Contributing License Code of conduct Citation Security Authors

README.md

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

Note

pytest 3.1.1 will soon be deprecated, refer to the pyproject.toml for the latest version.

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:

sh black {source_file_or_directory}

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

sh 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:

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.

Citation (CITATION.cff)

cff-version: 1.2.0
title: "Black: The uncompromising Python code formatter"
message: >-
  If you use this software, please cite it using the metadata from this file.
type: software
authors:
  - family-names: Langa
    given-names: Łukasz
  - name: "contributors to Black"
repository-code: "https://github.com/psf/black"
url: "https://black.readthedocs.io/en/stable/"
abstract: >-
  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.
license: MIT
                                                                                                                                                                                                                                                                                                                                                                                                                                            

GitHub Events

Total
  • Fork event: 8
Last Year
  • Fork event: 8

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 2,422
  • Total Committers: 470
  • Avg Commits per committer: 5.153
  • Development Distribution Score (DDS): 0.819
Past Year
  • Commits: 546
  • Committers: 35
  • Avg Commits per committer: 15.6
  • Development Distribution Score (DDS): 0.196
Top Committers
Name Email Commits
blk-jd d****2@g****m 439
Łukasz Langa l****z@l****l 372
Jelle Zijlstra j****a@g****m 193
Richard Si 6****6 131
dependabot[bot] 4****] 119
Shantanu 1****a 104
Zsolt Dollenstein z****l@g****m 78
Cooper Lees me@c****m 70
Hugo van Kemenade h****k 50
Yilei "Dolee" Yang y****g@g****m 42
Batuhan Taskaya i****l@g****m 25
Felix Hildén f****n@g****m 25
Marco Edward Gorelli m****i@p****m 21
James Addison j****y@j****t 16
cobalt 6****2 14
Bryan Bugyi b****4@g****m 14
Michael J. Sullivan s****y@m****t 12
GiGaGon 1****n 11
Jon Dufresne j****e@g****m 11
Tushar Sadhwani t****0@g****m 11
Henri Holopainen h****n@g****m 10
pre-commit-ci[bot] 6****] 10
Joe Young 8****t 10
rdrll 1****l 9
Anthony Sottile a****e@u****u 9
Nipunn Koorapati n****3@g****m 8
Sagi Shadur s****2@g****m 7
Alex Waygood A****d@G****m 7
Yurii Karabas 1****o@g****m 6
Shivansh-007 s****7@o****m 6
and 440 more...

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 0
  • Total pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Total issue authors: 0
  • Total pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
Top Labels
Issue Labels
Pull Request Labels

Dependencies

.github/workflows/changelog.yml actions
  • actions/checkout v4 composite
.github/workflows/diff_shades.yml actions
  • actions/cache v4 composite
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
  • actions/upload-artifact v4 composite
.github/workflows/diff_shades_comment.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
  • peter-evans/create-or-update-comment 71345be0265236311c031f5c7866368bd1eff043 composite
  • peter-evans/find-comment 3eae4d37986fb5a8592848f6a574fdf654e61f9e composite
.github/workflows/doc.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
.github/workflows/docker.yml actions
  • actions/checkout v4 composite
  • docker/build-push-action v6 composite
  • docker/login-action v3 composite
  • docker/setup-buildx-action v3 composite
  • docker/setup-qemu-action v3 composite
.github/workflows/fuzz.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
.github/workflows/lint.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
  • pre-commit/action v3.0.1 composite
.github/workflows/pypi_upload.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
  • actions/upload-artifact v4 composite
  • pypa/cibuildwheel v2.23.3 composite
.github/workflows/release_tests.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
.github/workflows/test.yml actions
  • AndreMiras/coveralls-python-action ac868b9540fad490f7ca82b8ca00480fd751ed19 composite
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
.github/workflows/upload_binary.yml actions
  • actions/checkout v4 composite
  • actions/setup-python v5 composite
  • actions/upload-release-asset v1 composite
action.yml actions
Dockerfile docker
  • python 3.12-slim build
gallery/Dockerfile docker
  • python 3.8.2-slim build
docs/compatible_configs/isort/pyproject.toml pypi
docs/compatible_configs/pylint/pyproject.toml pypi
docs/requirements.txt pypi
  • Sphinx ==8.2.3
  • docutils ==0.21.2
  • furo ==2024.8.6
  • myst-parser ==4.0.1
  • sphinx_copybutton ==0.5.2
  • sphinxcontrib-programoutput ==0.18
pyproject.toml pypi
  • 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'
test_requirements.txt pypi
  • coverage >=5.3 test
  • pre-commit * test
  • pytest ==3.1.1 test
  • pytest-cov >=4.1.0 test
  • pytest-xdist >=3.0.2 test
  • tox * test
tests/data/include_exclude_tests/pyproject.toml pypi
tests/data/invalid_gitignore_tests/pyproject.toml pypi
tests/data/invalid_nested_gitignore_tests/pyproject.toml pypi
tests/data/nested_gitignore_tests/pyproject.toml pypi