Skip to content

Commit d65c6ff

Browse files
jdbcodeXee authors
authored andcommitted
Align GitHub lint checks with Google3 CheckLint for Xee
PiperOrigin-RevId: 926848396
1 parent 7e5585e commit d65c6ff

4 files changed

Lines changed: 56 additions & 2 deletions

File tree

.github/workflows/lint.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,9 @@ jobs:
5858
- name: Install Xee
5959
run: |
6060
pip install -e .[tests]
61+
- name: Lint with isort
62+
run: |
63+
isort --check .
6164
- name: Lint with pyink
6265
run: |
63-
echo "Lint check temporarily disabled"
64-
# pyink --check .
66+
pyink --check .

.pre-commit-config.yaml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
repos:
2+
- repo: https://github.com/pre-commit/pre-commit-hooks
3+
rev: v4.6.0
4+
hooks:
5+
- id: trailing-whitespace
6+
- id: end-of-file-fixer
7+
- id: check-yaml
8+
- id: check-added-large-files
9+
10+
- repo: https://github.com/pycqa/isort
11+
rev: 5.13.2
12+
hooks:
13+
- id: isort
14+
name: isort (python)
15+
16+
- repo: https://github.com/google/pyink
17+
rev: v24.4.0
18+
hooks:
19+
- id: pyink
20+
types_or: [python, pyi]

docs/contributing.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,31 @@ pixi run -e docs docs-check
5959
`docs-build` builds the HTML docs, while `docs-check` runs a stricter Sphinx
6060
build with warnings treated as errors.
6161

62+
### Code style & formatting
63+
64+
We use `pyink` to format Python code (with 2-space indent) and `isort` to sort
65+
imports to match Google standards. To automate this and ensure your changes
66+
pass CI lint checks:
67+
68+
1. **Install pre-commit** (if not already installed):
69+
```bash
70+
pip install pre-commit
71+
```
72+
2. **Install the git hooks** in the repository:
73+
```bash
74+
pre-commit install
75+
```
76+
77+
Once installed, `isort` and `pyink` will automatically run on and format
78+
any files you modify whenever you run `git commit`.
79+
80+
If you prefer to run them manually without committing, you can use:
81+
```bash
82+
pixi run -e tests isort --check .
83+
pixi run -e tests pyink --check .
84+
```
85+
(Or specify individual files to check instead of `.`).
86+
6287
### Running tests
6388

6489
The Xee integration tests only pass on Xee branches (no forks). Please run the

pyproject.toml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ tests = [
3838
"absl-py",
3939
"pytest",
4040
"pyink",
41+
"isort",
4142
"rasterio",
4243
"rioxarray",
4344
"typing_extensions",
@@ -72,6 +73,12 @@ preview = true
7273
pyink-indentation = 2
7374
pyink-use-majority-quotes = true
7475

76+
[tool.isort]
77+
profile = "google"
78+
use_parentheses = true
79+
known_first_party = ["xee"]
80+
multi_line_output = 3
81+
7582
[tool.setuptools]
7683
packages = ["xee"]
7784

0 commit comments

Comments
 (0)