Skip to content

Commit

Permalink
Merge branch 'main' into unstable
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra authored Jan 24, 2024
2 parents 47221c9 + 8fe602b commit c4f42c6
Show file tree
Hide file tree
Showing 41 changed files with 551 additions and 185 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/diff_shades.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"

Expand Down Expand Up @@ -57,7 +57,7 @@ jobs:
# The baseline revision could be rather old so a full clone is ideal.
fetch-depth: 0

- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"

Expand All @@ -72,7 +72,7 @@ jobs:
- name: Attempt to use cached baseline analysis
id: baseline-cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: ${{ matrix.baseline-analysis }}
key: ${{ matrix.baseline-cache-key }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/diff_shades_comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v4
- uses: actions/setup-python@v5
with:
python-version: "*"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up latest Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "*"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
fi
- name: Set up latest Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "*"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pypi_upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up latest Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "*"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
# Give us all history, branches and tags
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up latest Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "*"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/upload_binary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- uses: actions/checkout@v4

- name: Set up latest Python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: "*"

Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ repos:
additional_dependencies: *version_check_dependencies

- repo: https://github.com/pycqa/isort
rev: 5.12.0
rev: 5.13.2
hooks:
- id: isort

Expand All @@ -39,7 +39,7 @@ repos:
exclude: ^src/blib2to3/

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.7.1
rev: v1.8.0
hooks:
- id: mypy
exclude: ^docs/conf.py
Expand All @@ -58,13 +58,13 @@ repos:
- hypothesmith

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
rev: v4.0.0-alpha.8
hooks:
- id: prettier
exclude: \.github/workflows/diff_shades\.yml

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
rev: v4.5.0
hooks:
- id: end-of-file-fixer
- id: trailing-whitespace
Expand Down
2 changes: 0 additions & 2 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
name: black
description: "Black: The uncompromising Python code formatter"
entry: black
stages: [pre-commit, pre-merge-commit, pre-push, manual]
language: python
minimum_pre_commit_version: 2.9.2
require_serial: true
Expand All @@ -14,7 +13,6 @@
description:
"Black: The uncompromising Python code formatter (with Jupyter Notebook support)"
entry: black
stages: [pre-commit, pre-merge-commit, pre-push, manual]
language: python
minimum_pre_commit_version: 2.9.2
require_serial: true
Expand Down
89 changes: 73 additions & 16 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,34 @@

### Stable style

- Fix bug where `# fmt: off` automatically dedents when used with the `--line-ranges`
option, even when it is not within the specified line range. (#4084)
<!-- Changes that affect Black's stable style -->

### Preview style

- Prefer more equal signs before a break when splitting chained assignments (#4010)
- Standalone form feed characters at the module level are no longer removed (#4021)
- Additional cases of immediately nested tuples, lists, and dictionaries are now
indented less (#4012)
- Allow empty lines at the beginning of all blocks, except immediately before a
docstring (#4060)
- Fix crash in preview mode when using a short `--line-length` (#4086)
<!-- Changes that affect Black's preview style -->

- Fix comment handling when parenthesising conditional expressions (#4134)
- Format module docstrings the same as class and function docstrings (#4095)
- Fix bug where spaces were not added around parenthesized walruses in subscripts,
unlike other binary operators (#4109)
- Remove empty lines before docstrings in async functions (#4132)
- Address a missing case in the change to allow empty lines at the beginning of all
blocks, except immediately before a docstring (#4130)
- For stubs, fix logic to enforce empty line after nested classes with bodies (#4141)
- Fix crash when using a walrus in a dictionary (#4155)
- Fix unnecessary parentheses when wrapping long dicts (#4135)

### Configuration

<!-- Changes to how Black can be configured -->

- `--line-ranges` now skips _Black_'s internal stability check in `--safe` mode. This
avoids a crash on rare inputs that have many unformatted same-content lines. (#4034)
- Fix symlink handling, properly catch and ignore symlinks that point outside of root
(#4161)
- Fix cache mtime logic that resulted in false positive cache hits (#4128)

### Packaging

- Upgrade to mypy 1.7.1 (#4049) (#4069)
- Faster compiled wheels are now available for CPython 3.12 (#4070)
<!-- Changes to how Black is packaged, such as dependency requirements -->

### Parser

Expand All @@ -51,15 +55,68 @@

### Integrations

- Enable 3.12 CI (#4035)
- Build docker images in parallel (#4054)
- Build docker images with 3.12 (#4055)
<!-- For example, Docker, GitHub Actions, pre-commit, editors -->

- Revert the change to run Black's pre-commit integration only on specific git hooks
(#3940) for better compatibility with older versions of pre-commit (#4137)

### Documentation

<!-- Major changes to documentation and policies. Small docs changes
don't need a changelog entry. -->

## 23.12.1

### Packaging

- Fixed a bug that included dependencies from the `d` extra by default (#4108)

## 23.12.0

### Highlights

It's almost 2024, which means it's time for a new edition of _Black_'s stable style!
Together with this release, we'll put out an alpha release 24.1a1 showcasing the draft
2024 stable style, which we'll finalize in the January release. Please try it out and
[share your feedback](https://github.com/psf/black/issues/4042).

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

### Stable style

- Fix bug where `# fmt: off` automatically dedents when used with the `--line-ranges`
option, even when it is not within the specified line range. (#4084)
- Fix feature detection for parenthesized context managers (#4104)

### Preview style

- Prefer more equal signs before a break when splitting chained assignments (#4010)
- Standalone form feed characters at the module level are no longer removed (#4021)
- Additional cases of immediately nested tuples, lists, and dictionaries are now
indented less (#4012)
- Allow empty lines at the beginning of all blocks, except immediately before a
docstring (#4060)
- Fix crash in preview mode when using a short `--line-length` (#4086)
- Keep suites consisting of only an ellipsis on their own lines if they are not
functions or class definitions (#4066) (#4103)

### Configuration

- `--line-ranges` now skips _Black_'s internal stability check in `--safe` mode. This
avoids a crash on rare inputs that have many unformatted same-content lines. (#4034)

### Packaging

- Upgrade to mypy 1.7.1 (#4049) (#4069)
- Faster compiled wheels are now available for CPython 3.12 (#4070)

### Integrations

- Enable 3.12 CI (#4035)
- Build docker images in parallel (#4054)
- Build docker images with 3.12 (#4055)

## 23.11.0

### Highlights
Expand Down
6 changes: 3 additions & 3 deletions docs/guides/using_black_with_other_tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ There are a few deviations that cause incompatibilities with _Black_.

```
max-line-length = 88
extend-ignore = E203
extend-ignore = E203, E704
```

#### Why those options above?
Expand Down Expand Up @@ -184,7 +184,7 @@ extend-ignore = E203, E704
```ini
[flake8]
max-line-length = 88
extend-ignore = E203
extend-ignore = E203, E704
```

</details>
Expand All @@ -195,7 +195,7 @@ extend-ignore = E203
```ini
[flake8]
max-line-length = 88
extend-ignore = E203
extend-ignore = E203, E704
```

</details>
Expand Down
4 changes: 2 additions & 2 deletions docs/integrations/source_version_control.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Use [pre-commit](https://pre-commit.com/). Once you
repos:
# Using this mirror lets us use mypyc-compiled black, which is about 2x faster
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.11.0
rev: 23.12.1
hooks:
- id: black
# It is recommended to specify the latest version of Python
Expand All @@ -35,7 +35,7 @@ include Jupyter Notebooks. To use this hook, simply replace the hook's `id: blac
repos:
# Using this mirror lets us use mypyc-compiled black, which is about 2x faster
- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.11.0
rev: 23.12.1
hooks:
- id: black-jupyter
# It is recommended to specify the latest version of Python
Expand Down
11 changes: 8 additions & 3 deletions docs/usage_and_configuration/the_basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,8 +241,8 @@ configuration file for consistent results across environments.

```console
$ black --version
black, 23.11.0 (compiled: yes)
$ black --required-version 23.11.0 -c "format = 'this'"
black, 23.12.1 (compiled: yes)
$ black --required-version 23.12.1 -c "format = 'this'"
format = "this"
$ black --required-version 31.5b2 -c "still = 'beta?!'"
Oh no! 💥 💔 💥 The required version does not match the running version!
Expand All @@ -268,6 +268,11 @@ recursive searches. An empty value means no paths are excluded. Use forward slas
directories on all platforms (Windows, too). By default, Black also ignores all paths
listed in `.gitignore`. Changing this value will override all default exclusions.

If the regular expression contains newlines, it is treated as a
[verbose regular expression](https://docs.python.org/3/library/re.html#re.VERBOSE). This
is typically useful when setting these options in a `pyproject.toml` configuration file;
see [Configuration format](#configuration-format) for more information.

#### `--extend-exclude`

Like `--exclude`, but adds additional files and directories on top of the default values
Expand Down Expand Up @@ -333,7 +338,7 @@ You can check the version of _Black_ you have installed using the `--version` fl

```console
$ black --version
black, 23.11.0
black, 23.12.1
```

#### `--config`
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ preview = true
# NOTE: You don't need this in your own Black configuration.

[build-system]
requires = ["hatchling>=1.8.0", "hatch-vcs", "hatch-fancy-pypi-readme"]
requires = ["hatchling>=1.20.0", "hatch-vcs", "hatch-fancy-pypi-readme"]
build-backend = "hatchling.build"

[project]
Expand Down Expand Up @@ -187,7 +187,7 @@ CC = "clang"
build-frontend = { name = "build", args = ["--no-isolation"] }
# Unfortunately, hatch doesn't respect MACOSX_DEPLOYMENT_TARGET
before-build = [
"python -m pip install 'hatchling==1.18.0' hatch-vcs hatch-fancy-pypi-readme 'hatch-mypyc>=0.16.0' 'mypy==1.7.1' 'click==8.1.3'",
"python -m pip install 'hatchling==1.20.0' hatch-vcs hatch-fancy-pypi-readme 'hatch-mypyc>=0.16.0' 'mypy==1.7.1' 'click==8.1.3'",
"""sed -i '' -e "600,700s/'10_16'/os.environ['MACOSX_DEPLOYMENT_TARGET'].replace('.', '_')/" $(python -c 'import hatchling.builders.wheel as h; print(h.__file__)') """,
]

Expand Down
Loading

0 comments on commit c4f42c6

Please sign in to comment.