Skip to content

Commit

Permalink
Use Black 23 specifically (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
Dragorn421 authored Jan 26, 2024
1 parent dcb1891 commit 42eddfd
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/black-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
- uses: psf/black@23.12.1
16 changes: 14 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
5 changes: 5 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down

0 comments on commit 42eddfd

Please sign in to comment.