Skip to content

Commit 5084862

Browse files
Merge branch 'main' into add-coast-alias-F
2 parents 1d650bb + ac4e184 commit 5084862

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+106
-189
lines changed

.github/workflows/format-command.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
# Install formatting tools
3333
- name: Install formatting tools
3434
run: |
35-
python -m pip install black blackdoc docformatter ruff
35+
python -m pip install blackdoc docformatter ruff
3636
python -m pip list
3737
sudo apt-get install dos2unix
3838

.github/workflows/style_checks.yaml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,16 +34,13 @@ jobs:
3434

3535
- name: Install packages
3636
run: |
37-
python -m pip install black blackdoc docformatter pylint ruff
37+
python -m pip install blackdoc docformatter ruff
3838
python -m pip list
3939
sudo apt-get install dos2unix
4040
41-
- name: Formatting check (black, blackdoc, docformatter, ruff)
41+
- name: Formatting check (blackdoc, docformatter, ruff)
4242
run: make check
4343

44-
- name: Linting (pylint)
45-
run: make lint
46-
4744
- name: Ensure files use UNIX line breaks and have 644 permission
4845
run: |
4946
find . -type f -not -path '*/\.git/*' -exec grep -Iq . {} \; -exec dos2unix --quiet {} \;

Makefile

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,9 @@ help:
1515
@echo " fulltest run the test suite (including all doctests)"
1616
@echo " doctest run the doctests only"
1717
@echo " test_no_images run the test suite (including all doctests) but skip image comparisons"
18-
@echo " format run black, blackdoc, docformatter and ruff to automatically format the code"
19-
@echo " check run code style and quality checks (black, blackdoc, docformatter, ruff)"
18+
@echo " format run blackdoc, docformatter and ruff to automatically format the code"
19+
@echo " check run code style and quality checks (blackdoc, docformatter, ruff)"
2020
@echo " codespell run codespell to check common misspellings"
21-
@echo " lint run pylint for a deeper (and slower) quality check"
2221
@echo " clean clean up build and generated files"
2322
@echo " distclean clean up build and generated files, including project metadata files"
2423
@echo ""
@@ -61,24 +60,19 @@ test_no_images: _runtest
6160

6261
format:
6362
docformatter --in-place $(FORMAT_FILES)
64-
black $(FORMAT_FILES)
6563
blackdoc $(FORMAT_FILES)
6664
ruff check --fix $(FORMAT_FILES)
6765
ruff format $(FORMAT_FILES)
6866

6967
check:
7068
docformatter --check $(FORMAT_FILES)
71-
black --check $(FORMAT_FILES)
7269
blackdoc --check $(FORMAT_FILES)
7370
ruff check $(FORMAT_FILES)
7471
ruff format --check $(FORMAT_FILES)
7572

7673
codespell:
7774
@codespell
7875

79-
lint:
80-
pylint $(LINT_FILES)
81-
8276
clean:
8377
find . -name "*.pyc" -exec rm -v {} +
8478
find . -name "*~" -exec rm -v {} +

doc/conf.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
"""
22
Sphinx documentation configuration file.
33
"""
4-
# pylint: disable=invalid-name
5-
64
import datetime
75
from importlib.metadata import metadata
86

97
# ruff: isort: off
10-
from sphinx_gallery.sorting import ( # pylint: disable=no-name-in-module
11-
ExplicitOrder,
12-
ExampleTitleSortKey,
13-
)
8+
from sphinx_gallery.sorting import ExplicitOrder, ExampleTitleSortKey
149
import pygmt
1510
from pygmt import __commit__, __version__
1611
from pygmt.sphinx_gallery import PyGMTScraper
@@ -139,7 +134,7 @@
139134
# General information about the project
140135
year = datetime.date.today().year
141136
project = "PyGMT"
142-
copyright = f"2017-{year}, The PyGMT Developers" # pylint: disable=redefined-builtin
137+
copyright = f"2017-{year}, The PyGMT Developers"
143138
if len(__version__.split("+")) > 1 or __version__ == "unknown":
144139
version = "dev"
145140
# Set base_url for stable version

doc/contributing.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ the `pygmt/src/` and `pygmt/datasets/` folders. **All docstrings** should follow
404404
All functions/classes/methods should have docstrings with a full description of all
405405
arguments and return values.
406406

407-
While the maximum line length for code is automatically set by Black, docstrings
407+
While the maximum line length for code is automatically set by ruff, docstrings
408408
must be formatted manually. To play nicely with Jupyter and IPython, **keep docstrings
409409
limited to 79 characters** per line.
410410

