Skip to content

Commit

Permalink
MAINT: test on Python 3.12, update actions, use ruff format (#54)
Browse files Browse the repository at this point in the history
* DOC: fix formatting

* MAINT: add PYthon 3.12, use ruff formatter

* ignore conflicting rules
  • Loading branch information
martinfleis authored Oct 27, 2023
1 parent 0a3d081 commit 718c414
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 19 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand All @@ -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 }}
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 .
Expand Down
8 changes: 2 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
files: 'xvec\/'
repos:
- repo: https://github.com/psf/black
rev: 23.9.1
hooks:
- id: black
language_version: python3
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.0.292"
rev: v0.1.2
hooks:
- id: ruff
- id: ruff-format

ci:
autofix_prs: false
Expand Down
2 changes: 1 addition & 1 deletion ci/310.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ channels:
dependencies:
- python=3.10
# required
- shapely=2
- shapely >=2
- xarray
- pyproj
# testing
Expand Down
4 changes: 2 additions & 2 deletions ci/latest.yaml → ci/311.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: xvec
channels:
- conda-forge
dependencies:
- python
- python=3.11
# required
- shapely=2
- shapely >=2
- xarray
- pyproj
# testing
Expand Down
15 changes: 15 additions & 0 deletions ci/312.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion ci/39.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ channels:
dependencies:
- python=3.9
# required
- shapely=2
- shapely >=2
- xarray
- pyproj
# testing
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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']
2 changes: 1 addition & 1 deletion xvec/accessor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion xvec/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def _get_common_crs(crs_set: set[CRS | None]):
warnings.warn( # noqa: B028
"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]

Expand Down

0 comments on commit 718c414

Please sign in to comment.