Skip to content

Contributing

We welcome contributions to the IVCAP Service SDK!

Getting Started

1. Fork and Clone

git clone https://github.com/YOUR_USERNAME/ivcap-service-sdk-python.git
cd ivcap-service-sdk-python

2. Set Up Development Environment

poetry install --with dev

3. Create a Branch

git checkout -b feature/my-feature

Development Workflow

Running Tests

poetry run pytest
pytest --cov

Code Quality

# Format code
poetry run ruff format .

# Lint
poetry run ruff check . --fix

# Type checking
poetry run pyright

Building Documentation

cd docs
pip install -r requirements-docs.txt
mkdocs serve

Visit http://localhost:8000 to preview the docs.

Making Changes

Code Changes

  1. Make your changes in a feature branch
  2. Add tests for new functionality
  3. Ensure all tests pass: poetry run pytest
  4. Update documentation as needed

Documentation Changes

  1. Edit files in docs/docs/
  2. Test locally: mkdocs serve
  3. Check formatting and links
  4. Submit pull request

Commit Messages

Use clear, descriptive commit messages:

โœจ feat: add new feature
๐Ÿ› fix: resolve bug
๐Ÿ“ docs: update documentation
๐Ÿงช test: add unit tests
๐Ÿ”จ chore: refactor code

Pull Request Process

  1. Update documentation
  2. Add/update tests
  3. Ensure CI passes
  4. Create clear PR description
  5. Link related issues

Code Style

We follow Python PEP 8 with these tools:

  • Ruff โ€” Linting and formatting
  • Pyright โ€” Type checking
  • Pytest โ€” Testing

Style Guide

# Docstrings follow Google style
def process_job(req: Request, ctx: JobContext) -> Result:
    """
    Process a job.

    Args:
        req: Request to process
        ctx: Job context

    Returns:
        Processing result

    Raises:
        ValueError: If validation fails
    """
    pass

# Type hints required
def add(a: int, b: int) -> int:
    return a + b

# Use meaningful variable names
result = process(data)  # Good
x = process(y)          # Bad

Testing

Write tests for new features:

# tests/test_feature.py
import pytest
from src.feature import my_function

def test_my_function_basic():
    result = my_function(5)
    assert result == 10

def test_my_function_error():
    with pytest.raises(ValueError):
        my_function(-1)

Run tests:

poetry run pytest tests/
poetry run pytest tests/test_feature.py -v

Documentation Guidelines

  1. Be clear โ€” Write for developers new to the SDK
  2. Include examples โ€” Every concept should have a code example
  3. Link between pages โ€” Use relative links to other docs
  4. Update TOC โ€” If adding new pages, update mkdocs.yml

Reporting Issues

Bug Reports

Include: - Minimal reproducible example - Expected vs actual behavior - Python version and environment - Traceback (if applicable)

Feature Requests

Include: - Use case and motivation - Proposed API/syntax - Any alternatives considered

Questions?

  • GitHub Issues โ€” For bugs and feature requests
  • Discussions โ€” For questions and ideas
  • Email โ€” For security issues

License

By contributing, you agree that your contributions will be licensed under the same LICENSE as the project.


Thank you for contributing to IVCAP! ๐Ÿš€