Skip to content

Add type hints to improve code quality and developer experience #61

@mihiarc

Description

@mihiarc

Description

The codebase currently lacks type hints, which makes it harder for developers to understand function signatures, catch bugs early, and use modern IDE features effectively.

Proposed Changes

Add comprehensive type hints to all Python modules:

  • Function parameters and return types
  • Class attributes
  • Variable annotations where beneficial
  • Consider using from typing import for complex types (List, Dict, Optional, Union, etc.)

Affected Modules

All Python files in the skiba package would benefit from type hints:

  • point_extraction.py
  • area_extraction.py
  • buffer_coordinates.py
  • buffer_and_sample.py
  • geojson_buffering.py
  • interactive.py
  • foliumcode.py
  • ipyleafletcode.py
  • common.py

Benefits

  • Better IDE support with autocomplete and error detection
  • Clearer API documentation
  • Catch type-related bugs before runtime
  • Improve code maintainability
  • Make the codebase more professional and modern

Implementation Notes

  • Should be compatible with Python 3.9+ (as per requires-python in pyproject.toml)
  • Consider adding mypy to development dependencies for type checking
  • Use modern type hint syntax where possible

Example

# Before
def buffer_coordinates(coords, radius):
    ...

# After
def buffer_coordinates(coords: List[Tuple[float, float]], radius: float) -> Dict[str, Any]:
    ...

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions