xarray-sql
xarray-sql copied to clipboard
Add pre-commit hooks with pyink and mypy
This commit sets up automated code quality checks using pre-commit:
-
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.)
-
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
-
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()
-
Updated CONTRIBUTING.md:
- Documented pre-commit setup steps
- Updated formatting/type-checking instructions
-
Updated GitHub Actions lint workflow:
- Added mypy type checking step
- Changed to use uv run for consistency
-
Auto-fixed formatting issues:
- Removed trailing whitespace
- Fixed end-of-file newlines
- Applied pyink formatting
All hooks pass successfully and type checking works correctly.