diff --git a/.github/workflows/black-lint.yml b/.github/workflows/black-lint.yml index 317336173..e0b5e1379 100644 --- a/.github/workflows/black-lint.yml +++ b/.github/workflows/black-lint.yml @@ -10,4 +10,4 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - - uses: psf/black@stable + - uses: psf/black@23.12.1 diff --git a/README.md b/README.md index 5e21ef434..30fc20dc1 100644 --- a/README.md +++ b/README.md @@ -91,14 +91,26 @@ https://b3d.interplanety.org/en/using-microsoft-visual-studio-code-as-external-i #### Formatting -We use [Black](https://black.readthedocs.io/en/stable/index.html). +We use [Black](https://black.readthedocs.io/en/stable/index.html), version 23. -To make VS Code use it, change the `python.formatting.provider` setting to "black". VS Code will ask you to install Black if not already installed. +To install it, run `pip install 'black>=23,<24'`. + +To make VS Code use it, change the `python.formatting.provider` setting to "black". To format the whole repo, run `black .` (or `python3 -m black .` depending on how it is installed) from the root of the repo. The (minimal) configuration for Black is in `/pyproject.toml`. +There is a GitHub action set up to check that PRs and the main branch are formatted: `/.github/workflows/black-lint.yml` + +If you see a message such as + +``` +Oh no! 💥 💔 💥 The required version `23` does not match the running version `24.1.0`! +``` + +Make sure the `black --version` is 23. Install a 23 version with `pip install 'black>=23,<24'`. + #### Updater notes Be careful if testing the updater when using git, it may mess up the .git folder in some cases. diff --git a/pyproject.toml b/pyproject.toml index 2f96472a4..ad3f17c34 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,6 +3,11 @@ # See https://black.readthedocs.io/en/stable/usage_and_configuration/the_basics.html # or `black --help` for what can go here +# Require black version to be 23.x.y +required-version = '23' +# Install such a version with: +# pip install 'black>=23,<24' + line-length = 120 target-version = [