xarray-sql icon indicating copy to clipboard operation
xarray-sql copied to clipboard

Add pre-commit hooks with pyink and mypy

Open jayendra-info opened this issue 1 week ago • 0 comments

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.

jayendra-info avatar Nov 27 '25 04:11 jayendra-info