diff --git a/.github/workflows/format-command.yml b/.github/workflows/format-command.yml index f40234f8be3..1ee1ba12bf4 100644 --- a/.github/workflows/format-command.yml +++ b/.github/workflows/format-command.yml @@ -32,7 +32,7 @@ jobs: # Install formatting tools - name: Install formatting tools run: | - python -m pip install black blackdoc docformatter ruff + python -m pip install blackdoc docformatter ruff python -m pip list sudo apt-get install dos2unix diff --git a/.github/workflows/style_checks.yaml b/.github/workflows/style_checks.yaml index 9b58341e10e..75146b83b40 100644 --- a/.github/workflows/style_checks.yaml +++ b/.github/workflows/style_checks.yaml @@ -34,11 +34,11 @@ jobs: - name: Install packages run: | - python -m pip install black blackdoc docformatter pylint ruff + python -m pip install blackdoc docformatter pylint ruff python -m pip list sudo apt-get install dos2unix - - name: Formatting check (black, blackdoc, docformatter, ruff) + - name: Formatting check (blackdoc, docformatter, ruff) run: make check - name: Linting (pylint) diff --git a/Makefile b/Makefile index e411cb14da9..4d5183da4f7 100644 --- a/Makefile +++ b/Makefile @@ -15,8 +15,8 @@ help: @echo " fulltest run the test suite (including all doctests)" @echo " doctest run the doctests only" @echo " test_no_images run the test suite (including all doctests) but skip image comparisons" - @echo " format run black, blackdoc, docformatter and ruff to automatically format the code" - @echo " check run code style and quality checks (black, blackdoc, docformatter, ruff)" + @echo " format run blackdoc, docformatter and ruff to automatically format the code" + @echo " check run code style and quality checks (blackdoc, docformatter, ruff)" @echo " codespell run codespell to check common misspellings" @echo " lint run pylint for a deeper (and slower) quality check" @echo " clean clean up build and generated files" @@ -61,14 +61,12 @@ test_no_images: _runtest format: docformatter --in-place $(FORMAT_FILES) - black $(FORMAT_FILES) blackdoc $(FORMAT_FILES) ruff check --fix $(FORMAT_FILES) ruff format $(FORMAT_FILES) check: docformatter --check $(FORMAT_FILES) - black --check $(FORMAT_FILES) blackdoc --check $(FORMAT_FILES) ruff check $(FORMAT_FILES) ruff format --check $(FORMAT_FILES) diff --git a/doc/contributing.md b/doc/contributing.md index 4ccdfbd2416..6a20dede4da 100644 --- a/doc/contributing.md +++ b/doc/contributing.md @@ -404,7 +404,7 @@ the `pygmt/src/` and `pygmt/datasets/` folders. **All docstrings** should follow All functions/classes/methods should have docstrings with a full description of all arguments and return values. -While the maximum line length for code is automatically set by Black, docstrings +While the maximum line length for code is automatically set by ruff, docstrings must be formatted manually. To play nicely with Jupyter and IPython, **keep docstrings limited to 79 characters** per line. @@ -473,12 +473,11 @@ code, be sure to follow the general guidelines in the We use some tools to format the code so we don't have to think about it: -- [Black](https://github.com/psf/black) - [blackdoc](https://github.com/keewis/blackdoc) - [docformatter](https://github.com/myint/docformatter) - [ruff](https://docs.astral.sh/ruff) -Black and blackdoc loosely follows the [PEP8](http://pep8.org) guide but with a few +These tools loosely follow the [PEP8](http://pep8.org) guide but with a few differences. Regardless, you won't have to worry about formatting the code yourself. Before committing, run it to automatically format your code: @@ -513,7 +512,7 @@ The [`Makefile`](https://github.com/GenericMappingTools/pygmt/blob/main/Makefile contains rules for running both checks: ```bash -make check # Runs black, blackdoc, docformatter, ruff (in check mode) +make check # Runs blackdoc, docformatter, ruff (in check mode) make lint # Runs pylint, which is a bit slower ``` diff --git a/environment.yml b/environment.yml index 73b45304436..bad038f2baf 100644 --- a/environment.yml +++ b/environment.yml @@ -22,7 +22,6 @@ dependencies: - make - pip # Dev dependencies (style checks) - - black - blackdoc - codespell - docformatter>=1.7.2