@@ -473,12 +473,11 @@ code, be sure to follow the general guidelines in the
473473

474474
We use some tools to format the code so we don't have to think about it:
475475

476-
- [Black](https://github.com/psf/black)
477476
- [blackdoc](https://github.com/keewis/blackdoc)
478477
- [docformatter](https://github.com/myint/docformatter)
479478
- [ruff](https://docs.astral.sh/ruff)
480479

481-
Black and blackdoc loosely follows the [PEP8](http://pep8.org) guide but with a few
480+
These tools loosely follow the [PEP8](http://pep8.org) guide but with a few
482481
differences. Regardless, you won't have to worry about formatting the code yourself.
483482
Before committing, run it to automatically format your code:
484483

@@ -506,15 +505,14 @@ editors or IDEs. We consistently use `# %%` as code block separators (please
506505
refer to [issue #2660](https://github.com/GenericMappingTools/pygmt/issues/2660)
507506
for the discussions) and require at least one separator in all example files.
508507

509-
We also use [ruff](https://docs.astral.sh/ruff) and
510-
[pylint](https://pylint.pycqa.org/) to check the quality of the code and quickly catch
511-
common errors.
508+
We also use [ruff](https://docs.astral.sh/ruff) to check the quality of the code
509+
and quickly catch common errors.
510+
512511
The [`Makefile`](https://github.com/GenericMappingTools/pygmt/blob/main/Makefile)
513-
contains rules for running both checks:
512+
contains rules for running the linter checks:
514513

515514
```bash
516-
make check # Runs black, blackdoc, docformatter, ruff (in check mode)
517-
make lint # Runs pylint, which is a bit slower
515+
make check # Runs blackdoc, docformatter, ruff (in check mode)
518516
```
519517

520518
### Testing your Code

environment.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ channels:
33
- conda-forge
44
- nodefaults
55
dependencies:
6+
- python=3.12
67
# Required dependencies
78
- gmt=6.4.0
89
- numpy>=1.22
@@ -22,11 +23,9 @@ dependencies:
2223
- make
2324
- pip
2425
# Dev dependencies (style checks)
25-
- black
2626
- blackdoc
2727
- codespell
2828
- docformatter>=1.7.2
29-
- pylint
3029
- ruff
3130
# Dev dependencies (unit testing)
3231
- matplotlib

examples/gallery/images/rgb_image.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
# Subset to area of Lāhainā in EPSG:32604 coordinates
2929
image = img.rio.clip_box(minx=738000, maxx=755000, miny=2300000, maxy=2318000)
3030
image = image.load() # Force loading the DataArray into memory
31-
image
31+
image # noqa: B018
3232

3333
# %%
3434
# Plot the RGB imagery:

pygmt/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ def print_clib_info(file=sys.stdout):
8383
Includes the GMT version, default values for parameters, the path to the
8484
``libgmt`` shared library, and GMT directories.
8585
"""
86-
from pygmt.clib import Session # pylint: disable=import-outside-toplevel
86+
from pygmt.clib import Session
8787

8888
lines = ["GMT library information:"]
8989
with Session() as ses:
@@ -104,7 +104,7 @@ def show_versions(file=sys.stdout):
104104
- Core dependency versions (NumPy, Pandas, Xarray, etc)
105105
- GMT library information
106106
"""
107-
# pylint: disable=import-outside-toplevel
107+
108108
import importlib
109109
import platform
110110
import subprocess

pygmt/clib/conversion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ def dataarray_to_matrix(grid):
103103
"but GMT only supports regular spacing. Calculated regular spacing "
104104
f"{coord_inc} is assumed in the '{dim}' dimension."
105105
)
106-
warnings.warn(msg, category=RuntimeWarning)
106+
warnings.warn(msg, category=RuntimeWarning, stacklevel=2)
107107
if coord_inc == 0:
108108
raise GMTInvalidInput(
109109
f"Grid has a zero increment in the '{dim}' dimension."

pygmt/clib/loading.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,6 @@ def check_libgmt(libgmt):
163163
functions = ["Create_Session", "Get_Enum", "Call_Module", "Destroy_Session"]
164164
for func in functions:
165165
if not hasattr(libgmt, "GMT_" + func):
166-
# pylint: disable=protected-access
167166
msg = (
168167
f"Error loading '{libgmt._name}'. Couldn't access function GMT_{func}. "
169168
"Ensure that you have installed an up-to-date GMT version 6 library. "

0 commit comments

Comments
 (0)