From eddf96c4b77760ce1aefe6f3693e91e7fafad403 Mon Sep 17 00:00:00 2001 From: Martin Fleischmann Date: Sun, 17 Sep 2023 11:11:43 +0200 Subject: [PATCH 1/3] DOC: fix formatting --- xvec/accessor.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xvec/accessor.py b/xvec/accessor.py index d2fcd21..fae4185 100644 --- a/xvec/accessor.py +++ b/xvec/accessor.py @@ -957,7 +957,7 @@ def extract_points( crs : Any, optional Cordinate reference system of shapely geometries. If ``points`` have a ``.crs`` attribute (e.g. ``geopandas.GeoSeries`` or a ``DataArray`` with - ``"crs"`` in ``.attrs`), ``crs`` will be automatically inferred. For more + ``"crs"`` in ``.attrs``), ``crs`` will be automatically inferred. For more generic objects (numpy array, list), CRS shall be specified manually. index : bool, optional If `points` is a GeoSeries, ``index=True`` will attach its index as another From 06c69a62ef634520ffc70b17283f89efdc7b94a7 Mon Sep 17 00:00:00 2001 From: Martin Fleischmann Date: Fri, 27 Oct 2023 11:31:33 +0200 Subject: [PATCH 2/3] MAINT: add PYthon 3.12, use ruff formatter --- .github/workflows/release.yaml | 6 +++--- .github/workflows/tests.yaml | 9 +++++---- .pre-commit-config.yaml | 10 +++------- ci/310.yaml | 2 +- ci/{latest.yaml => 311.yaml} | 4 ++-- ci/312.yaml | 15 +++++++++++++++ ci/39.yaml | 2 +- xvec/index.py | 3 ++- xvec/tests/test_index.py | 4 ++-- 9 files changed, 34 insertions(+), 21 deletions(-) rename ci/{latest.yaml => 311.yaml} (84%) create mode 100644 ci/312.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 1576f2e..1dfbf98 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -11,10 +11,10 @@ jobs: runs-on: ubuntu-18.04 steps: - - uses: actions/checkout@master + - uses: actions/checkout@v4 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: "3.x" @@ -24,7 +24,7 @@ jobs: python -m build - name: Publish distribution to PyPI - uses: pypa/gh-action-pypi-publish@master + uses: pypa/gh-action-pypi-publish@v1 with: user: __token__ password: ${{ secrets.pypi_password }} diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index 7a3fe29..61eb68c 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -17,12 +17,14 @@ jobs: strategy: matrix: os: [macos-latest, ubuntu-latest, windows-latest] - environment-file: [ci/latest.yaml] + environment-file: [ci/312.yaml] include: - environment-file: ci/39.yaml os: ubuntu-latest - environment-file: ci/310.yaml os: ubuntu-latest + - environment-file: ci/311.yaml + os: ubuntu-latest - environment-file: ci/dev.yaml os: ubuntu-latest defaults: @@ -31,14 +33,13 @@ jobs: steps: - name: checkout repo - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: setup micromamba - uses: mamba-org/provision-with-micromamba@main + uses: mamba-org/setup-micromamba@v1 with: environment-file: ${{ matrix.environment-file }} micromamba-version: "latest" - channel-priority: "flexible" - name: Install xvec run: pip install . diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ff9d8a6..98387c5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,14 +1,10 @@ files: 'xvec\/' repos: - - repo: https://github.com/psf/black - rev: 23.1.0 - hooks: - - id: black - language_version: python3 - - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: "v0.0.255" + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.1.2 hooks: - id: ruff + - id: ruff-format ci: autofix_prs: false diff --git a/ci/310.yaml b/ci/310.yaml index 700b7b3..094238d 100644 --- a/ci/310.yaml +++ b/ci/310.yaml @@ -4,7 +4,7 @@ channels: dependencies: - python=3.10 # required - - shapely=2 + - shapely >=2 - xarray - pyproj # testing diff --git a/ci/latest.yaml b/ci/311.yaml similarity index 84% rename from ci/latest.yaml rename to ci/311.yaml index 035e532..172d8f4 100644 --- a/ci/latest.yaml +++ b/ci/311.yaml @@ -2,9 +2,9 @@ name: xvec channels: - conda-forge dependencies: - - python + - python=3.11 # required - - shapely=2 + - shapely >=2 - xarray - pyproj # testing diff --git a/ci/312.yaml b/ci/312.yaml new file mode 100644 index 0000000..39d848a --- /dev/null +++ b/ci/312.yaml @@ -0,0 +1,15 @@ +name: xvec +channels: + - conda-forge +dependencies: + - python=3.12 + # required + - shapely >=2 + - xarray + - pyproj + # testing + - pytest + - pytest-cov + - pytest-xdist + - pytest-reportlog + - geopandas-base diff --git a/ci/39.yaml b/ci/39.yaml index 74d0b20..d65bf20 100644 --- a/ci/39.yaml +++ b/ci/39.yaml @@ -4,7 +4,7 @@ channels: dependencies: - python=3.9 # required - - shapely=2 + - shapely >=2 - xarray - pyproj # testing diff --git a/xvec/index.py b/xvec/index.py index 5bb5b87..92e5f20 100644 --- a/xvec/index.py +++ b/xvec/index.py @@ -35,7 +35,8 @@ def _get_common_crs(crs_set: set[CRS | None]): warnings.warn( "CRS not set for some of the concatenation inputs. " f"Setting output's CRS as {names[0]} " - "(the single non-null CRS provided)." + "(the single non-null CRS provided).", + stacklevel=3, ) return crs_not_none[0] diff --git a/xvec/tests/test_index.py b/xvec/tests/test_index.py index 95d5eb2..f61dad2 100644 --- a/xvec/tests/test_index.py +++ b/xvec/tests/test_index.py @@ -129,7 +129,7 @@ def test_align( ): # test both GeometryIndex's `join` and `reindex_like` aligned = xr.align(geom_dataset, first_geom_dataset, join="inner") - assert all([ds.identical(first_geom_dataset) for ds in aligned]) + assert all(ds.identical(first_geom_dataset) for ds in aligned) # test conflicting CRS crs = CRS.from_user_input(4267) @@ -144,7 +144,7 @@ def test_align( # no CRS first_geom_dataset_no_crs = geom_dataset_no_crs.isel(geom=[0]) aligned = xr.align(geom_dataset_no_crs, first_geom_dataset_no_crs, join="inner") - assert all([ds.identical(first_geom_dataset_no_crs) for ds in aligned]) + assert all(ds.identical(first_geom_dataset_no_crs) for ds in aligned) def test_roll(geom_dataset, geom_array): From 03fac20ab1e0b54a7ecddd4564260c8489ff7f52 Mon Sep 17 00:00:00 2001 From: Martin Fleischmann Date: Fri, 27 Oct 2023 11:38:22 +0200 Subject: [PATCH 3/3] ignore conflicting rules --- pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/pyproject.toml b/pyproject.toml index 858a062..b32baae 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -56,3 +56,4 @@ line-length = 88 select = ["E", "F", "W", "I", "UP", "B", "A", "C4", "Q"] exclude = ["doc"] target-version = "py39" +ignore = ['E501', 'Q000', 'Q001', 'Q002', 'Q003', 'W191']