update github-action to look for black version in "dependency-groups" (#4606)
"dependency-groups" is the mechanism for storing package requirements in `pyproject.toml`, recommended for formatting tools (see https://packaging.python.org/en/latest/specifications/dependency-groups/ ) this change allow the black action to look also in those locations when determining the version of black to install
This commit is contained in:
parent
dbb14eac93
commit
dd278cb316
@ -51,6 +51,8 @@
|
|||||||
<!-- For example, Docker, GitHub Actions, pre-commit, editors -->
|
<!-- For example, Docker, GitHub Actions, pre-commit, editors -->
|
||||||
|
|
||||||
- Fix the version check in the vim file to reject Python 3.8 (#4567)
|
- Fix the version check in the vim file to reject Python 3.8 (#4567)
|
||||||
|
- Enhance GitHub Action `psf/black` to read Black version from an additional
|
||||||
|
section in pyproject.toml: `[project.dependency-groups]` (#4606)
|
||||||
|
|
||||||
### Documentation
|
### Documentation
|
||||||
|
|
||||||
|
@ -71,6 +71,7 @@ def read_version_specifier_from_pyproject() -> str:
|
|||||||
return f"=={version}"
|
return f"=={version}"
|
||||||
|
|
||||||
arrays = [
|
arrays = [
|
||||||
|
*pyproject.get("dependency-groups", {}).values(),
|
||||||
pyproject.get("project", {}).get("dependencies"),
|
pyproject.get("project", {}).get("dependencies"),
|
||||||
*pyproject.get("project", {}).get("optional-dependencies", {}).values(),
|
*pyproject.get("project", {}).get("optional-dependencies", {}).values(),
|
||||||
]
|
]
|
||||||
|
@ -37,10 +37,10 @@ the `pyproject.toml` file. `version` can be any
|
|||||||
[valid version specifier](https://packaging.python.org/en/latest/glossary/#term-Version-Specifier)
|
[valid version specifier](https://packaging.python.org/en/latest/glossary/#term-Version-Specifier)
|
||||||
or just the version number if you want an exact version. To read the version from the
|
or just the version number if you want an exact version. To read the version from the
|
||||||
`pyproject.toml` file instead, set `use_pyproject` to `true`. This will first look into
|
`pyproject.toml` file instead, set `use_pyproject` to `true`. This will first look into
|
||||||
the `tool.black.required-version` field, then the `project.dependencies` array and
|
the `tool.black.required-version` field, then the `dependency-groups` table, then the
|
||||||
finally the `project.optional-dependencies` table. The action defaults to the latest
|
`project.dependencies` array and finally the `project.optional-dependencies` table.
|
||||||
release available on PyPI. Only versions available from PyPI are supported, so no commit
|
The action defaults to the latest release available on PyPI. Only versions available
|
||||||
SHAs or branch names.
|
from PyPI are supported, so no commit SHAs or branch names.
|
||||||
|
|
||||||
If you want to include Jupyter Notebooks, _Black_ must be installed with the `jupyter`
|
If you want to include Jupyter Notebooks, _Black_ must be installed with the `jupyter`
|
||||||
extra. Installing the extra and including Jupyter Notebook files can be configured via
|
extra. Installing the extra and including Jupyter Notebook files can be configured via
|
||||||
|
Loading…
Reference in New Issue
Block a user