This PR adds the Black code formatter to our GitHub Actions workflow. Here are the key changes:
Install Black:
In the "Install dependencies" step, we've added black to the list of packages installed:
python -m pip install flake8 pytest black
New Black Formatting Step:
We've added a new step to run Black after linting with flake8 and before running tests:
- name: Format with Black
run: |
black --check --diff .
This step runs Black in check mode (--check) and shows the diff of any formatting changes (--diff).
The workflow will fail if there are any formatting issues, but it won't actually change the files.
Notes
If we want Black to automatically format the files instead of just checking, we can remove the --check and --diff flags.
Consider adding a .black configuration file to the repository to customize Black's behavior if needed.
We might want to adjust our flake8 configuration to align with Black's formatting choices, particularly the line length.
Add Black to GitHub Actions Workflow
This PR adds the Black code formatter to our GitHub Actions workflow. Here are the key changes:
Install Black: In the "Install dependencies" step, we've added
black
to the list of packages installed:New Black Formatting Step: We've added a new step to run Black after linting with flake8 and before running tests:
This step runs Black in check mode (
--check
) and shows the diff of any formatting changes (--diff
). The workflow will fail if there are any formatting issues, but it won't actually change the files.Notes
--check
and--diff
flags..black
configuration file to the repository to customize Black's behavior if needed.