Skip to content

Commit 9c6cf48

Browse files
authored
Add pre commit config (#68)
* basic pre-commit fixes * codespell * pyproject-fmt * ruff fixes * add pre-commit config * add ruff format * add zizmor * zizmor fixes and let linting happen in pre-commit-ci * docstring check * run pre-commits * refresh lockfile * enable blackdoc
1 parent 7e60c7c commit 9c6cf48

23 files changed

+329
-299
lines changed

.gitattributes

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
# GitHub syntax highlighting
22
pixi.lock linguist-language=YAML
3-

.github/workflows/test.yaml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,13 @@ jobs:
1010
matrix:
1111
os: ["ubuntu-latest", "windows-latest", "macos-latest"]
1212
environment: [test310, test311, test312, test313]
13-
13+
permissions:
14+
actions: none
15+
1416
steps:
1517
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
18+
with:
19+
persist-credentials: false
1620
- name: Setup pixi
1721
uses: prefix-dev/setup-pixi@19eac09b398e3d0c747adc7921926a6d802df4da # v0.8.8
1822
with:
@@ -21,11 +25,3 @@ jobs:
2125
- name: Tests
2226
run: >
2327
pixi run --environment ${{ matrix.environment }} test
24-
25-
- name: Lint
26-
if: contains(${{ matrix.os }}, "ubuntu") && ${{ matrix.environment }} == "test310"
27-
run: >
28-
pixi run --environment test310 lint
29-
30-
31-

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,4 +165,4 @@ xarray_subset_grid/_version.py
165165
.pixi
166166
*.egg-info
167167

168-
.ruff_cache/
168+
.ruff_cache/

.pre-commit-config.yaml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v5.0.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: check-ast
7+
- id: debug-statements
8+
- id: end-of-file-fixer
9+
- id: check-docstring-first
10+
- id: check-added-large-files
11+
exclude_types: [yaml]
12+
13+
- repo: https://github.com/keewis/blackdoc
14+
rev: v0.3.10
15+
hooks:
16+
- id: blackdoc
17+
18+
- repo: https://github.com/codespell-project/codespell
19+
rev: v2.4.1
20+
hooks:
21+
- id: codespell
22+
exclude: >
23+
(?x)^(
24+
.*\.ipynb
25+
)$
26+
args:
27+
- --ignore-words-list=astroid,fo
28+
29+
- repo: https://github.com/astral-sh/ruff-pre-commit
30+
rev: v0.11.13
31+
hooks:
32+
- id: ruff
33+
args: ["--fix", "--show-fixes"]
34+
- id: ruff-format
35+
36+
- repo: https://github.com/tox-dev/pyproject-fmt
37+
rev: v2.6.0
38+
hooks:
39+
- id: pyproject-fmt
40+
41+
- repo: https://github.com/woodruffw/zizmor-pre-commit
42+
rev: v1.9.0
43+
hooks:
44+
- id: zizmor
45+
46+
ci:
47+
autofix_commit_msg: |
48+
[pre-commit.ci] auto fixes from pre-commit.com hooks
49+
50+
for more information, see https://pre-commit.ci
51+
autofix_prs: false
52+
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
53+
autoupdate_schedule: monthly
54+
skip: []
55+
submodules: false

.readthedocs.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ sphinx:
1010

1111
python:
1212
install:
13-
- requirements: docs/requirements.txt
13+
- requirements: docs/requirements.txt

DevelopmentNotes.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,3 @@ First point is not repeated.
1313
Bounding Box:
1414

1515
A tuple of floats: (min_lon, min_lat, max_lon, max_lat).
16-
17-

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Or clone the project from git and build / install it from there.
1616

1717
## Usage
1818

19-
This package is designed to be used in conjuction with [`xarray`](https://xarray.dev/). Given a [CF Compliant](https://cfconventions.org/) `xarray` dataset named `ds`, this package can be accessed using the `xsg` accessor:
19+
This package is designed to be used in conjunction with [`xarray`](https://xarray.dev/). Given a [CF Compliant](https://cfconventions.org/) `xarray` dataset named `ds`, this package can be accessed using the `xsg` accessor:
2020

2121
```python
2222
# Get the interprested grid class
@@ -31,9 +31,9 @@ ds_subset_bbox = ds.xsg.subset_bbox([-72, 32, -70, 35])
3131
# or by polygon
3232
poly = np.array([
3333
[-72, 32],
34-
[-72, 33],
35-
[-73, 33],
36-
[-73, 31],
34+
[-72, 33],
35+
[-73, 33],
36+
[-73, 31],
3737
[-72, 32],
3838
])
3939
ds_subset_poly = ds.xsg.subset_polygon(poly)
@@ -58,7 +58,7 @@ Then install the project in local edit mode:
5858
pip install -e .
5959
```
6060

61-
Once installed, the tests can be run:
61+
Once installed, the tests can be run:
6262

6363
```bash
6464
python -m pytest

conda_requirements_dev.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,3 @@ pytest
1111
pytest-cov
1212
sphinx
1313
sphinx-rtd-theme
14-

docs/design.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,3 @@ utils
3333
:members:
3434
:undoc-members:
3535
:show-inheritance:
36-

docs/examples/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
[roms.ipynb](./roms.ipynb): Read and subset [WCOFS](https://tidesandcurrents.noaa.gov/ofs/wcofs/wcofs.html) model data in space and view a plot of the resulting data
66

7-
[sscofs.ipynb](./sscofs.ipynb): Read [SSCOFS](https://tidesandcurrents.noaa.gov/ofs/dev/sscofs/sscofs_info.html) model data and assign cf compliant topology to allow for subsetting
7+
[sscofs.ipynb](./sscofs.ipynb): Read [SSCOFS](https://tidesandcurrents.noaa.gov/ofs/dev/sscofs/sscofs_info.html) model data and assign cf compliant topology to allow for subsetting

0 commit comments

Comments
 (0)