Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: remove references to black from the project (#2674)
# Description There are a few mentions of `black` in the project, but they seem inconsistent; - In `.github/workflows/docs.yml`, we use black to validate the formatting of Python code in the docs. However, there is no set-up or instructions to format code locally. Of course this is not a big issue; fixing the formatting is trivial when this gives an error by installing `black`. ```yaml - uses: psf/black@stable with: src: docs/src/python ``` - In `.github/workflows/python_build.yml` `black` seems to be installed but unused. - There is some configuration for `black` in `python/pyproject.toml`, even though the formatter for the project is `ruff`. This PR aims to solve these inconsistencies: - Remove the references to `black` listed above. - Use `ruff` as a formatter for the `docs` to be consistent with the `python` directory. - Add a small `Makefile` to the `docs` directory, with a `format` and a `check` command. ## Considered alternative I also considered adding the `make` commands to `python/Makefile`, similar to the `build-docs` command: ```make .PHONY: format-docs-py format-docs-py: ## Format python files in the docs directory $(info --- format Python code in docs ---) (cd ../docs; ruff format .) .PHONY: check-docs-py check-docs-py: ## Check if python files in the docs directory are formatted $(info --- check Python code in docs ---) (cd ../docs; ruff format --check .) ``` However, this solution has the disadvantage that we need to either install the complete virtual environment in the `docs.yml` workflow, or hardcode the version of `ruff` there, e.g. ``` lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - run: | cd python # Should be the same as in python/pyproject.toml pip install ruff==0.5.2 make check-docs-py ``` --------- Co-authored-by: R. Tyler Croy <[email protected]> Co-authored-by: Ion Koutsouris <[email protected]>
- Loading branch information