Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
jsh9 committed Nov 8, 2023
2 parents aff5482 + 58f31a7 commit d682c7e
Show file tree
Hide file tree
Showing 51 changed files with 2,851 additions and 203 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Set up latest Python
uses: actions/setup-python@v4
with:
python-version: "*"
python-version: "3.11"

- name: Install dependencies
run: |
Expand Down
56 changes: 56 additions & 0 deletions .github/workflows/release_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Release tool CI

on:
push:
paths:
- .github/workflows/release_tests.yml
- release.py
- release_tests.py
pull_request:
paths:
- .github/workflows/release_tests.yml
- release.py
- release_tests.py

jobs:
build:
# We want to run on external PRs, but not on our own internal PRs as they'll be run
# by the push to the branch. Without this if check, checks are duplicated since
# internal PRs match both the push and pull_request events.
if:
github.event_name == 'push' || github.event.pull_request.head.repo.full_name !=
github.repository

name: Running python ${{ matrix.python-version }} on ${{matrix.os}}
runs-on: ${{ matrix.os }}
strategy:
matrix:
python-version: ["3.12"]
os: [macOS-latest, ubuntu-latest, windows-latest]

steps:
- uses: actions/checkout@v4
with:
# Give us all history, branches and tags
fetch-depth: 0
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
allow-prereleases: true

- name: Print Python Version
run: python --version --version && which python

- name: Print Git Version
run: git --version && which git

- name: Update pip, setuptools + wheels
run: |
python -m pip install --upgrade pip setuptools wheel
- name: Run unit tests via coverage + print report
run: |
python -m pip install coverage
coverage run scripts/release_tests.py
coverage report --show-missing
2 changes: 2 additions & 0 deletions .pre-commit-hooks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
name: cercis
description: "Cercis: a more configurable Python code formatter"
entry: cercis
stages: [pre-commit, pre-merge-commit, pre-push, manual]
language: python
minimum_pre_commit_version: 2.9.2
require_serial: true
Expand All @@ -11,6 +12,7 @@
description:
"Cercis: a more configurable Python code formatter (with Jupyter Notebook support)"
entry: cercis
stages: [pre-commit, pre-merge-commit, pre-push, manual]
language: python
minimum_pre_commit_version: 2.9.2
require_serial: true
Expand Down
116 changes: 92 additions & 24 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,101 @@
# Change Log

## Unreleased

### Highlights

<!-- Include any especially major or disruptive changes here -->

### Stable style

<!-- Changes that affect Black's stable style -->

### Preview style

<!-- Changes that affect Black's preview style -->

### Configuration

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

### Packaging

<!-- Changes to how Black is packaged, such as dependency requirements -->

### Parser

<!-- Changes to the parser or to version autodetection -->

### Performance

<!-- Changes that improve Black's performance. -->

### Output

<!-- Changes to Black's terminal output and error messages -->

### _Blackd_

<!-- Changes to blackd -->

### Integrations

<!-- For example, Docker, GitHub Actions, pre-commit, editors -->

### Documentation

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

## 23.11.0

### Highlights

