Metadata-Version: 2.5
Name: mo-black
Version: 4.6.26234
Summary: More Black! Denser Black formatting
Project-URL: Documentation, https://black.readthedocs.io/
Project-URL: Changelog, https://github.com/klahnakoski/mo-black/blob/master/CHANGES.md
Project-URL: Repository, https://github.com/klahnakoski/mo-black
Project-URL: Issues, https://github.com/klahnakoski/mo-black/issues
Author-email: Łukasz Langa <lukasz@langa.pl>
Maintainer-email: Kyle Lahnakoski <kyle@lahnakoski.com>
License-Expression: MIT
License-File: LICENSE
Keywords: automation,autopep8,formatter,gofmt,pyfmt,rustfmt,yapf
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.10
Requires-Dist: click>=8.0.0
Requires-Dist: mypy-extensions>=0.4.3
Requires-Dist: packaging>=22.0
Requires-Dist: pathspec>=1.0.0
Requires-Dist: platformdirs>=2
Requires-Dist: pytokens~=0.4.0
Requires-Dist: tomli>=1.1.0; python_version < '3.11'
Requires-Dist: typing-extensions>=4.0.1; python_version < '3.11'
Provides-Extra: colorama
Requires-Dist: colorama>=0.4.3; extra == 'colorama'
Provides-Extra: d
Requires-Dist: aiohttp>=3.10; extra == 'd'
Provides-Extra: jupyter
Requires-Dist: ipython>=7.8.0; extra == 'jupyter'
Requires-Dist: tokenize-rt>=3.2.0; extra == 'jupyter'
Provides-Extra: uvloop
Requires-Dist: uvloop>=0.15.2; (sys_platform != 'win32') and extra == 'uvloop'
Requires-Dist: winloop>=0.5.0; (sys_platform == 'win32') and extra == 'uvloop'
Description-Content-Type: text/markdown

# More Black! - Denser Black formatting

This is a fork of [the Black code formatter](https://github.com/psf/black)

### Requires Python 3.10

_Black_ itself requires Python 3.10 or later to run. It still formats code written for
Python 3.3 through 3.15.

### Problem

I love Black formatting because I agree with its formatting choices, but it does have
one pathology:
[Excessive indenting on data structures](https://github.com/psf/black/issues/626)

Here is an example of Black formatting; many lines are wasted on lonely brackets:

```python
my_method(
    [
        {
            "name": "a",
            "value": 42,
        }
    ]
)
```

## Solution: More Black!

When there is only one property (or list item, or parameter), then do not make a new
line.

```python
my_method([{
    "name": "a",
    "value": 42,
}])
```

## Usage

Please [read the official Black documentation](https://black.readthedocs.io/en/stable/).
The command is still `black`, and every option works the same.

    pip install mo-black

## More about this fork

Three rules differ from upstream, all of them in
[`src/black/linegen.py`](https://github.com/klahnakoski/mo-black/blob/dev/src/black/linegen.py)
and
[`src/black/brackets.py`](https://github.com/klahnakoski/mo-black/blob/dev/src/black/brackets.py):

**A bracket whose body is a single item is not split there.** `_body_is_lone_item()`
decides the body is one thing — no comma, no operator, no `and`/`or`/`if`/`in`/`is` at
that depth — and the split descends into it instead, leaving the brackets hugged. It
applies at every depth, so nested single-key dictionaries collapse together:

```python
schema = {"mappings": {"test": {"properties": {"one_value": {
    "type": "keyword",
    "store": True,
}}}}}
```

**Every attribute dot is a split point**, not only a dot that follows a call, so a long
method chain breaks before each name.

**Parentheses around something already atomic are removed.** `not (a)` becomes `not a`,
and `foo((a), (b))` becomes `foo(a, b)`. Every slot in the grammar's precedence cascade
bottoms out at `atom`, so parentheses around one group nothing. Parentheses that group,
build a tuple, or make a generator are left alone.

Everything else is upstream _Black_.

## Development

Be sure you are in the `mo-black` main directory.

Setup virtual environment

    python -m venv .venv
    .venv\Scripts\activate

Install the package and its test requirements

    pip install -e ".[d,jupyter]" pytest pytest-xdist

Run the tests

    pytest tests

Here is the same for Linux and macOS...

    python -m venv .venv
    source .venv/bin/activate
    pip install -e ".[d,jupyter]" pytest pytest-xdist
    pytest tests

### Deployment

`packaging/deploy.py` builds the distributions and uploads them.

    python packaging/deploy.py --next-version           # what the next release would be
    python packaging/deploy.py --compiled --build-only  # build it all, upload nothing
    python packaging/deploy.py --compiled               # and upload

The version is never written into a file: `deploy.py` works out the next
`major.minor.%y%j` and hands it to the build. Uploading happens only from `master`, and
the tag is written afterwards, once PyPI has accepted.

`--compiled` additionally builds the mypyc wheels, which is what makes _Black_ fast: one
per interpreter and platform, in parallel, taking around twenty minutes. Without it you
get the pure-Python wheel, which formats about 1.7x slower.
