Skip to content

Commit c9f4ddf

Browse files
authored
MNT: replace black and isort with ruff format and lint (#1496)
1 parent 1382fec commit c9f4ddf

File tree

13 files changed

+30
-51
lines changed

13 files changed

+30
-51
lines changed

.isort.cfg

Lines changed: 0 additions & 3 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,6 @@ repos:
88
- id: check-yaml
99
- id: end-of-file-fixer
1010
- id: trailing-whitespace
11-
- repo: https://github.com/psf/black-pre-commit-mirror
12-
rev: 24.2.0
13-
hooks:
14-
- id: black
15-
- repo: https://github.com/pycqa/isort
16-
rev: 5.13.2
17-
hooks:
18-
- id: isort
19-
args: [setup.py, pyproj/, test/, docs/]
2011
- repo: https://github.com/asottile/blacken-docs
2112
rev: 1.16.0
2213
hooks:
@@ -38,6 +29,7 @@ repos:
3829
hooks:
3930
- id: codespell
4031
- repo: https://github.com/astral-sh/ruff-pre-commit
41-
rev: v0.7.1
32+
rev: v0.11.10
4233
hooks:
43-
- id: ruff
34+
- id: ruff-check
35+
- id: ruff-format

.stickler.yml

Lines changed: 0 additions & 6 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,10 @@ There are plenty of more advanced testing concepts, like dealing with floating p
167167
comparisons, parameterizing tests, testing that exceptions are raised, and more. Have a look at the existing tests to get an idea of some of the common patterns.
168168
169169
## Code Style
170-
pyproj uses the Python code style outlined in [PEP8](https://pep8.org) and [black](https://github.com/python/black).
170+
pyproj uses the Python code style outlined in [PEP8](https://pep8.org) and by [the Ruff formatter](https://docs.astral.sh/ruff/formatter/).
171171
172172
We enforce this style as code is added to keep everything clean and uniform. To this end, part of the automated testing for pyproj checks style. To check style
173-
locally within the source directory you can use the ``flake8`` and ``black`` tools. Running it from the root of the source directory is as easy as running ``pre-commit run --all`` in the base of the repository.
173+
locally within the source directory you can use the ``flake8`` and ``ruff format`` tools. Running it from the root of the source directory is as easy as running ``pre-commit run --all`` in the base of the repository.
174174
175175
You can also just submit your PR and the kind robots will comment on all style violations as well. It can be a pain to make sure you have the right number of spaces around things, imports in order, and all of the other nits that the bots will find. It is very important though as this consistent style helps us keep pyproj readable, maintainable, and uniform.
176176
@@ -192,7 +192,7 @@ Some things that will increase the chance that your pull request is accepted qui
192192

193193
* Write tests.
194194
* Follow [PEP8](https://pep8.org) for style. (The `flake8` utility can help with this.)
195-
* Use [black](https://github.com/python/black)
195+
* Use [ruff format](https://docs.astral.sh/ruff/formatter/)
196196
* Write a [good commit message](https://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html) and consider using commit [conventions](https://www.conventionalcommits.org/).
197197

198198
Pull requests will automatically have tests run by Travis. This includes

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ Python interface to [PROJ](http://proj.org) (cartographic projections and coordi
1111
<a href="https://badge.fury.io/py/pyproj"><img alt="PyPI" src="https://badge.fury.io/py/pyproj.svg"></a>
1212
<a href="https://pepy.tech/project/pyproj"><img alt="Downloads" src="https://pepy.tech/badge/pyproj"></a>
1313
<a href="https://anaconda.org/conda-forge/pyproj"><img alt="Anaconda-Server Badge" src="https://anaconda.org/conda-forge/pyproj/badges/version.svg"></a>
14-
<a href="https://github.com/python/black"><img alt="Code style: black" src="https://img.shields.io/badge/code%20style-black-000000.svg"></a>
1514
<a href="https://github.com/pre-commit/pre-commit"><img alt="pre-commit" src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&logoColor=white"></a>
1615
<a href="https://zenodo.org/badge/latestdoi/28607354"><img alt="DOI" src="https://zenodo.org/badge/28607354.svg"></a>
1716
</p>

pyproj/__init__.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -73,19 +73,19 @@
7373

7474
__version__ = "3.7.2.dev0"
7575
__all__ = [
76-
"Proj",
77-
"Geod",
7876
"CRS",
77+
"Geod",
78+
"Proj",
7979
"Transformer",
80-
"transform",
81-
"itransform",
82-
"pj_ellps",
83-
"pj_list",
8480
"get_ellps_map",
8581
"get_prime_meridians_map",
8682
"get_proj_operations_map",
8783
"get_units_map",
84+
"itransform",
85+
"pj_ellps",
86+
"pj_list",
8887
"show_versions",
88+
"transform",
8989
]
9090
__proj_version__ = PROJ_VERSION_STR
9191
proj_version_str = PROJ_VERSION_STR # pylint: disable=invalid-name

pyproj/crs/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
from pyproj.exceptions import CRSError # noqa: F401 pylint: disable=unused-import
2828

2929
__all__ = [
30-
"is_proj",
31-
"is_wkt",
3230
"CRS",
3331
"BoundCRS",
3432
"CompoundCRS",
@@ -38,4 +36,6 @@
3836
"GeographicCRS",
3937
"ProjectedCRS",
4038
"VerticalCRS",
39+
"is_proj",
40+
"is_wkt",
4141
]

pyproj/geod.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010

1111
__all__ = [
1212
"Geod",
13-
"pj_ellps",
14-
"geodesic_version_str",
1513
"GeodIntermediateFlag",
1614
"GeodIntermediateReturn",
15+
"geodesic_version_str",
16+
"pj_ellps",
1717
"reverse_azimuth",
1818
]
1919

pyproj/transformer.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@
33
"""
44

55
__all__ = [
6-
"transform",
7-
"itransform",
6+
"AreaOfInterest",
87
"Transformer",
98
"TransformerGroup",
10-
"AreaOfInterest",
9+
"itransform",
10+
"transform",
1111
]
1212
import threading
1313
import warnings
@@ -329,8 +329,7 @@ def __init__(
329329
if not isinstance(transformer_maker, TransformerMaker):
330330
_clear_proj_error()
331331
raise ProjError(
332-
"Transformer must be initialized using: "
333-
"'from_crs' or 'from_pipeline'."
332+
"Transformer must be initialized using: 'from_crs' or 'from_pipeline'."
334333
)
335334

336335
self._local = TransformerLocal()

pyproject.toml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,8 @@ include = ["pyproj", "pyproj.*"]
6262
[tool.setuptools.dynamic]
6363
version = {attr = "pyproj.__version__"}
6464

65-
[tool.black]
66-
target_version = ["py310"]
67-
6865
[tool.ruff]
6966
line-length = 88
70-
target-version = "py310"
7167
fix = true
7268

7369
[tool.ruff.lint]
@@ -78,6 +74,8 @@ select = [
7874
"F",
7975
# pycodestyle
8076
"E", "W",
77+
# isort
78+
"I",
8179
# flake8-2020
8280
"YTT",
8381
# flake8-bugbear
@@ -101,7 +99,7 @@ select = [
10199
# implicit string concatenation
102100
"ISC",
103101
# type-checking imports
104-
"TCH",
102+
"TC",
105103
# comprehensions
106104
"C4",
107105
# pygrep-hooks
@@ -147,7 +145,7 @@ ignore = [
147145
# Rename unused
148146
"B007",
149147
# Move standard library import into a type-checking block
150-
"TCH003",
148+
"TC003",
151149
# Consider f-string instead of string join
152150
"FLY002",
153151
# Use a list comprehension to create a transformed list

0 commit comments

Comments
 (0)