Skip to content

Commit

Permalink
Merge branch 'main' into fix-macos-executable
Browse files Browse the repository at this point in the history
  • Loading branch information
JelleZijlstra authored Sep 26, 2022
2 parents d3bef04 + 2189bca commit 6797337
Show file tree
Hide file tree
Showing 25 changed files with 335 additions and 256 deletions.
14 changes: 0 additions & 14 deletions .github/mypyc-requirements.txt

This file was deleted.

12 changes: 5 additions & 7 deletions .github/workflows/diff_shades.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: diff-shades
on:
push:
branches: [main]
paths: ["src/**", "setup.*", "pyproject.toml", ".github/workflows/*"]
paths: ["src/**", "pyproject.toml", ".github/workflows/*"]

pull_request:
paths: ["src/**", "setup.*", "pyproject.toml", ".github/workflows/*"]
paths: ["src/**", "pyproject.toml", ".github/workflows/*"]

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.run_id }}
Expand Down Expand Up @@ -41,6 +41,7 @@ jobs:
needs: configure
runs-on: ubuntu-latest
env:
HATCH_BUILD_HOOKS_ENABLE: "1"
# Clang is less picky with the C code it's given than gcc (and may
# generate faster binaries too).
CC: clang-12
Expand All @@ -64,7 +65,6 @@ jobs:
run: |
python -m pip install https://github.com/ichard26/diff-shades/archive/stable.zip
python -m pip install click packaging urllib3
python -m pip install -r .github/mypyc-requirements.txt
# After checking out old revisions, this might not exist so we'll use a copy.
cat scripts/diff_shades_gha_helper.py > helper.py
git config user.name "diff-shades-gha"
Expand All @@ -83,8 +83,7 @@ jobs:
GITHUB_TOKEN: ${{ github.token }}
run: >
${{ matrix.baseline-setup-cmd }}
&& python setup.py --use-mypyc bdist_wheel
&& python -m pip install dist/*.whl && rm build dist -r
&& python -m pip install .
- name: Analyze baseline revision
if: steps.baseline-cache.outputs.cache-hit != 'true'
Expand All @@ -97,8 +96,7 @@ jobs:
GITHUB_TOKEN: ${{ github.token }}
run: >
${{ matrix.target-setup-cmd }}
&& python setup.py --use-mypyc bdist_wheel
&& python -m pip install dist/*.whl
&& python -m pip install .
- name: Analyze target revision
run: >
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fuzz.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
python-version: ["3.7", "3.8", "3.9", "3.10"]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/pypi_upload.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ jobs:
uses: pypa/[email protected]
env:
CIBW_ARCHS_MACOS: "${{ matrix.macos_arch }}"
# This isn't supported in pyproject.toml which makes sense (but is annoying).
CIBW_PROJECT_REQUIRES_PYTHON: ">=3.6.2"

- name: Upload wheels as workflow artifacts
uses: actions/upload-artifact@v2
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10", "pypy-3.7", "pypy-3.8"]
python-version: ["3.7", "3.8", "3.9", "3.10", "pypy-3.7", "pypy-3.8"]
os: [ubuntu-latest, macOS-latest, windows-latest]

steps:
Expand Down
11 changes: 11 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,16 @@

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

- Runtime support for Python 3.6 has been removed. Formatting 3.6 code will still be
supported until further notice.

### Stable style

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

- Fix a crash when `# fmt: on` is used on a different block level than `# fmt: off`
(#3281)

### Preview style

<!-- Changes that affect Black's preview style -->
Expand All @@ -28,6 +34,8 @@
- Executables made with PyInstaller will no longer crash when formatting several files
at once on macOS. Native x86-64 executables for macOS are available once again.
(#3275)
- Hatchling is now used as the build backend. This will not have any effect for users
who install Black with its wheels from PyPI. (#3233)
- Faster compiled wheels are now available for CPython 3.11 (#3276)

### Parser
Expand All @@ -50,6 +58,9 @@

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

- Update GitHub Action to support use of version specifiers (e.g. `<23`) for Black
version (#3265)

### Documentation

<!-- Major changes to documentation and policies. Small docs changes
Expand Down
1 change: 0 additions & 1 deletion MANIFEST.in

This file was deleted.

7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
![Black Logo](https://raw.githubusercontent.com/psf/black/main/docs/_static/logo2-readme.png)
[![Black Logo](https://raw.githubusercontent.com/psf/black/main/docs/_static/logo2-readme.png)](https://black.readthedocs.io/en/stable/)

<h2 align="center">The Uncompromising Code Formatter</h2>

Expand Down Expand Up @@ -38,9 +38,8 @@ Try it out now using the [Black Playground](https://black.vercel.app). Watch the

### Installation

_Black_ can be installed by running `pip install black`. It requires Python 3.6.2+ to
run. If you want to format Jupyter Notebooks, install with
`pip install 'black[jupyter]'`.
_Black_ can be installed by running `pip install black`. It requires Python 3.7+ 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:

Expand Down
7 changes: 4 additions & 3 deletions action/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@

run([sys.executable, "-m", "venv", str(ENV_PATH)], check=True)

req = "black[colorama]"
if VERSION:
req += f"=={VERSION}"
version_specifier = VERSION
if VERSION and VERSION[0] in "0123456789":
version_specifier = f"=={VERSION}"
req = f"black[colorama]{version_specifier}"
pip_proc = run(
[str(ENV_BIN / "python"), "-m", "pip", "install", req],
stdout=PIPE,
Expand Down
4 changes: 2 additions & 2 deletions docs/contributing/reference/reference_functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ Utilities

.. autofunction:: black.comments.is_fmt_on

.. autofunction:: black.comments.contains_fmt_on_at_column
.. autofunction:: black.comments.children_contains_fmt_on

.. autofunction:: black.nodes.first_leaf_column
.. autofunction:: black.nodes.first_leaf_of

.. autofunction:: black.linegen.generate_trailers_to_omit

Expand Down
6 changes: 4 additions & 2 deletions docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,17 @@ disabled-by-default counterpart W504. E203 should be disabled while changes are

## Which Python versions does Black support?

Currently the runtime requires Python 3.6-3.10. Formatting is supported for files
containing syntax from Python 3.3 to 3.10. We promise to support at least all Python
Currently the runtime requires Python 3.7-3.11. Formatting is supported for files
containing syntax from Python 3.3 to 3.11. We promise to support at least all Python
versions that have not reached their end of life. This is the case for both running
_Black_ and formatting code.

Support for formatting Python 2 code was removed in version 22.0. While we've made no
plans to stop supporting older Python 3 minor versions immediately, their support might
also be removed some time in the future without a deprecation period.

Runtime support for 3.6 was removed in version 22.9.0.

## Why does my linter or typechecker complain after I format my code?

Some linters and other tools use magical comments (e.g., `# noqa`, `# type: ignore`) to
Expand Down
5 changes: 2 additions & 3 deletions docs/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,8 @@ Also, you can try out _Black_ online for minimal fuss on the

## Installation

_Black_ can be installed by running `pip install black`. It requires Python 3.6.2+ to
run. If you want to format Jupyter Notebooks, install with
`pip install 'black[jupyter]'`.
_Black_ can be installed by running `pip install black`. It requires Python 3.7+ 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:

Expand Down
2 changes: 1 addition & 1 deletion docs/integrations/editors.md
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ curl https://raw.githubusercontent.com/psf/black/stable/autoload/black.vim -o ~/
Let me know if this requires any changes to work with Vim 8's builtin `packadd`, or
Pathogen, and so on.

This plugin **requires Vim 7.0+ built with Python 3.6+ support**. It needs Python 3.6 to
This plugin **requires Vim 7.0+ built with Python 3.7+ support**. It needs Python 3.7 to
be able to run _Black_ inside the Vim process which is much faster than calling an
external command.

Expand Down
21 changes: 18 additions & 3 deletions docs/integrations/github_actions.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,12 @@ We recommend the use of the `@stable` tag, but per version tags also exist if yo
that. Note that the action's version you select is independent of the version of _Black_
the action will use.

The version of _Black_ the action will use can be configured via `version`. The action
defaults to the latest release available on PyPI. Only versions available from PyPI are
supported, so no commit SHAs or branch names.
The version of _Black_ the action will use can be configured via `version`. This can be
any
[valid version specifier](https://packaging.python.org/en/latest/glossary/#term-Version-Specifier)
or just the version number if you want an exact version. The action defaults to the
latest release available on PyPI. Only versions available from PyPI are supported, so no
commit SHAs or branch names.

You can also configure the arguments passed to _Black_ via `options` (defaults to
`'--check --diff'`) and `src` (default is `'.'`)
Expand All @@ -48,3 +51,15 @@ Here's an example configuration:
src: "./src"
version: "21.5b1"
```

If you want to match versions covered by Black's
[stability policy](labels/stability-policy), you can use the compatible release operator
(`~=`):

```yaml
- uses: psf/black@stable
with:
options: "--check --verbose"
src: "./src"
version: "~= 22.0"
```
16 changes: 8 additions & 8 deletions docs/the_black_code_style/future_style.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ So _Black_ will eventually format it like this:

```py3
with \
make_context_manager(1) as cm1, \
make_context_manager(2) as cm2, \
make_context_manager(3) as cm3, \
make_context_manager(4) as cm4 \
make_context_manager1() as cm1, \
make_context_manager2() as cm2, \
make_context_manager3() as cm3, \
make_context_manager4() as cm4 \
:
... # backslashes and an ugly stranded colon
```
Expand All @@ -40,10 +40,10 @@ following way:

```python
with contextlib.ExitStack() as exit_stack:
cm1 = exit_stack.enter_context(make_context_manager(1))
cm2 = exit_stack.enter_context(make_context_manager(2))
cm3 = exit_stack.enter_context(make_context_manager(3))
cm4 = exit_stack.enter_context(make_context_manager(4))
cm1 = exit_stack.enter_context(make_context_manager1())
cm2 = exit_stack.enter_context(make_context_manager2())
cm3 = exit_stack.enter_context(make_context_manager3())
cm4 = exit_stack.enter_context(make_context_manager4())
...
```

Expand Down
7 changes: 4 additions & 3 deletions docs/usage_and_configuration/the_basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -204,9 +204,10 @@ code in compliance with many other _Black_ formatted projects.

[PEP 518](https://www.python.org/dev/peps/pep-0518/) defines `pyproject.toml` as a
configuration file to store build system requirements for Python projects. With the help
of tools like [Poetry](https://python-poetry.org/) or
[Flit](https://flit.readthedocs.io/en/latest/) it can fully replace the need for
`setup.py` and `setup.cfg` files.
of tools like [Poetry](https://python-poetry.org/),
[Flit](https://flit.readthedocs.io/en/latest/), or
[Hatch](https://hatch.pypa.io/latest/) it can fully replace the need for `setup.py` and
`setup.cfg` files.

### Where _Black_ looks for the file

Expand Down
Loading

0 comments on commit 6797337

Please sign in to comment.