Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Black 23 specifically #303

Merged
merged 1 commit into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading