Skip to content

Contributing

Thank you for your interest in contributing to COSMIC!

Getting Started

Prerequisites

  • Python 3.10+
  • Git
  • CUDA-capable GPU (recommended)

Development Setup

# Fork and clone
git clone https://github.com/YOUR_USERNAME/cosmic.git
cd cosmic

# Create virtual environment
python -m venv venv
source venv/bin/activate

# Install with dev dependencies
pip install -e ".[all]"

# Install spaCy model
python -m spacy download en_core_web_trf

# Install pre-commit hooks
pip install pre-commit
pre-commit install

Development Workflow

Branch Naming

git checkout -b feature/add-new-strategy
git checkout -b fix/boundary-detection-bug
git checkout -b docs/update-api-reference

Running Checks

# Format code
ruff format src/ tests/

# Lint
ruff check src/ tests/

# Type check
mypy src/cosmic/

# Run tests
pytest tests/ -v

Commit Messages

Follow conventional commit format:

feat: add Ollama integration for local LLM
fix: correct DCS calculation for single sentences
docs: update CLI reference

Pull Requests

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Run all checks
  5. Submit a PR

PR Checklist

  • [ ] Tests pass
  • [ ] Code is formatted
  • [ ] Types are annotated
  • [ ] Documentation updated

Code Style

  • Use Ruff for formatting
  • Add type hints to all functions
  • Use Google-style docstrings
  • Keep functions focused and small

Testing

# Run all tests
pytest tests/

# Run with coverage
pytest tests/ --cov=cosmic --cov-report=html

# Run specific test
pytest tests/unit/test_dcs.py -v

Documentation

  • Update docs when changing APIs
  • Add examples for new features
  • Keep docstrings current

Questions?

See CONTRIBUTING.md for full guidelines.