diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index db9fd1a6..8777dc93 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -66,9 +66,9 @@ jobs: platforms: all - name: Build wheels - uses: pypa/cibuildwheel@v2.19.2 + uses: pypa/cibuildwheel@v2.20.0 env: - CIBW_SKIP: "cp36-* cp37-* cp38-* pp* *i686 *-musllinux*" + CIBW_SKIP: "cp36-* cp37-* cp38-* cp313-* pp* *i686 *-musllinux*" CIBW_ARCHS: "${{ matrix.cibw_archs }}" CIBW_TEST_COMMAND: "python -c \"import pyresample; assert 'unknown' not in pyresample.__version__, 'incorrect version found'\"" CIBW_TEST_SKIP: "*_arm64 *_universal2:arm64" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 89f920f0..f7ce0c87 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,14 +2,9 @@ exclude: '^$' fail_fast: false repos: - repo: https://github.com/astral-sh/ruff-pre-commit - rev: 'v0.5.6' + rev: 'v0.6.2' hooks: - id: ruff -# once https://github.com/astral-sh/ruff/issues/2402 is fully resolved then we can get rid of flake8: -- repo: https://github.com/pycqa/flake8 - rev: 7.1.1 - hooks: - - id: flake8 - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.6.0 hooks: diff --git a/pyproject.toml b/pyproject.toml index d4269128..242b2a8b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,5 @@ [build-system] -requires = ["setuptools", "wheel", "numpy>=2.0.0rc1,<2.3", "Cython>=3", "versioneer"] +requires = ["setuptools", "wheel", "numpy>=2.0.0rc1,<2.3", "Cython>=3", "versioneer[toml]"] build-backend = "setuptools.build_meta" [tool.ruff] @@ -36,3 +36,22 @@ warn_redundant_casts = true warn_unused_ignores = true warn_unreachable = true warn_unused_configs = true + +[tool.versioneer] +VCS = "git" +style = "pep440" +versionfile_source = "pyresample/version.py" +versionfile_build = "pyresample/version.py" +tag_prefix = "v" + +[tool.isort] +sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "LOCALFOLDER"] +profile = "black" +skip_gitignore = true +default_section = "THIRDPARTY" +known_first_party = "pyresample" +line_length = 120 + +[tool.coverage.run] +relative_files = true +omit = ["pyresample/version.py", "versioneer.py"] diff --git a/pyresample/bilinear/__init__.py b/pyresample/bilinear/__init__.py index 28901973..b64a0cd8 100644 --- a/pyresample/bilinear/__init__.py +++ b/pyresample/bilinear/__init__.py @@ -41,11 +41,7 @@ ) try: - from .xarr import ( # noqa: F401 - CACHE_INDICES, - XArrayBilinearResampler, - XArrayResamplerBilinear, - ) + from .xarr import CACHE_INDICES, XArrayBilinearResampler, XArrayResamplerBilinear # noqa: F401 except ImportError: warnings.warn("XArray, dask, and/or zarr not found, XArrayBilinearResampler won't be available.", stacklevel=2) XArrayBilinearResampler = None # type: ignore diff --git a/pyresample/boundary/__init__.py b/pyresample/boundary/__init__.py index 258952af..69b228b2 100644 --- a/pyresample/boundary/__init__.py +++ b/pyresample/boundary/__init__.py @@ -17,9 +17,4 @@ # along with this program. If not, see . """The Boundary classes.""" -from pyresample.boundary.legacy_boundary import ( # noqa - AreaBoundary, - AreaDefBoundary, - Boundary, - SimpleBoundary, -) +from pyresample.boundary.legacy_boundary import AreaBoundary, AreaDefBoundary, Boundary, SimpleBoundary # noqa diff --git a/pyresample/ewa/dask_ewa.py b/pyresample/ewa/dask_ewa.py index 6bc57ec7..e41291d0 100644 --- a/pyresample/ewa/dask_ewa.py +++ b/pyresample/ewa/dask_ewa.py @@ -39,10 +39,7 @@ from dask.highlevelgraph import HighLevelGraph from pyresample.ewa import ll2cr -from pyresample.ewa._fornav import ( - fornav_weights_and_sums_wrapper, - write_grid_image_single, -) +from pyresample.ewa._fornav import fornav_weights_and_sums_wrapper, write_grid_image_single from pyresample.geometry import SwathDefinition from pyresample.resampler import BaseResampler diff --git a/pyresample/future/__init__.py b/pyresample/future/__init__.py index a2e45daf..47834f1f 100644 --- a/pyresample/future/__init__.py +++ b/pyresample/future/__init__.py @@ -18,9 +18,4 @@ """Future features that are backwards incompatible with current functionality.""" from .resamplers import Resampler # noqa -from .resamplers import ( # noqa - create_resampler, - list_resamplers, - register_resampler, - unregister_resampler, -) +from .resamplers import create_resampler, list_resamplers, register_resampler, unregister_resampler # noqa diff --git a/pyresample/future/resamplers/__init__.py b/pyresample/future/resamplers/__init__.py index 35c8f1a5..e41d7362 100644 --- a/pyresample/future/resamplers/__init__.py +++ b/pyresample/future/resamplers/__init__.py @@ -20,10 +20,5 @@ from __future__ import annotations from .nearest import KDTreeNearestXarrayResampler # noqa -from .registry import ( # noqa - create_resampler, - list_resamplers, - register_resampler, - unregister_resampler, -) +from .registry import create_resampler, list_resamplers, register_resampler, unregister_resampler # noqa from .resampler import Resampler # noqa diff --git a/pyresample/gradient/__init__.py b/pyresample/gradient/__init__.py index d53231cc..4e2aa3b8 100644 --- a/pyresample/gradient/__init__.py +++ b/pyresample/gradient/__init__.py @@ -36,15 +36,8 @@ from shapely.geometry import Polygon from pyresample import CHUNK_SIZE -from pyresample.geometry import ( - AreaDefinition, - SwathDefinition, - get_geostationary_bounding_box_in_lonlats, -) -from pyresample.gradient._gradient_search import ( - one_step_gradient_indices, - one_step_gradient_search, -) +from pyresample.geometry import AreaDefinition, SwathDefinition, get_geostationary_bounding_box_in_lonlats +from pyresample.gradient._gradient_search import one_step_gradient_indices, one_step_gradient_search from pyresample.resampler import BaseResampler, resample_blocks logger = logging.getLogger(__name__) diff --git a/pyresample/resampler.py b/pyresample/resampler.py index 2a12c48c..6a5ff3e8 100644 --- a/pyresample/resampler.py +++ b/pyresample/resampler.py @@ -40,12 +40,7 @@ except ImportError: xr = None -from pyresample.geometry import ( - AreaDefinition, - CoordinateDefinition, - IncompatibleAreas, - SwathDefinition, -) +from pyresample.geometry import AreaDefinition, CoordinateDefinition, IncompatibleAreas, SwathDefinition from .future.resamplers.resampler import hash_dict diff --git a/pyresample/slicer.py b/pyresample/slicer.py index 5306818d..579fd58a 100644 --- a/pyresample/slicer.py +++ b/pyresample/slicer.py @@ -27,11 +27,7 @@ from pyproj.enums import TransformDirection from pyresample import AreaDefinition, SwathDefinition -from pyresample.geometry import ( - IncompatibleAreas, - InvalidArea, - get_geostationary_bounding_box_in_proj_coords, -) +from pyresample.geometry import IncompatibleAreas, InvalidArea, get_geostationary_bounding_box_in_proj_coords try: import dask.array as da diff --git a/pyresample/test/conftest.py b/pyresample/test/conftest.py index 04df36fc..0bce5f63 100644 --- a/pyresample/test/conftest.py +++ b/pyresample/test/conftest.py @@ -25,11 +25,7 @@ import pyresample from pyresample import LegacyAreaDefinition, LegacySwathDefinition -from pyresample.future.geometry import ( - AreaDefinition, - CoordinateDefinition, - SwathDefinition, -) +from pyresample.future.geometry import AreaDefinition, CoordinateDefinition, SwathDefinition from pyresample.test.utils import create_test_latitude, create_test_longitude SRC_SWATH_2D_SHAPE = (50, 10) diff --git a/pyresample/test/test_bilinear.py b/pyresample/test/test_bilinear.py index 7c008c46..fa6c979d 100644 --- a/pyresample/test/test_bilinear.py +++ b/pyresample/test/test_bilinear.py @@ -156,9 +156,7 @@ def test_get_fractional_distances_irregular(self): def test_get_fractional_distances_uprights_parallel(self): """Test calculation when uprights are parallel.""" - from pyresample.bilinear._base import ( - _get_fractional_distances_uprights_parallel, - ) + from pyresample.bilinear._base import _get_fractional_distances_uprights_parallel res = _get_fractional_distances_uprights_parallel(self.pts_vert_parallel, 0., 0.) self.assertEqual(res[0], 0.5) @@ -237,11 +235,7 @@ def test_get_input_xy(self): def test_get_four_closest_corners(self): """Test calculation of bounding corners.""" - from pyresample.bilinear._base import ( - _get_four_closest_corners, - _get_input_xy, - _get_output_xy, - ) + from pyresample.bilinear._base import _get_four_closest_corners, _get_input_xy, _get_output_xy proj = Proj(self.target_def.proj_str) out_x, out_y = _get_output_xy(self.target_def) @@ -1040,9 +1034,7 @@ def test_get_fractional_distances_irregular(self): def test_get_fractional_distances_uprights_parallel(self): """Test calculation when uprights are parallel.""" - from pyresample.bilinear._base import ( - _get_fractional_distances_uprights_parallel, - ) + from pyresample.bilinear._base import _get_fractional_distances_uprights_parallel res = _get_fractional_distances_uprights_parallel(self.pts_vert_parallel, 0., 0.) self.assertEqual(res[0], 0.5) diff --git a/pyresample/test/test_formatting.py b/pyresample/test/test_formatting.py index de7cb587..b2193bde 100644 --- a/pyresample/test/test_formatting.py +++ b/pyresample/test/test_formatting.py @@ -22,11 +22,7 @@ import pytest import pyresample -from pyresample._formatting_html import ( - area_repr, - plot_area_def, - swath_area_attrs_section, -) +from pyresample._formatting_html import area_repr, plot_area_def, swath_area_attrs_section from .test_geometry.test_swath import _gen_swath_def_numpy, _gen_swath_def_xarray_dask diff --git a/pyresample/test/test_geometry_legacy.py b/pyresample/test/test_geometry_legacy.py index 34e42455..440bd12a 100644 --- a/pyresample/test/test_geometry_legacy.py +++ b/pyresample/test/test_geometry_legacy.py @@ -31,11 +31,7 @@ import xarray as xr from pyresample import geometry -from pyresample.geometry import ( - IncompatibleAreas, - combine_area_extents_vertical, - concatenate_area_defs, -) +from pyresample.geometry import IncompatibleAreas, combine_area_extents_vertical, concatenate_area_defs from pyresample.test.utils import catch_warnings diff --git a/pyresample/test/test_plot.py b/pyresample/test/test_plot.py index 47fb7a37..e186754a 100644 --- a/pyresample/test/test_plot.py +++ b/pyresample/test/test_plot.py @@ -120,10 +120,7 @@ def test_add_gridlines(self, axes, fx_locator): def test_translate_coast_res(self): """Test the translation of coast resolution arguments from old basemap notation to cartopy.""" - from pyresample.plot import ( - BASEMAP_NOT_CARTOPY, - _translate_coast_resolution_to_cartopy, - ) + from pyresample.plot import BASEMAP_NOT_CARTOPY, _translate_coast_resolution_to_cartopy with self.assertRaises(KeyError) as raises: if sys.version_info > (3,): diff --git a/pyresample/test/test_resample_blocks.py b/pyresample/test/test_resample_blocks.py index 6d56e14c..5d472f8f 100644 --- a/pyresample/test/test_resample_blocks.py +++ b/pyresample/test/test_resample_blocks.py @@ -211,10 +211,7 @@ def fun(data, block_info=None, **kwargs): def test_resample_blocks_can_generate_gradient_indices(self): """Test resample blocks can generate gradient indices.""" - from pyresample.gradient import ( - gradient_resampler_indices, - gradient_resampler_indices_block, - ) + from pyresample.gradient import gradient_resampler_indices, gradient_resampler_indices_block from pyresample.resampler import resample_blocks chunks = 40 diff --git a/pyresample/test/test_resamplers/test_nearest.py b/pyresample/test/test_resamplers/test_nearest.py index 543459f0..a4a16db5 100644 --- a/pyresample/test/test_resamplers/test_nearest.py +++ b/pyresample/test/test_resamplers/test_nearest.py @@ -28,11 +28,7 @@ from pyresample.future.geometry import AreaDefinition, SwathDefinition from pyresample.future.resamplers import KDTreeNearestXarrayResampler -from pyresample.test.utils import ( - assert_maximum_dask_computes, - assert_warnings_contain, - catch_warnings, -) +from pyresample.test.utils import assert_maximum_dask_computes, assert_warnings_contain, catch_warnings from pyresample.utils.errors import PerformanceWarning diff --git a/pyresample/test/test_resamplers/test_resampler_registry.py b/pyresample/test/test_resamplers/test_resampler_registry.py index 0738a33d..c6bb0f18 100644 --- a/pyresample/test/test_resamplers/test_resampler_registry.py +++ b/pyresample/test/test_resamplers/test_resampler_registry.py @@ -25,12 +25,7 @@ import pytest -from pyresample.future import ( - Resampler, - list_resamplers, - register_resampler, - unregister_resampler, -) +from pyresample.future import Resampler, list_resamplers, register_resampler, unregister_resampler from pyresample.test.utils import assert_warnings_contain diff --git a/pyresample/test/test_utils.py b/pyresample/test/test_utils.py index 7f7197be..712346f7 100644 --- a/pyresample/test/test_utils.py +++ b/pyresample/test/test_utils.py @@ -29,12 +29,7 @@ from pyproj import CRS import pyresample -from pyresample.test.utils import ( - TEST_FILES_PATH, - assert_future_geometry, - create_test_latitude, - create_test_longitude, -) +from pyresample.test.utils import TEST_FILES_PATH, assert_future_geometry, create_test_latitude, create_test_longitude from pyresample.utils import load_cf_area from pyresample.utils.row_appendable_array import RowAppendableArray @@ -620,10 +615,7 @@ def test_cf_guess_axis_varname(self): self.nc_handles['nh10km'], 'doesNotExist', 'x', 'polar_stereographic') def test_cf_is_valid_coordinate_standardname(self): - from pyresample.utils.cf import ( - _is_valid_coordinate_standardname, - _valid_cf_type_of_grid_mapping, - ) + from pyresample.utils.cf import _is_valid_coordinate_standardname, _valid_cf_type_of_grid_mapping # nominal for proj_type in _valid_cf_type_of_grid_mapping: diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 3f58ba27..00000000 --- a/setup.cfg +++ /dev/null @@ -1,32 +0,0 @@ -[bdist_rpm] -requires=python3-numpy pykdtree python3-numexpr python3-pyproj python3-configobj python3-shapely -release=1 -doc_files = docs/Makefile docs/source/*.rst - -[flake8] -max-line-length = 120 -exclude = versioneer.py,version.py -ignore = D107,W504 -per-file-ignores = - pyresample/test/*.py:D102 - -[versioneer] -VCS = git -style = pep440 -versionfile_source = pyresample/version.py -versionfile_build = pyresample/version.py -tag_prefix = v - -[coverage:run] -relative_files = True -omit = - pyresample/version.py - versioneer.py - -[isort] -sections = FUTURE,STDLIB,THIRDPARTY,FIRSTPARTY,LOCALFOLDER -profile = black -skip_gitignore = true -force_to_top = true -default_section = THIRDPARTY -known_first_party = pyresample