- Support formatting ranges of lines with the new `--line-ranges` command-line option
(#4020)

### Stable style

- Fix crash on formatting bytes strings that look like docstrings (#4003)
- Fix crash when whitespace followed a backslash before newline in a docstring (#4008)
- Fix standalone comments inside complex blocks crashing Black (#4016)
- Fix crash on formatting code like `await (a ** b)` (#3994)
- No longer treat leading f-strings as docstrings. This matches Python's behaviour and
fixes a crash (#4019)

### Preview style

- Multiline dicts and lists that are the sole argument to a function are now indented
less (#3964)
- Multiline unpacked dicts and lists as the sole argument to a function are now also
indented less (#3992)
- In f-string debug expressions, quote types that are visible in the final string are
now preserved (#4005)
- Fix a bug where long `case` blocks were not split into multiple lines. Also enable
general trailing comma rules on `case` blocks (#4024)
- Keep requiring two empty lines between module-level docstring and first function or
class definition (#4028)
- Add support for single-line format skip with other comments on the same line (#3959)

### Configuration

- Consistently apply force exclusion logic before resolving symlinks (#4015)
- Fix a bug in the matching of absolute path names in `--include` (#3976)

### Performance

- Fix mypyc builds on arm64 on macOS (#4017)

### Integrations

- Black's pre-commit integration will now run only on git hooks appropriate for a code
formatter (#3940)

## 23.10.1

### Highlights

- Maintanence release to get a fix out for GitHub Action edge case (#3957)
- Maintenance release to get a fix out for GitHub Action edge case (#3957)

### Preview style

Expand Down Expand Up @@ -254,8 +345,6 @@ versions separately.

### Stable style

<!-- Changes that affect Black's stable style -->

- Introduce the 2023 stable style, which incorporates most aspects of last year's
preview style (#3418). Specific changes:
- Enforce empty lines before classes and functions with sticky leading comments
Expand Down Expand Up @@ -289,8 +378,6 @@ versions separately.

### Preview style

<!-- Changes that affect Black's preview style -->

- Format hex codes in unicode escape sequences in string literals (#2916)
- Add parentheses around `if`-`else` expressions (#2278)
- Improve performance on large expressions that contain many strings (#3467)
Expand Down Expand Up @@ -321,15 +408,11 @@ versions separately.

### Configuration

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

- Black now tries to infer its `--target-version` from the project metadata specified in
`pyproject.toml` (#3219)

### Packaging

<!-- Changes to how Black is packaged, such as dependency requirements -->

- Upgrade mypyc from `0.971` to `0.991` so mypycified _Black_ can be built on armv7
(#3380)
- This also fixes some crashes while using compiled Black with a debug build of
Expand All @@ -342,8 +425,6 @@ versions separately.

### Output

<!-- Changes to Black's terminal output and error messages -->

- Calling `black --help` multiple times will return the same help contents each time
(#3516)
- Verbose logging now shows the values of `pyproject.toml` configuration variables
Expand All @@ -353,25 +434,18 @@ versions separately.

### Integrations

<!-- For example, Docker, GitHub Actions, pre-commit, editors -->

- Move 3.11 CI to normal flow now that all dependencies support 3.11 (#3446)
- Docker: Add new `latest_prerelease` tag automation to follow latest black alpha
release on docker images (#3465)

### Documentation

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

- Expand `vim-plug` installation instructions to offer more explicit options (#3468)

## 22.12.0

### Preview style

<!-- Changes that affect Black's preview style -->

- Enforce empty lines before classes and functions with sticky leading comments (#3302)
- Reformat empty and whitespace-only files as either an empty file (if no newline is
present) or as a single newline character (if a newline is present) (#3348)
Expand All @@ -384,25 +458,19 @@ versions separately.

### Configuration

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

- Fix incorrectly applied `.gitignore` rules by considering the `.gitignore` location
and the relative path to the target file (#3338)
- Fix incorrectly ignoring `.gitignore` presence when more than one source directory is
specified (#3336)

### Parser

<!-- Changes to the parser or to version autodetection -->

- Parsing support has been added for walruses inside generator expression that are
passed as function args (for example,
`any(match := my_re.match(text) for text in texts)`) (#3327).

### Integrations

<!-- For example, Docker, GitHub Actions, pre-commit, editors -->

- Vim plugin: Optionally allow using the system installation of Black via
`let g:black_use_virtualenv = 0`(#3309)

Expand Down
14 changes: 13 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ exclude = ["/profiling"]
[tool.hatch.build.targets.wheel]
only-include = ["src"]
sources = ["src"]
# Note that we change the behaviour of this flag below
macos-max-compat = true

[tool.hatch.build.targets.wheel.hooks.mypyc]
enable-by-default = false
Expand Down Expand Up @@ -181,9 +183,18 @@ before-build = [
HATCH_BUILD_HOOKS_ENABLE = "1"
MYPYC_OPT_LEVEL = "3"
MYPYC_DEBUG_LEVEL = "0"
AIOHTTP_NO_EXTENSIONS = "1"

# Black needs Clang to compile successfully on Linux.
CC = "clang"
AIOHTTP_NO_EXTENSIONS = "1"

[tool.cibuildwheel.macos]
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.5.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__)') """,
]

[tool.isort]
atomic = true
Expand Down Expand Up @@ -230,6 +241,7 @@ omit = [
]
[tool.coverage.run]
relative_files = true
branch = true

[tool.mypy]
# Specify the target platform details in config, so your developers are
Expand Down
Loading

0 comments on commit d682c7e

Please sign in to comment.