Skip to content

Contributing to nonconform

We welcome contributions to nonconform! This guide will help you get started.

Types of Contributions

Bug Reports

  • Use the GitHub issue tracker
  • Include minimal reproducible examples
  • Specify your environment (Python version, OS, etc.)

Feature Requests

  • Describe the use case clearly
  • Explain how it fits with the project's goals
  • Consider proposing an implementation approach

Code Contributions

  • Bug fixes
  • New conformalization strategies
  • Performance improvements
  • Documentation improvements

Documentation

  • Fix typos or unclear explanations
  • Add examples or tutorials
  • Improve API documentation

Development Setup

Prerequisites

  • Python 3.12 or higher
  • Git
  • uv (Python package manager)

Setup Instructions

  1. Fork and clone the repository

    git clone https://github.com/yourusername/nonconform.git
    cd nonconform
    

  2. Install dependencies and setup development environment

    # Install all dependencies including dev extras
    uv sync --extra dev --extra all
    

  3. Setup pre-commit hooks

    uv run pre-commit install
    

  4. Run tests to verify setup

    uv run python -m unittest discover tests/
    

Development Workflow

Before Making Changes

  1. Create a new branch

    git checkout -b feature/your-feature-name
    # or
    git checkout -b fix/issue-description
    

  2. Sync with upstream

    git remote add upstream https://github.com/original/nonconform.git
    git fetch upstream
    git rebase upstream/main
    

Making Changes

  1. Write tests first (TDD approach recommended)

    # Add tests in tests/
    uv run python -m unittest tests.unit.test_your_feature -v
    

  2. Implement your changes

  3. Follow the existing code style
  4. Add docstrings to new functions/classes
  5. Keep commits atomic and well-described

  6. Run the full test suite

    uv run python -m unittest discover tests/
    

  7. Check code quality

    # Format code and fix linting issues
    uv run ruff format nonconform/ tests/
    uv run ruff check nonconform/ tests/ --fix
    
    # Or run all pre-commit hooks
    uv run pre-commit run --all-files
    

Documentation

  1. Update docstrings
  2. Use Google style docstrings
  3. Include examples where helpful
  4. Document all parameters and return values

  5. Update user documentation

  6. Add new features to appropriate guides
  7. Update examples if needed
  8. Test documentation builds locally

  9. Build documentation locally

    cd docs/
    uv run mkdocs serve
    # Open http://127.0.0.1:8000 in browser
    

Submitting Changes

  1. Commit your changes

    git add .
    git commit -m "feat: add weighted conformal p-values for covariate shift"
    

  2. Push to your fork

    git push origin feature/your-feature-name
    

  3. Create a pull request

  4. Use a clear, descriptive title
  5. Explain what changes you made and why
  6. Reference any related issues
  7. Include tests and documentation updates

Code Style Guidelines

Python Code Style

  • Follow PEP 8
  • Use Ruff for formatting and linting (replaces Black, isort, flake8)
  • Use Google-style docstrings