@@ -32,59 +32,74 @@ We recommend the use of the `@stable` tag, but per version tags also exist if yo
3232that. Note that the action's version you select is independent of the version of _Black_
3333the action will use.
3434
35- The version of _Black_ the action will use can be configured via `version` or read from
36- the `pyproject.toml` file. `version` can be any
37- [valid version specifier](https://packaging.python.org/en/latest/glossary/#term-Version-Specifier)
38- or just the version number if you want an exact version. To read the version from the
39- ` pyproject.toml` file instead, set `use_pyproject` to `true`. This will first look into
40- the `tool.black.required-version` field, then the `dependency-groups` table, then the
41- ` project.dependencies` array and finally the `project.optional-dependencies` table. The
42- action defaults to the latest release available on PyPI. Only versions available from
43- PyPI are supported, so no commit SHAs or branch names.
35+ # ## Versions
4436
45- If you want to include Jupyter Notebooks, _Black_ must be installed with the `jupyter`
46- extra. Installing the extra and including Jupyter Notebook files can be configured via
47- ` jupyter` (default is `false`).
37+ The version of _Black_ the action will use can be configured via `version` or read from
38+ the `pyproject.toml` file. The action defaults to the latest release available on PyPI.
4839
49- You can also configure the arguments passed to _Black_ via `options` (defaults to
50- ` '--check --diff'` ) and `src` (default is `'.'`). Please note that the
51- [`--check` flag](labels/exit-code) is required so that the workflow fails if _Black_
52- finds files that need to be formatted.
40+ ` version` can be any
41+ [valid version specifier](https://packaging.python.org/en/latest/glossary/#term-Version-Specifier)
42+ or just the version number if you want an exact version.
5343
54- Here's an example configuration :
44+ If you want to match versions covered by Black's
45+ [stability policy](labels/stability-policy), you can use the compatible release operator
46+ (`~=`) :
5547
5648` ` ` yaml
5749- uses: psf/black@stable
5850 with:
5951 options: "--check --verbose"
6052 src: "./src"
61- jupyter: true
62- version: "21.5b1"
53+ version: "~= 22.0"
6354` ` `
6455
65- If you want to match versions covered by Black's
66- [stability policy](labels/stability-policy), you can use the compatible release operator
67- (`~=`) :
56+ To read the version from the `pyproject.toml` file instead, set `use_pyproject` to
57+ ` true` . This will first look into the `tool.black.required-version` field, then the
58+ ` dependency-groups` table, then the `project.dependencies` array and finally the
59+ ` project.optional-dependencies` table. Note that this requires Python >= 3.11, so using
60+ the setup-python action may be required, for example :
6861
6962` ` ` yaml
63+ - uses: actions/setup-python@v5
64+ with:
65+ python-version: "3.13"
7066- uses: psf/black@stable
7167 with:
7268 options: "--check --verbose"
7369 src: "./src"
74- version: "~= 22.0"
70+ use_pyproject: true
7571` ` `
7672
77- If you want to read the version from `pyproject.toml`, set `use_pyproject` to `true`.
78- Note that this requires Python >= 3.11, so using the setup-python action may be
79- required, for example :
73+ Only versions available from PyPI are supported, so no commit SHAs or branch names.
74+
75+ # ## Jupyter Notebooks
76+
77+ If you want to include Jupyter Notebooks, it can be enabled by setting `jupyter` to
78+ `true` (default is `false`) :
8079
8180` ` ` yaml
82- - uses: actions/setup-python@v5
81+ - uses: psf/black@stable
8382 with:
84- python-version: "3.13"
83+ jupyter: true
84+ ` ` `
85+
86+ See the [Jupyter Notebooks guide](../guides/using_black_with_jupyter_notebooks.md) for
87+ more details.
88+
89+ # ## CLI Options
90+
91+ You can also configure the arguments passed to _Black_ via `options` (defaults to
92+ ` '--check --diff'` ) and `src` (default is `'.'`). Please note that the
93+ [`--check` flag](labels/exit-code) is required so that the workflow fails if _Black_
94+ finds files that need to be formatted.
95+
96+ Here's an example configuration :
97+
98+ ` ` ` yaml
8599- uses: psf/black@stable
86100 with:
87101 options: "--check --verbose"
88102 src: "./src"
89- use_pyproject: true
103+ jupyter: true
104+ version: "21.5b1"
90105` ` `
0 commit comments