Contributing to Shapelib#

Development Setup#

  1. Clone the repository:

git clone https://github.com/g-e-o-i-a/shapelib.git
cd shapelib
  1. Create a virtual environment:

python -m venv .venv
source .venv/bin/activate  # Linux/Mac
  1. Install dependencies:

pip install -e ".[dev]"
  1. Run tests:

pytest tests/

Code Style#

  • Follow PEP 8

  • Use type hints (mypy –strict)

  • NumPy-style docstrings

  • English for code and comments

Adding New Features#

Adding a New File Format Handler#

  1. Create handler in src/shapelib/core/handlers/

  2. Use @register_handler decorator

  3. Implement GeoFileHandler interface

from shapelib.factories.registry import register_handler

@register_handler(file_extension=".xyz")
class XyzHandler(GeoFileHandler):
    ...

Adding a New Cloud Provider#

  1. Create provider in src/shapelib/core/cloud/providers/

  2. Use @register_cloud_provider decorator

  3. Implement CloudProvider protocol

from shapelib.factories.cloud_registry import register_cloud_provider

@register_cloud_provider
class GcsProvider:
    def supports(self, cloud_path: CloudPath) -> bool: ...
    def upload(self, source: Path, cloud_path: CloudPath) -> None: ...
    def download(self, cloud_path: CloudPath, destination: Path) -> Path: ...
    def file_exists(self, cloud_path: CloudPath) -> bool: ...

Running Tests#

# All tests
pytest tests/

# With coverage
pytest tests/ --cov=shapelib

# Specific test file
pytest tests/test_cloud_support.py

Contact#

For questions: rodrigo@geoia.tech