You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit sets up automated code quality checks using pre-commit:
1. Pre-commit configuration (.pre-commit-config.yaml):
- Added pyink for code formatting (reads config from pyproject.toml)
- Added mypy for type checking
- Added standard pre-commit hooks (trailing whitespace, end-of-file,
etc.)
2. Updated pyproject.toml:
- Added mypy and pre-commit to dev dependencies
- Added pandas-stubs for better type checking
- Configured mypy with per-module ignores for libraries without stubs
- Set python_version to 3.11 to match .python-version file
3. Fixed type errors in xarray_sql/df.py:
- Fixed tuple concatenation type issues in block_slices()
- Fixed Callable type annotation syntax in from_map_batched()
- Added type ignore for xarray return type in pivot()
4. Updated CONTRIBUTING.md:
- Documented pre-commit setup steps
- Updated formatting/type-checking instructions
5. Updated GitHub Actions lint workflow:
- Added mypy type checking step
- Changed to use uv run for consistency
6. Auto-fixed formatting issues:
- Removed trailing whitespace
- Fixed end-of-file newlines
- Applied pyink formatting
All hooks pass successfully and type checking works correctly.
---------
Co-authored-by: jayendra <jayendra0parmar@gmail.com>
0. We use `uv` to manage the project: https://docs.astral.sh/uv/getting-started/installation/
16
16
1. Clone the repository (bonus: [via SSH](https://docs.github.com/en/authentication/connecting-to-github-with-ssh/adding-a-new-ssh-key-to-your-github-account))
17
17
and `cd xarray_sql` (the project root).
18
-
2. Install dev dependencies via: `uv sync --dev`
18
+
2. Install dev dependencies via: `uv sync --dev`
19
+
3. Install pre-commit hooks: `uv run pre-commit install`
20
+
21
+
This will automatically run code formatting (pyink) and type checking (mypy) before each commit.
22
+
You can also run the hooks manually with: `uv run pre-commit run --all-files`
19
23
20
24
21
25
## Before submitting a pull request...
22
26
23
27
Thanks so much for your contribution! For a volunteer led project, we so
24
28
appreciate your help. A few things to keep in mind:
25
29
- Please be nice. We assume good intent from you, and we ask you to do the same for us.
26
-
- Development in this project will be slow if not sporadic. Reviews will come
30
+
- Development in this project will be slow if not sporadic. Reviews will come
27
31
as time allows.
28
-
- Every contribution, big or small, matters and deserves credit.
32
+
- Every contribution, big or small, matters and deserves credit.
29
33
30
34
Here are a few requests for your development process:
31
-
- We require all code to be formatted with `pyink` (i.e., please run `uvx pyink .`).
35
+
- We require all code to be formatted with `pyink` and type-checked with `mypy`.
36
+
These checks run automatically via pre-commit hooks (see Developer setup above).
37
+
If you need to run them manually:
38
+
- Formatting: `uv run pre-commit run pyink --all-files` or `uvx pyink .`
39
+
- Type checking: `uv run pre-commit run mypy --all-files` or `uv run mypy xarray_sql/`
32
40
- Please include unit tests, if possible, and performance tests when you touch the core functionality (see `perf_tests/`).
33
41
- It's polite to do a self review before asking for one from a maintainer. Don't stress if you forget; we all do sometimes.
34
42
- Please add (or update) documentation when adding new code. We use [Google Style docstrings](https://sphinxcontrib-napoleon.readthedocs.io/en/latest/example_google.html).
0 commit comments