cercis


Namecercis JSON
Version 0.2.3 PyPI version JSON
download
home_page
SummaryA more configurable Python code formatter
upload_time2023-10-19 22:59:47
maintainer
docs_urlNone
authorjsh9
requires_python>=3.8
licenseMIT
keywords automation autopep8 formatter gofmt pyfmt rustfmt yapf
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # _Cercis_

[![](https://upload.wikimedia.org/wikipedia/commons/thumb/4/4c/Red_bud_2009.jpg/320px-Red_bud_2009.jpg)](https://en.wikipedia.org/wiki/Cercis)

_**Cercis**_ /ˈsɜːrsɪs/ is a Python code formatter that is more configurable than
[Black](https://github.com/psf/black) (a popular Python code formatter).

[_Cercis_](https://en.wikipedia.org/wiki/Cercis) is also the name of a deciduous tree
that boasts vibrant pink to purple-hued flowers, which bloom in early spring.

This code repository is forked from and directly inspired by
[Black](https://github.com/psf/black). The original license of Black is included in this
repository (see [LICENSE_ORIGINAL](./LICENSE_ORIGINAL)).

_Cercis_ inherited Black's very comprehensive test cases, which means we are confident
that our configurability addition does not introduce any undesirable side effects. We
also thoroughly tested every configurable options that we added.

In particular, via its configurable options, _Cercis_ can completely fall back to Black.
See [Section 4.5](#45-how-to-fall-back-to-blacks-behavior) below for more details.

**Table of Contents**

<!--TOC-->

- [1. Motivations](#1-motivations)
- [2. Installation and usage](#2-installation-and-usage)
  - [2.1. Installation](#21-installation)
  - [2.2. Usage](#22-usage)
    - [2.2.1. Command line usage](#221-command-line-usage)
    - [2.2.2. As pre-commit hook](#222-as-pre-commit-hook)
- [3. _Cercis_'s code style](#3-cerciss-code-style)
  - [3.1. Line length](#31-line-length)
  - [3.2. Single quote vs double quote](#32-single-quote-vs-double-quote)
  - [3.3. Tabs vs spaces](#33-tabs-vs-spaces)
  - [3.4. Base indentation spaces](#34-base-indentation-spaces)
  - [3.5. Extra indentation at line continuations](#35-extra-indentation-at-line-continuations)
    - [3.5.1. At function definition (`--function-definition-extra-indent`)](#351-at-function-definition---function-definition-extra-indent)
    - [3.5.2. In other line continuations (`--other-line-continuation-extra-indent`)](#352-in-other-line-continuations---other-line-continuation-extra-indent)
    - [3.5.3. At closing brackets (`--closing-bracket-extra-indent`)](#353-at-closing-brackets---closing-bracket-extra-indent)
  - [3.6. "Simple" lines with long strings](#36-simple-lines-with-long-strings)
  - [3.7. Collapse nested brackets](#37-collapse-nested-brackets)
  - [3.8. Wrapping long lines ending with comments](#38-wrapping-long-lines-ending-with-comments)
  - [3.9. Keep blank lines in brackets](#39-keep-blank-lines-in-brackets)
- [4. How to configure _Cercis_](#4-how-to-configure-cercis)
  - [4.1. Dynamically in the command line](#41-dynamically-in-the-command-line)
  - [4.2. In your project's `pyproject.toml` file](#42-in-your-projects-pyprojecttoml-file)
  - [4.3. In your project's `.pre-commit-config.yaml` file](#43-in-your-projects-pre-commit-configyaml-file)
  - [4.4. Specify options in `tox.ini`](#44-specify-options-in-toxini)
  - [4.5. How to fall back to Black's behavior](#45-how-to-fall-back-to-blacks-behavior)
- [5. Maintainer resources](#5-maintainer-resources)
  - [5.1. How to rebase on top of _Black_?](#51-how-to-rebase-on-top-of-black)
  - [5.2. Change logs](#52-change-logs)

<!--TOC-->

## 1. Motivations

While we like the idea of auto-formatting and code readability, we take issue with some
style choices and the lack of configurability of the Black formatter. Therefore,
_Cercis_ aims at providing some configurability beyond Black's limited offering.

## 2. Installation and usage

### 2.1. Installation

_Cercis_ can be installed by running `pip install cercis`. It requires Python 3.8+ to
run. If you want to format Jupyter Notebooks, install with
`pip install "cercis[jupyter]"`.

### 2.2. Usage

#### 2.2.1. Command line usage

To get started right away with sensible defaults:

```sh
cercis {source_file_or_directory}
```

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

```sh
python -m cercis {source_file_or_directory}
```

The commands above reformat entire file(s) in place.

#### 2.2.2. As pre-commit hook

To format Python files (.py), put the following into your `.pre-commit-config.yaml`
file. Remember to replace `<VERSION>` with your version of this tool (such as `v0.1.0`):

```yaml
- repo: https://github.com/jsh9/cercis
  rev: <VERSION>
  hooks:
    - id: cercis
      args: [--line-length=88]
```

To format Jupyter notebooks (.ipynb), put the following into your
`.pre-commit-config.yaml` file:

```yaml
- repo: https://github.com/jsh9/cercis
  rev: <VERSION>
  hooks:
    - id: cercis-jupyter
      args: [--line-length=88]
```

See [pre-commit](https://github.com/pre-commit/pre-commit) for more instructions. In
particular, [here](https://pre-commit.com/#passing-arguments-to-hooks) is how to specify
arguments in pre-commit config.

## 3. _Cercis_'s code style

_Cercis_'s code style is largely consistent with the
[style of of Black](https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html).

The main difference is that _Cercis_ provides several configurable options that Black
doesn't. Configurability is our main motivation behind creating _Cercis_.

The next section ([How to configure _Cercis_](#4-how-to-configure-cercis)) contains
detailed instructions of how to configure these options.

### 3.1. Line length

_Cercis_ uses 79 characters as the line length limit, instead of 88 (Black's default).

You can override this default if necessary.

| Option                 |                                           |
| ---------------------- | ----------------------------------------- |
| Name                   | `--line-length`                           |
| Abbreviation           | `-l`                                      |
| Default                | 79                                        |
| Black's default        | 88                                        |
| Command line usage     | `cercis -l=120 myScript.py`               |
| `pyproject.toml` usage | `line-length = 120` under `[tool.cercis]` |
| `pre-commit` usage     | `args: [--line-length=120]`               |

### 3.2. Single quote vs double quote

_Cercis_ uses single quotes (`'`) as the default for strings, instead of double quotes
(`"`) which is Black's default.

You can override this default if necessary.

| Option                 |                                              |
| ---------------------- | -------------------------------------------- |
| Name                   | `--single-quote`                             |
| Abbreviation           | `-sq`                                        |
| Default                | `True`                                       |
| Black's default        | `False`                                      |
| Command line usage     | `cercis -sq=True myScript.py`                |
| `pyproject.toml` usage | `single-quote = false` under `[tool.cercis]` |
| `pre-commit` usage     | `args: [--single-quote=False]`               |

### 3.3. Tabs vs spaces

_Cercis_ offers users the ability to use tabs rather than spaces.

There are two associated options:

- `--use-tabs` (bool): whether to use tabs or spaces to format the code

| Option                 |                                          |
| ---------------------- | ---------------------------------------- |
| Name                   | `--use-tabs`                             |
| Abbreviation           | `-tab`                                   |
| Default                | `False`                                  |
| Black's default        | `False`                                  |
| Command line usage     | `cercis -tab=True myScript.py`           |
| `pyproject.toml` usage | `use-tabs = false` under `[tool.cercis]` |
| `pre-commit` usage     | `args: [--use-tabs=False]`               |

- `--tab-width` (int): when calculating line length (to determine whether to wrap
  lines), how wide shall _Cercis_ treat each tab. Only effective when `--use-tabs` is
  set to `True`.

| Option                 |                                       |
| ---------------------- | ------------------------------------- |
| Name                   | `--tab-width`                         |
| Abbreviation           | `-tw`                                 |
| Default                | 4                                     |
| Black's default        | N/A                                   |
| Command line usage     | `cercis -tab=True -tw=2 myScript.py`  |
| `pyproject.toml` usage | `tab-width = 2` under `[tool.cercis]` |
| `pre-commit` usage     | `args: [--tab-width=2]`               |

### 3.4. Base indentation spaces

This option defines the number of spaces that each indentation level adds. This option
has no effect when `--use-tabs` is set to `True`.

For example, if you set it to 2, contents within a `for` block is indented 2 spaces:

```python
for i in (1, 2, 3, 4, 5):
  print(i)
```

| Option                 |                                                     |
| ---------------------- | --------------------------------------------------- |
| Name                   | `--base-indentation-spaces`                         |
| Abbreviation           | `-bis`                                              |
| Default                | 4                                                   |
| Black's default        | 4                                                   |
| Command line usage     | `cercis -bis=True -tw=2 myScript.py`                |
| `pyproject.toml` usage | `base-indentation-spaces = 2` under `[tool.cercis]` |
| `pre-commit` usage     | `args: [--base-indentation-spaces=2]`               |

### 3.5. Extra indentation at line continuations

There are three associated options:

- `--function-definition-extra-indent`
- `--other-line-continuation-extra-indent`
- `--closing-bracket-extra-indent`

They control whether we add an **additional** indentation level in some situations. Note
that these options can work well with tabs (`--use-tabs=True`).

#### 3.5.1. At function definition (`--function-definition-extra-indent`)

<table>
  <tr>
    <td>

```python
# Cercis's default style
def some_function(
        arg1_with_long_name: str,
        arg2_with_longer_name: int,
        arg3_with_longer_name: float,
        arg4_with_longer_name: bool,
) -> None:
    ...
```

  </td>

  <td>

```python
# Black's style (not configurable)
def some_function(
    arg1_with_long_name: str,
    arg2_with_longer_name: int,
    arg3_with_longer_name: float,
    arg4_with_longer_name: bool,
) -> None:
    ...
```

  </td>

  </tr>
</table>

We choose to add an extra indentation level when wrapping a function signature line.
This is because `def␣` happens to be 4 characters, so when the base indentation is 4
spaces, it can be difficult to visually distinguish the function name and the argument
list if we don't add an extra indentation.

If you set `--base-indentation-spaces` to other values than 4, this visual separation
issue will disappear, and you may not need to turn this option on.

This style is encouraged [in PEP8](https://peps.python.org/pep-0008/#indentation).

| Option                 |                                                                 |
| ---------------------- | --------------------------------------------------------------- |
| Name                   | `--function-definition-extra-indent`                            |
| Abbreviation           | `-fdei`                                                         |
| Default                | `True`                                                          |
| Black's default        | `False`                                                         |
| Command line usage     | `cercis -fdei=False myScript.py`                                |
| `pyproject.toml` usage | `function-definition-extra-indent = true` under `[tool.cercis]` |
| `pre-commit` usage     | `args: [--function-definition-extra-indent=False]`              |

#### 3.5.2. In other line continuations (`--other-line-continuation-extra-indent`)

"Other line continuations" are cases other than in function definitions, such as:

```python
var = some_function(
    arg1_with_long_name,
    arg2_with_longer_name,
)

var2 = [
    'something',
    'something else',
    'something more',
]
```

So if you set this option (`--other-line-continuation-extra-indent`) to `True`, you can
add an extra level of indentation in these cases:

```python
var = some_function(
        arg1_with_long_name,
        arg2_with_longer_name,
)

var2 = [
        'something',
        'something else',
        'something more',
]
```

| Option                 |                                                                     |
| ---------------------- | ------------------------------------------------------------------- |
| Name                   | `--other-line-continuation-extra-indent`                            |
| Abbreviation           | `-olcei`                                                            |
| Default                | `False`                                                             |
| Black's default        | `False`                                                             |
| Command line usage     | `cercis -olcei=True myScript.py`                                    |
| `pyproject.toml` usage | `other-line-continuation-extra-indent = true` under `[tool.cercis]` |
| `pre-commit` usage     | `args: [----other-line-continuation-extra-indent=False]`            |

#### 3.5.3. At closing brackets (`--closing-bracket-extra-indent`)

This option lets people customize where the closing bracket should be. Note that both
styles are OK according to [PEP8](https://peps.python.org/pep-0008/#indentation).

<table>
  <tr>
    <td>

```python
# --closing-bracket-extra-indent=False

def function(
        arg1: int,
        arg2: float,
        arg3_with_long_name: list,
) -> None:
    print('Hello world')


result = func2(
    12345,
    3.1415926,
    [1, 2, 3],
)


something = {
    'a': 1,
    'b': 2,
    'c': 3,
}
```

  </td>

  <td>

```python
# --closing-bracket-extra-indent=True

def function(
        arg1: int,
        arg2: float,
        arg3_with_long_name: list,
        ) -> None:
    print('Hello world')


result = func2(
    12345,
    3.1415926,
    [1, 2, 3],
    )


something = {
    'a': 1,
    'b': 2,
    'c': 3,
    }
```

  </td>

  </tr>
</table>

| Option                 |                                                             |
| ---------------------- | ----------------------------------------------------------- |
| Name                   | `--closing-bracket-extra-indent`                            |
| Abbreviation           | `-cbei`                                                     |
| Default                | `False`                                                     |
| Black's default        | `False`                                                     |
| Command line usage     | `cercis -cbei=True myScript.py`                             |
| `pyproject.toml` usage | `closing-bracket-extra-indent = true` under `[tool.cercis]` |
| `pre-commit` usage     | `args: [--closing-bracket-extra-indent=False]`              |

### 3.6. "Simple" lines with long strings

By default, Black wraps lines that exceed length limit. But for very simple lines (such
as assigning a long string to a variable), line wrapping is not necessary.

<table>
  <tr>
    <td>

```python
# Cercis's default style
# (Suppose line length limit is 30 chars)

# Cercis doesn't wrap slightly long lines
var1 = 'This line has 31 chars'



# Cercis doesn't wrap longer lines
var2 = 'This line has 43 characters_______'


# Falls back to Black when comments present
var3 = (
    'shorter line'  # comment
)
```

  </td>

  <td>

```python
# Black's style (not configurable)
# (Suppose line length limit is 30 chars)

# Black wraps slightly long lines
var1 = (
    "This line has 31 chars"
)

# But Black doesn't wrap longer lines
var2 = "This line has 43 characters_______"


# Black wraps comments like this:
var3 = (
    "shorter line"  # comment
)
```

  </td>

  </tr>
</table>

| Option                 |                                                           |
| ---------------------- | --------------------------------------------------------- |
| Name                   | `--wrap-line-with-long-string`                            |
| Abbreviation           | `-wl`                                                     |
| Default                | `False`                                                   |
| Black's default        | `True`                                                    |
| Command line usage     | `cercis -wl=True myScript.py`                             |
| `pyproject.toml` usage | `wrap-line-with-long-string = true` under `[tool.cercis]` |
| `pre-commit` usage     | `args: [--wrap-line-with-long-string=False]`              |

### 3.7. Collapse nested brackets

_Cercis_ by default collapses nested brackets to make the code more compact.

<table>
  <tr>
    <td>

```python
# Cercis's default style

# If line length limit is 30
value = np.array([
    [1, 2, 3, 4, 5],
    [6, 7, 8, 9, 0],
])



# If line length limit is 10
value = function({
    1,
    2,
    3,
    4,
    5,
})


```

  </td>

  <td>

```python
# Black's style (not configurable)

# If line length limit is 30
value = np.array(
    [
        [1, 2, 3, 4, 5],
        [6, 7, 8, 9, 0],
    ]
)

# If line length limit is 10
value = function(
    {
        1,
        2,
        3,
        4,
        5,
    }
)
```

  </td>

  </tr>
</table>

| Option                 |                                                         |
| ---------------------- | ------------------------------------------------------- |
| Name                   | `--collapse-nested-brackets`                            |
| Abbreviation           | `-cnb`                                                  |
| Default                | `True`                                                  |
| Black's style          | `False`                                                 |
| Command line usage     | `cercis -cnb=True myScript.py`                          |
| `pyproject.toml` usage | `collapse-nested-brackets = true` under `[tool.cercis]` |
| `pre-commit` usage     | `args: [--collapse-nested-brackets=False]`              |

The code implementation of this option comes from
[Pyink](https://github.com/google/pyink), another forked project from Black.

### 3.8. Wrapping long lines ending with comments

Sometimes we have lines that exceed the length limit only because of the in-line
comment. If we do not want to wrap those lines, we can use two options provided here:

- `--wrap-comments`
- `--wrap-pragma-comments`

"Pragma comments", in this context, mean the directives for Python linters usually to
tell them to ignore certain errors. Pragma comments that _Cercis_ currently recognizes
include:

- _noqa_: `# noqa: E501`
- _type: ignore_: `# type: ignore[no-untyped-def]`
- _pylint_: `# pylint: disable=protected-access`
- _pytype_: `# pytype: disable=attribute-error`

| Option                 |                                              |
| ---------------------- | -------------------------------------------- |
| Name                   | `--wrap-comments`                            |
| Abbreviation           | `-wc`                                        |
| Default                | `False`                                      |
| Black's style          | `True`                                       |
| Command line usage     | `cercis -wc=True myScript.py`                |
| `pyproject.toml` usage | `wrap-comments = true` under `[tool.cercis]` |
| `pre-commit` usage     | `args: [--wrap-comments=False]`              |

| Option                 |                                                     |
| ---------------------- | --------------------------------------------------- |
| Name                   | `--wrap-pragma-comments`                            |
| Abbreviation           | `-wpc`                                              |
| Default                | `False`                                             |
| Black's style          | `True`                                              |
| Command line usage     | `cercis -wpc=True myScript.py`                      |
| `pyproject.toml` usage | `wrap-pragma-comments = true` under `[tool.cercis]` |
| `pre-commit` usage     | `args: [--wrap-pragma-comments=False]`              |

And below is a 2x2 matrix to explain how these two options work together:

|              | `-wc=True`                          | `-wc=False`             |
| ------------ | ----------------------------------- | ----------------------- |
| `-wpc=True`  | All comments wrapped w.n.           | No comments are wrapped |
| `-wpc=False` | p.c. not wrapped; o.c. wrapped w.n. | No comments are wrapped |

Note:

- "w.n." means "when necessary"
- "p.c." means "pragma comments"
- "o.c." means "other comments"

### 3.9. Keep blank lines in brackets

This option allows us to keep the blank lines that we intentionally add into the
contents of brackets.

<table>
  <tr>
    <td>

Cercis's default style:

```python
my_list = [
    # Group 1
    1,
    2,

    # Group 2
    3,
    4,

    # Group 3
    5,
    6,
]
```

  </td>

  <td>

Black's default style (not configurable):

```python
my_list = [
    # Group 1
    1,
    2,
    # Group 2
    3,
    4,
    # Group 3
    5,
    6,
]


```

  </td>

  </tr>
</table>

| Option                 |                                                             |
| ---------------------- | ----------------------------------------------------------- |
| Name                   | `--keep-blank-lines-in-brackets`                            |
| Abbreviation           | `-kblib`                                                    |
| Default                | `True`                                                      |
| Black's style          | `False`                                                     |
| Command line usage     | `cercis -kblib=True myScript.py`                            |
| `pyproject.toml` usage | `keep-blank-lines-in-brackets = true` under `[tool.cercis]` |
| `pre-commit` usage     | `args: [--keep-blank-lines-in-bracketss=False]`             |

(Note: if `--keep-blank-lines-in-brackets` is `True`, multiple consecutive blank lines
are compressed into one blank line after formatting.)

## 4. How to configure _Cercis_

### 4.1. Dynamically in the command line

Here are some examples:

- `cercis --single-quote=True myScript.py` to format files to single quotes
- `cercis --function-definition-extra-indent=False myScript.py` to format files without
  extra indentation at function definition
- `cercis --line-length=79 myScript.py` to format files with a line length of 79
  characters

### 4.2. In your project's `pyproject.toml` file

You can specify the options under the `[tool.cercis]` section of the file:

```toml
[tool.cercis]
line-length = 88
function-definition-extra-indent = true
single-quote = false
```

### 4.3. In your project's `.pre-commit-config.yaml` file

You can specify the options under the `args` section of your `.pre-commit-config.yaml`
file.

For example:

```yaml
repos:
  - repo: https://github.com/jsh9/cercis
    rev: 0.1.0
    hooks:
      - id: cercis
        args: [--function-definition-extra-indent=False, --line-length=79]
  - repo: https://github.com/jsh9/cercis
    rev: 0.1.0
    hooks:
      - id: cercis-jupyter
        args: [--function-definition-extra-indent=False, --line-length=79]
```

The value in `rev` can be any _Cercis_ release, or it can be `main`, which means to
always use the latest (including unreleased) _Cercis_ features.

### 4.4. Specify options in `tox.ini`

Currently, _Cercis_ does not support a config section in `tox.ini`. Instead, you can
specify the options in `pyproject.toml`.

### 4.5. How to fall back to Black's behavior

Here are the configuration options to fall back to Black's behavior. Put them in
`pyproject.toml`:

```toml
[tool.cercis]
line-length = 88
single-quote = false
use-tabs = false
base-indentation-spaces = 4
function-definition-extra-indent = false
other-line-continuation-extra-indent = false
closing-bracket-extra-indent = false
wrap-line-with-long-string = true
collapse-nested-brackets = false
wrap-comments = true
wrap-pragma-comments = true
```

## 5. Maintainer resources

Here are some resources and notes for maintainers of _Cercis_:

### 5.1. How to rebase on top of _Black_?

Please refer to the file [HOW_TO_REBASE.md](./HOW_TO_REBASE.md).

### 5.2. Change logs

There are 2 files in this repo: [CHANGELOG.md](./CHANGELOG.md) and
[CHANGES.md](./CHANGES.md).

The former tracks the changes of _Cercis_ (_Black_ does not have this file). The latter
tracks the changes on _Black_ (it exists in the _Black_ repo as well).
# Change Log

## [0.2.3] - 2023-10-19

- Changed
  - Rebased `Cercis` to be head to head with `Black` (v23.10.0)
- Diff
  - https://github.com/jsh9/cercis/compare/0.2.2...0.2.3

## [0.2.2] - 2023-09-13

- Changed
  - Rebased `Cercis` to be head to head with `Black`
- Diff
  - https://github.com/jsh9/cercis/compare/0.2.1...0.2.2

## [0.2.1] - 2023-07-23

- Changed
  - Rebased `Cercis` to be head to head with `Black`
- Fixed
  - Fixed a pytest regression where Python warnings are treated as errors
    (https://github.com/jsh9/cercis/commit/1229b9dd18f861423e26f8de3f4b5e714d72bd9c)
- Diff
  - https://github.com/jsh9/cercis/compare/0.2.0...0.2.1

## [0.2.0] - 2023-07-12

- Changed
  - Rebased `Cercis` to be head to head with `Black`
    [version 23.7.0](https://github.com/psf/black/releases/tag/23.7.0)
- Diff
  - https://github.com/jsh9/cercis/compare/0.1.7...0.2.0

## [0.1.7] - 2023-06-19

- Changed
  - Pulled in the latest changes from psf/black (code diff:
    https://github.com/jsh9/cercis/pull/27)

## [0.1.6] - 2023-05-23

- Added
  - A new option `--wrap-comments` to not wrap any comments (not just pragma comments)
  - A new option `--keep-blank-lines-in-brackets`
- Changed
  - Improved the CLI output text colors because the current colors are confusing or not
    quite legible

## [0.1.5] - 2023-05-09

- Added
  - Configurability to use tabs instead of spaces (two new options: `--use-tabs` and
    `--tab-width`)
  - Configurability on base indentation spaces and extra indentation at different line
    continuation situations

## [0.1.4] - 2023-05-07

- Added
  - A new configurable option: `--closing-bracket-extra-indent`

## [0.1.3] - 2023-05-07

- Added

  - A new configurable option: `--collapse-nested-brackets`
  - A new configurable option: `--wrap-pragma-comments`
  - Some Github workflow actions to make sure CHANGELOG.md is updated

- Changed

  - Changed the default quote to single quote
  - Changed the default line length to 79 characters

- Removed
  - Some unrelated documentation and config files

## [0.1.2] - 2023-05-04

- Added
  - Merged 2 changes from psf/black:main ([#5](https://github.com/jsh9/cercis/pull/5))
  - Added option to not wrap "simple" lines with long strings
    ([#6](https://github.com/jsh9/cercis/pull/6))
- Full changelog
  - https://github.com/jsh9/cercis/compare/0.1.1...0.1.2

## [0.1.1] - 2023-05-03

- Added
  - A configurable option: `single-quote`, for formatting code into single quotes
- Full changelog
  - https://github.com/jsh9/cercis/compare/0.1.0...0.1.1

## [0.1.0] - 2023-04-30

- This is the initial version that branches away from Black (commit:
  [e712e4](https://github.com/psf/black/commit/e712e48e06420d9240ce95c81acfcf6f11d14c83))
- Changed
  - The default indentation within a function definition (when line wrap happens) is now
    8 spaces. (Black's default is 4, which is
    [not PEP8-compatible](https://github.com/psf/black/issues/1127))
  - Updated README, because `cercis` now branches away from Black
- Added
  - A configurable option (`function-definition-extra-indent`) is added instead of
    enforcing 8 spaces for everyone

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "cercis",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "automation,autopep8,formatter,gofmt,pyfmt,rustfmt,yapf",
    "author": "jsh9",
    "author_email": "\u0141ukasz Langa <lukasz@langa.pl>",
    "download_url": "https://files.pythonhosted.org/packages/d1/1c/d0a7f249cc6a51867244163d04988b976a55bf0b38eb1fab3e7ae873f476/cercis-0.2.3.tar.gz",
    "platform": null,
    "description": "# _Cercis_\n\n[![](https://upload.wikimedia.org/wikipedia/commons/thumb/4/4c/Red_bud_2009.jpg/320px-Red_bud_2009.jpg)](https://en.wikipedia.org/wiki/Cercis)\n\n_**Cercis**_ /\u02c8s\u025c\u02d0rs\u026as/ is a Python code formatter that is more configurable than\n[Black](https://github.com/psf/black) (a popular Python code formatter).\n\n[_Cercis_](https://en.wikipedia.org/wiki/Cercis) is also the name of a deciduous tree\nthat boasts vibrant pink to purple-hued flowers, which bloom in early spring.\n\nThis code repository is forked from and directly inspired by\n[Black](https://github.com/psf/black). The original license of Black is included in this\nrepository (see [LICENSE_ORIGINAL](./LICENSE_ORIGINAL)).\n\n_Cercis_ inherited Black's very comprehensive test cases, which means we are confident\nthat our configurability addition does not introduce any undesirable side effects. We\nalso thoroughly tested every configurable options that we added.\n\nIn particular, via its configurable options, _Cercis_ can completely fall back to Black.\nSee [Section 4.5](#45-how-to-fall-back-to-blacks-behavior) below for more details.\n\n**Table of Contents**\n\n<!--TOC-->\n\n- [1. Motivations](#1-motivations)\n- [2. Installation and usage](#2-installation-and-usage)\n  - [2.1. Installation](#21-installation)\n  - [2.2. Usage](#22-usage)\n    - [2.2.1. Command line usage](#221-command-line-usage)\n    - [2.2.2. As pre-commit hook](#222-as-pre-commit-hook)\n- [3. _Cercis_'s code style](#3-cerciss-code-style)\n  - [3.1. Line length](#31-line-length)\n  - [3.2. Single quote vs double quote](#32-single-quote-vs-double-quote)\n  - [3.3. Tabs vs spaces](#33-tabs-vs-spaces)\n  - [3.4. Base indentation spaces](#34-base-indentation-spaces)\n  - [3.5. Extra indentation at line continuations](#35-extra-indentation-at-line-continuations)\n    - [3.5.1. At function definition (`--function-definition-extra-indent`)](#351-at-function-definition---function-definition-extra-indent)\n    - [3.5.2. In other line continuations (`--other-line-continuation-extra-indent`)](#352-in-other-line-continuations---other-line-continuation-extra-indent)\n    - [3.5.3. At closing brackets (`--closing-bracket-extra-indent`)](#353-at-closing-brackets---closing-bracket-extra-indent)\n  - [3.6. \"Simple\" lines with long strings](#36-simple-lines-with-long-strings)\n  - [3.7. Collapse nested brackets](#37-collapse-nested-brackets)\n  - [3.8. Wrapping long lines ending with comments](#38-wrapping-long-lines-ending-with-comments)\n  - [3.9. Keep blank lines in brackets](#39-keep-blank-lines-in-brackets)\n- [4. How to configure _Cercis_](#4-how-to-configure-cercis)\n  - [4.1. Dynamically in the command line](#41-dynamically-in-the-command-line)\n  - [4.2. In your project's `pyproject.toml` file](#42-in-your-projects-pyprojecttoml-file)\n  - [4.3. In your project's `.pre-commit-config.yaml` file](#43-in-your-projects-pre-commit-configyaml-file)\n  - [4.4. Specify options in `tox.ini`](#44-specify-options-in-toxini)\n  - [4.5. How to fall back to Black's behavior](#45-how-to-fall-back-to-blacks-behavior)\n- [5. Maintainer resources](#5-maintainer-resources)\n  - [5.1. How to rebase on top of _Black_?](#51-how-to-rebase-on-top-of-black)\n  - [5.2. Change logs](#52-change-logs)\n\n<!--TOC-->\n\n## 1. Motivations\n\nWhile we like the idea of auto-formatting and code readability, we take issue with some\nstyle choices and the lack of configurability of the Black formatter. Therefore,\n_Cercis_ aims at providing some configurability beyond Black's limited offering.\n\n## 2. Installation and usage\n\n### 2.1. Installation\n\n_Cercis_ can be installed by running `pip install cercis`. It requires Python 3.8+ to\nrun. If you want to format Jupyter Notebooks, install with\n`pip install \"cercis[jupyter]\"`.\n\n### 2.2. Usage\n\n#### 2.2.1. Command line usage\n\nTo get started right away with sensible defaults:\n\n```sh\ncercis {source_file_or_directory}\n```\n\nYou can run _Cercis_ as a package if running it as a script doesn't work:\n\n```sh\npython -m cercis {source_file_or_directory}\n```\n\nThe commands above reformat entire file(s) in place.\n\n#### 2.2.2. As pre-commit hook\n\nTo format Python files (.py), put the following into your `.pre-commit-config.yaml`\nfile. Remember to replace `<VERSION>` with your version of this tool (such as `v0.1.0`):\n\n```yaml\n- repo: https://github.com/jsh9/cercis\n  rev: <VERSION>\n  hooks:\n    - id: cercis\n      args: [--line-length=88]\n```\n\nTo format Jupyter notebooks (.ipynb), put the following into your\n`.pre-commit-config.yaml` file:\n\n```yaml\n- repo: https://github.com/jsh9/cercis\n  rev: <VERSION>\n  hooks:\n    - id: cercis-jupyter\n      args: [--line-length=88]\n```\n\nSee [pre-commit](https://github.com/pre-commit/pre-commit) for more instructions. In\nparticular, [here](https://pre-commit.com/#passing-arguments-to-hooks) is how to specify\narguments in pre-commit config.\n\n## 3. _Cercis_'s code style\n\n_Cercis_'s code style is largely consistent with the\n[style of of Black](https://black.readthedocs.io/en/stable/the_black_code_style/current_style.html).\n\nThe main difference is that _Cercis_ provides several configurable options that Black\ndoesn't. Configurability is our main motivation behind creating _Cercis_.\n\nThe next section ([How to configure _Cercis_](#4-how-to-configure-cercis)) contains\ndetailed instructions of how to configure these options.\n\n### 3.1. Line length\n\n_Cercis_ uses 79 characters as the line length limit, instead of 88 (Black's default).\n\nYou can override this default if necessary.\n\n| Option                 |                                           |\n| ---------------------- | ----------------------------------------- |\n| Name                   | `--line-length`                           |\n| Abbreviation           | `-l`                                      |\n| Default                | 79                                        |\n| Black's default        | 88                                        |\n| Command line usage     | `cercis -l=120 myScript.py`               |\n| `pyproject.toml` usage | `line-length = 120` under `[tool.cercis]` |\n| `pre-commit` usage     | `args: [--line-length=120]`               |\n\n### 3.2. Single quote vs double quote\n\n_Cercis_ uses single quotes (`'`) as the default for strings, instead of double quotes\n(`\"`) which is Black's default.\n\nYou can override this default if necessary.\n\n| Option                 |                                              |\n| ---------------------- | -------------------------------------------- |\n| Name                   | `--single-quote`                             |\n| Abbreviation           | `-sq`                                        |\n| Default                | `True`                                       |\n| Black's default        | `False`                                      |\n| Command line usage     | `cercis -sq=True myScript.py`                |\n| `pyproject.toml` usage | `single-quote = false` under `[tool.cercis]` |\n| `pre-commit` usage     | `args: [--single-quote=False]`               |\n\n### 3.3. Tabs vs spaces\n\n_Cercis_ offers users the ability to use tabs rather than spaces.\n\nThere are two associated options:\n\n- `--use-tabs` (bool): whether to use tabs or spaces to format the code\n\n| Option                 |                                          |\n| ---------------------- | ---------------------------------------- |\n| Name                   | `--use-tabs`                             |\n| Abbreviation           | `-tab`                                   |\n| Default                | `False`                                  |\n| Black's default        | `False`                                  |\n| Command line usage     | `cercis -tab=True myScript.py`           |\n| `pyproject.toml` usage | `use-tabs = false` under `[tool.cercis]` |\n| `pre-commit` usage     | `args: [--use-tabs=False]`               |\n\n- `--tab-width` (int): when calculating line length (to determine whether to wrap\n  lines), how wide shall _Cercis_ treat each tab. Only effective when `--use-tabs` is\n  set to `True`.\n\n| Option                 |                                       |\n| ---------------------- | ------------------------------------- |\n| Name                   | `--tab-width`                         |\n| Abbreviation           | `-tw`                                 |\n| Default                | 4                                     |\n| Black's default        | N/A                                   |\n| Command line usage     | `cercis -tab=True -tw=2 myScript.py`  |\n| `pyproject.toml` usage | `tab-width = 2` under `[tool.cercis]` |\n| `pre-commit` usage     | `args: [--tab-width=2]`               |\n\n### 3.4. Base indentation spaces\n\nThis option defines the number of spaces that each indentation level adds. This option\nhas no effect when `--use-tabs` is set to `True`.\n\nFor example, if you set it to 2, contents within a `for` block is indented 2 spaces:\n\n```python\nfor i in (1, 2, 3, 4, 5):\n  print(i)\n```\n\n| Option                 |                                                     |\n| ---------------------- | --------------------------------------------------- |\n| Name                   | `--base-indentation-spaces`                         |\n| Abbreviation           | `-bis`                                              |\n| Default                | 4                                                   |\n| Black's default        | 4                                                   |\n| Command line usage     | `cercis -bis=True -tw=2 myScript.py`                |\n| `pyproject.toml` usage | `base-indentation-spaces = 2` under `[tool.cercis]` |\n| `pre-commit` usage     | `args: [--base-indentation-spaces=2]`               |\n\n### 3.5. Extra indentation at line continuations\n\nThere are three associated options:\n\n- `--function-definition-extra-indent`\n- `--other-line-continuation-extra-indent`\n- `--closing-bracket-extra-indent`\n\nThey control whether we add an **additional** indentation level in some situations. Note\nthat these options can work well with tabs (`--use-tabs=True`).\n\n#### 3.5.1. At function definition (`--function-definition-extra-indent`)\n\n<table>\n  <tr>\n    <td>\n\n```python\n# Cercis's default style\ndef some_function(\n        arg1_with_long_name: str,\n        arg2_with_longer_name: int,\n        arg3_with_longer_name: float,\n        arg4_with_longer_name: bool,\n) -> None:\n    ...\n```\n\n  </td>\n\n  <td>\n\n```python\n# Black's style (not configurable)\ndef some_function(\n    arg1_with_long_name: str,\n    arg2_with_longer_name: int,\n    arg3_with_longer_name: float,\n    arg4_with_longer_name: bool,\n) -> None:\n    ...\n```\n\n  </td>\n\n  </tr>\n</table>\n\nWe choose to add an extra indentation level when wrapping a function signature line.\nThis is because `def\u2423` happens to be 4 characters, so when the base indentation is 4\nspaces, it can be difficult to visually distinguish the function name and the argument\nlist if we don't add an extra indentation.\n\nIf you set `--base-indentation-spaces` to other values than 4, this visual separation\nissue will disappear, and you may not need to turn this option on.\n\nThis style is encouraged [in PEP8](https://peps.python.org/pep-0008/#indentation).\n\n| Option                 |                                                                 |\n| ---------------------- | --------------------------------------------------------------- |\n| Name                   | `--function-definition-extra-indent`                            |\n| Abbreviation           | `-fdei`                                                         |\n| Default                | `True`                                                          |\n| Black's default        | `False`                                                         |\n| Command line usage     | `cercis -fdei=False myScript.py`                                |\n| `pyproject.toml` usage | `function-definition-extra-indent = true` under `[tool.cercis]` |\n| `pre-commit` usage     | `args: [--function-definition-extra-indent=False]`              |\n\n#### 3.5.2. In other line continuations (`--other-line-continuation-extra-indent`)\n\n\"Other line continuations\" are cases other than in function definitions, such as:\n\n```python\nvar = some_function(\n    arg1_with_long_name,\n    arg2_with_longer_name,\n)\n\nvar2 = [\n    'something',\n    'something else',\n    'something more',\n]\n```\n\nSo if you set this option (`--other-line-continuation-extra-indent`) to `True`, you can\nadd an extra level of indentation in these cases:\n\n```python\nvar = some_function(\n        arg1_with_long_name,\n        arg2_with_longer_name,\n)\n\nvar2 = [\n        'something',\n        'something else',\n        'something more',\n]\n```\n\n| Option                 |                                                                     |\n| ---------------------- | ------------------------------------------------------------------- |\n| Name                   | `--other-line-continuation-extra-indent`                            |\n| Abbreviation           | `-olcei`                                                            |\n| Default                | `False`                                                             |\n| Black's default        | `False`                                                             |\n| Command line usage     | `cercis -olcei=True myScript.py`                                    |\n| `pyproject.toml` usage | `other-line-continuation-extra-indent = true` under `[tool.cercis]` |\n| `pre-commit` usage     | `args: [----other-line-continuation-extra-indent=False]`            |\n\n#### 3.5.3. At closing brackets (`--closing-bracket-extra-indent`)\n\nThis option lets people customize where the closing bracket should be. Note that both\nstyles are OK according to [PEP8](https://peps.python.org/pep-0008/#indentation).\n\n<table>\n  <tr>\n    <td>\n\n```python\n# --closing-bracket-extra-indent=False\n\ndef function(\n        arg1: int,\n        arg2: float,\n        arg3_with_long_name: list,\n) -> None:\n    print('Hello world')\n\n\nresult = func2(\n    12345,\n    3.1415926,\n    [1, 2, 3],\n)\n\n\nsomething = {\n    'a': 1,\n    'b': 2,\n    'c': 3,\n}\n```\n\n  </td>\n\n  <td>\n\n```python\n# --closing-bracket-extra-indent=True\n\ndef function(\n        arg1: int,\n        arg2: float,\n        arg3_with_long_name: list,\n        ) -> None:\n    print('Hello world')\n\n\nresult = func2(\n    12345,\n    3.1415926,\n    [1, 2, 3],\n    )\n\n\nsomething = {\n    'a': 1,\n    'b': 2,\n    'c': 3,\n    }\n```\n\n  </td>\n\n  </tr>\n</table>\n\n| Option                 |                                                             |\n| ---------------------- | ----------------------------------------------------------- |\n| Name                   | `--closing-bracket-extra-indent`                            |\n| Abbreviation           | `-cbei`                                                     |\n| Default                | `False`                                                     |\n| Black's default        | `False`                                                     |\n| Command line usage     | `cercis -cbei=True myScript.py`                             |\n| `pyproject.toml` usage | `closing-bracket-extra-indent = true` under `[tool.cercis]` |\n| `pre-commit` usage     | `args: [--closing-bracket-extra-indent=False]`              |\n\n### 3.6. \"Simple\" lines with long strings\n\nBy default, Black wraps lines that exceed length limit. But for very simple lines (such\nas assigning a long string to a variable), line wrapping is not necessary.\n\n<table>\n  <tr>\n    <td>\n\n```python\n# Cercis's default style\n# (Suppose line length limit is 30 chars)\n\n# Cercis doesn't wrap slightly long lines\nvar1 = 'This line has 31 chars'\n\n\n\n# Cercis doesn't wrap longer lines\nvar2 = 'This line has 43 characters_______'\n\n\n# Falls back to Black when comments present\nvar3 = (\n    'shorter line'  # comment\n)\n```\n\n  </td>\n\n  <td>\n\n```python\n# Black's style (not configurable)\n# (Suppose line length limit is 30 chars)\n\n# Black wraps slightly long lines\nvar1 = (\n    \"This line has 31 chars\"\n)\n\n# But Black doesn't wrap longer lines\nvar2 = \"This line has 43 characters_______\"\n\n\n# Black wraps comments like this:\nvar3 = (\n    \"shorter line\"  # comment\n)\n```\n\n  </td>\n\n  </tr>\n</table>\n\n| Option                 |                                                           |\n| ---------------------- | --------------------------------------------------------- |\n| Name                   | `--wrap-line-with-long-string`                            |\n| Abbreviation           | `-wl`                                                     |\n| Default                | `False`                                                   |\n| Black's default        | `True`                                                    |\n| Command line usage     | `cercis -wl=True myScript.py`                             |\n| `pyproject.toml` usage | `wrap-line-with-long-string = true` under `[tool.cercis]` |\n| `pre-commit` usage     | `args: [--wrap-line-with-long-string=False]`              |\n\n### 3.7. Collapse nested brackets\n\n_Cercis_ by default collapses nested brackets to make the code more compact.\n\n<table>\n  <tr>\n    <td>\n\n```python\n# Cercis's default style\n\n# If line length limit is 30\nvalue = np.array([\n    [1, 2, 3, 4, 5],\n    [6, 7, 8, 9, 0],\n])\n\n\n\n# If line length limit is 10\nvalue = function({\n    1,\n    2,\n    3,\n    4,\n    5,\n})\n\n\n```\n\n  </td>\n\n  <td>\n\n```python\n# Black's style (not configurable)\n\n# If line length limit is 30\nvalue = np.array(\n    [\n        [1, 2, 3, 4, 5],\n        [6, 7, 8, 9, 0],\n    ]\n)\n\n# If line length limit is 10\nvalue = function(\n    {\n        1,\n        2,\n        3,\n        4,\n        5,\n    }\n)\n```\n\n  </td>\n\n  </tr>\n</table>\n\n| Option                 |                                                         |\n| ---------------------- | ------------------------------------------------------- |\n| Name                   | `--collapse-nested-brackets`                            |\n| Abbreviation           | `-cnb`                                                  |\n| Default                | `True`                                                  |\n| Black's style          | `False`                                                 |\n| Command line usage     | `cercis -cnb=True myScript.py`                          |\n| `pyproject.toml` usage | `collapse-nested-brackets = true` under `[tool.cercis]` |\n| `pre-commit` usage     | `args: [--collapse-nested-brackets=False]`              |\n\nThe code implementation of this option comes from\n[Pyink](https://github.com/google/pyink), another forked project from Black.\n\n### 3.8. Wrapping long lines ending with comments\n\nSometimes we have lines that exceed the length limit only because of the in-line\ncomment. If we do not want to wrap those lines, we can use two options provided here:\n\n- `--wrap-comments`\n- `--wrap-pragma-comments`\n\n\"Pragma comments\", in this context, mean the directives for Python linters usually to\ntell them to ignore certain errors. Pragma comments that _Cercis_ currently recognizes\ninclude:\n\n- _noqa_: `# noqa: E501`\n- _type: ignore_: `# type: ignore[no-untyped-def]`\n- _pylint_: `# pylint: disable=protected-access`\n- _pytype_: `# pytype: disable=attribute-error`\n\n| Option                 |                                              |\n| ---------------------- | -------------------------------------------- |\n| Name                   | `--wrap-comments`                            |\n| Abbreviation           | `-wc`                                        |\n| Default                | `False`                                      |\n| Black's style          | `True`                                       |\n| Command line usage     | `cercis -wc=True myScript.py`                |\n| `pyproject.toml` usage | `wrap-comments = true` under `[tool.cercis]` |\n| `pre-commit` usage     | `args: [--wrap-comments=False]`              |\n\n| Option                 |                                                     |\n| ---------------------- | --------------------------------------------------- |\n| Name                   | `--wrap-pragma-comments`                            |\n| Abbreviation           | `-wpc`                                              |\n| Default                | `False`                                             |\n| Black's style          | `True`                                              |\n| Command line usage     | `cercis -wpc=True myScript.py`                      |\n| `pyproject.toml` usage | `wrap-pragma-comments = true` under `[tool.cercis]` |\n| `pre-commit` usage     | `args: [--wrap-pragma-comments=False]`              |\n\nAnd below is a 2x2 matrix to explain how these two options work together:\n\n|              | `-wc=True`                          | `-wc=False`             |\n| ------------ | ----------------------------------- | ----------------------- |\n| `-wpc=True`  | All comments wrapped w.n.           | No comments are wrapped |\n| `-wpc=False` | p.c. not wrapped; o.c. wrapped w.n. | No comments are wrapped |\n\nNote:\n\n- \"w.n.\" means \"when necessary\"\n- \"p.c.\" means \"pragma comments\"\n- \"o.c.\" means \"other comments\"\n\n### 3.9. Keep blank lines in brackets\n\nThis option allows us to keep the blank lines that we intentionally add into the\ncontents of brackets.\n\n<table>\n  <tr>\n    <td>\n\nCercis's default style:\n\n```python\nmy_list = [\n    # Group 1\n    1,\n    2,\n\n    # Group 2\n    3,\n    4,\n\n    # Group 3\n    5,\n    6,\n]\n```\n\n  </td>\n\n  <td>\n\nBlack's default style (not configurable):\n\n```python\nmy_list = [\n    # Group 1\n    1,\n    2,\n    # Group 2\n    3,\n    4,\n    # Group 3\n    5,\n    6,\n]\n\n\n```\n\n  </td>\n\n  </tr>\n</table>\n\n| Option                 |                                                             |\n| ---------------------- | ----------------------------------------------------------- |\n| Name                   | `--keep-blank-lines-in-brackets`                            |\n| Abbreviation           | `-kblib`                                                    |\n| Default                | `True`                                                      |\n| Black's style          | `False`                                                     |\n| Command line usage     | `cercis -kblib=True myScript.py`                            |\n| `pyproject.toml` usage | `keep-blank-lines-in-brackets = true` under `[tool.cercis]` |\n| `pre-commit` usage     | `args: [--keep-blank-lines-in-bracketss=False]`             |\n\n(Note: if `--keep-blank-lines-in-brackets` is `True`, multiple consecutive blank lines\nare compressed into one blank line after formatting.)\n\n## 4. How to configure _Cercis_\n\n### 4.1. Dynamically in the command line\n\nHere are some examples:\n\n- `cercis --single-quote=True myScript.py` to format files to single quotes\n- `cercis --function-definition-extra-indent=False myScript.py` to format files without\n  extra indentation at function definition\n- `cercis --line-length=79 myScript.py` to format files with a line length of 79\n  characters\n\n### 4.2. In your project's `pyproject.toml` file\n\nYou can specify the options under the `[tool.cercis]` section of the file:\n\n```toml\n[tool.cercis]\nline-length = 88\nfunction-definition-extra-indent = true\nsingle-quote = false\n```\n\n### 4.3. In your project's `.pre-commit-config.yaml` file\n\nYou can specify the options under the `args` section of your `.pre-commit-config.yaml`\nfile.\n\nFor example:\n\n```yaml\nrepos:\n  - repo: https://github.com/jsh9/cercis\n    rev: 0.1.0\n    hooks:\n      - id: cercis\n        args: [--function-definition-extra-indent=False, --line-length=79]\n  - repo: https://github.com/jsh9/cercis\n    rev: 0.1.0\n    hooks:\n      - id: cercis-jupyter\n        args: [--function-definition-extra-indent=False, --line-length=79]\n```\n\nThe value in `rev` can be any _Cercis_ release, or it can be `main`, which means to\nalways use the latest (including unreleased) _Cercis_ features.\n\n### 4.4. Specify options in `tox.ini`\n\nCurrently, _Cercis_ does not support a config section in `tox.ini`. Instead, you can\nspecify the options in `pyproject.toml`.\n\n### 4.5. How to fall back to Black's behavior\n\nHere are the configuration options to fall back to Black's behavior. Put them in\n`pyproject.toml`:\n\n```toml\n[tool.cercis]\nline-length = 88\nsingle-quote = false\nuse-tabs = false\nbase-indentation-spaces = 4\nfunction-definition-extra-indent = false\nother-line-continuation-extra-indent = false\nclosing-bracket-extra-indent = false\nwrap-line-with-long-string = true\ncollapse-nested-brackets = false\nwrap-comments = true\nwrap-pragma-comments = true\n```\n\n## 5. Maintainer resources\n\nHere are some resources and notes for maintainers of _Cercis_:\n\n### 5.1. How to rebase on top of _Black_?\n\nPlease refer to the file [HOW_TO_REBASE.md](./HOW_TO_REBASE.md).\n\n### 5.2. Change logs\n\nThere are 2 files in this repo: [CHANGELOG.md](./CHANGELOG.md) and\n[CHANGES.md](./CHANGES.md).\n\nThe former tracks the changes of _Cercis_ (_Black_ does not have this file). The latter\ntracks the changes on _Black_ (it exists in the _Black_ repo as well).\n# Change Log\n\n## [0.2.3] - 2023-10-19\n\n- Changed\n  - Rebased `Cercis` to be head to head with `Black` (v23.10.0)\n- Diff\n  - https://github.com/jsh9/cercis/compare/0.2.2...0.2.3\n\n## [0.2.2] - 2023-09-13\n\n- Changed\n  - Rebased `Cercis` to be head to head with `Black`\n- Diff\n  - https://github.com/jsh9/cercis/compare/0.2.1...0.2.2\n\n## [0.2.1] - 2023-07-23\n\n- Changed\n  - Rebased `Cercis` to be head to head with `Black`\n- Fixed\n  - Fixed a pytest regression where Python warnings are treated as errors\n    (https://github.com/jsh9/cercis/commit/1229b9dd18f861423e26f8de3f4b5e714d72bd9c)\n- Diff\n  - https://github.com/jsh9/cercis/compare/0.2.0...0.2.1\n\n## [0.2.0] - 2023-07-12\n\n- Changed\n  - Rebased `Cercis` to be head to head with `Black`\n    [version 23.7.0](https://github.com/psf/black/releases/tag/23.7.0)\n- Diff\n  - https://github.com/jsh9/cercis/compare/0.1.7...0.2.0\n\n## [0.1.7] - 2023-06-19\n\n- Changed\n  - Pulled in the latest changes from psf/black (code diff:\n    https://github.com/jsh9/cercis/pull/27)\n\n## [0.1.6] - 2023-05-23\n\n- Added\n  - A new option `--wrap-comments` to not wrap any comments (not just pragma comments)\n  - A new option `--keep-blank-lines-in-brackets`\n- Changed\n  - Improved the CLI output text colors because the current colors are confusing or not\n    quite legible\n\n## [0.1.5] - 2023-05-09\n\n- Added\n  - Configurability to use tabs instead of spaces (two new options: `--use-tabs` and\n    `--tab-width`)\n  - Configurability on base indentation spaces and extra indentation at different line\n    continuation situations\n\n## [0.1.4] - 2023-05-07\n\n- Added\n  - A new configurable option: `--closing-bracket-extra-indent`\n\n## [0.1.3] - 2023-05-07\n\n- Added\n\n  - A new configurable option: `--collapse-nested-brackets`\n  - A new configurable option: `--wrap-pragma-comments`\n  - Some Github workflow actions to make sure CHANGELOG.md is updated\n\n- Changed\n\n  - Changed the default quote to single quote\n  - Changed the default line length to 79 characters\n\n- Removed\n  - Some unrelated documentation and config files\n\n## [0.1.2] - 2023-05-04\n\n- Added\n  - Merged 2 changes from psf/black:main ([#5](https://github.com/jsh9/cercis/pull/5))\n  - Added option to not wrap \"simple\" lines with long strings\n    ([#6](https://github.com/jsh9/cercis/pull/6))\n- Full changelog\n  - https://github.com/jsh9/cercis/compare/0.1.1...0.1.2\n\n## [0.1.1] - 2023-05-03\n\n- Added\n  - A configurable option: `single-quote`, for formatting code into single quotes\n- Full changelog\n  - https://github.com/jsh9/cercis/compare/0.1.0...0.1.1\n\n## [0.1.0] - 2023-04-30\n\n- This is the initial version that branches away from Black (commit:\n  [e712e4](https://github.com/psf/black/commit/e712e48e06420d9240ce95c81acfcf6f11d14c83))\n- Changed\n  - The default indentation within a function definition (when line wrap happens) is now\n    8 spaces. (Black's default is 4, which is\n    [not PEP8-compatible](https://github.com/psf/black/issues/1127))\n  - Updated README, because `cercis` now branches away from Black\n- Added\n  - A configurable option (`function-definition-extra-indent`) is added instead of\n    enforcing 8 spaces for everyone\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "A more configurable Python code formatter",
    "version": "0.2.3",
    "project_urls": {
        "Changelog": "https://github.com/jsh9/cercis/blob/main/CHANGES.md",
        "Homepage": "https://github.com/jsh9/cercis"
    },
    "split_keywords": [
        "automation",
        "autopep8",
        "formatter",
        "gofmt",
        "pyfmt",
        "rustfmt",
        "yapf"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "28ee2320a1cc71c015bcb96512ded6d5c382d4607576883f0019ec16b28b78cb",
                "md5": "df4ea73c9834370538bcd23cf9bc569b",
                "sha256": "a330e5f84df62902c762fcc0152c9ac386aac2f6dfc2680c4abdf91a94299831"
            },
            "downloads": -1,
            "filename": "cercis-0.2.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "df4ea73c9834370538bcd23cf9bc569b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 174412,
            "upload_time": "2023-10-19T22:59:46",
            "upload_time_iso_8601": "2023-10-19T22:59:46.511932Z",
            "url": "https://files.pythonhosted.org/packages/28/ee/2320a1cc71c015bcb96512ded6d5c382d4607576883f0019ec16b28b78cb/cercis-0.2.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d11cd0a7f249cc6a51867244163d04988b976a55bf0b38eb1fab3e7ae873f476",
                "md5": "85339a7b3115c1b0435086e4ca67a37c",
                "sha256": "6288ca94d4c411fb9f2c7e749f63075184f96e73caf5dc1d40b842076485246a"
            },
            "downloads": -1,
            "filename": "cercis-0.2.3.tar.gz",
            "has_sig": false,
            "md5_digest": "85339a7b3115c1b0435086e4ca67a37c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 1349389,
            "upload_time": "2023-10-19T22:59:47",
            "upload_time_iso_8601": "2023-10-19T22:59:47.823595Z",
            "url": "https://files.pythonhosted.org/packages/d1/1c/d0a7f249cc6a51867244163d04988b976a55bf0b38eb1fab3e7ae873f476/cercis-0.2.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-19 22:59:47",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "jsh9",
    "github_project": "cercis",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "test_requirements": [],
    "tox": true,
    "lcname": "cercis"
}
        
Elapsed time: 0.15390s