|
| 1 | +# Contributing to OMOPHub Python SDK |
| 2 | + |
| 3 | +First off, thank you for considering contributing to OMOPHub! |
| 4 | + |
| 5 | +## How Can I Contribute? |
| 6 | + |
| 7 | +### Reporting Bugs |
| 8 | + |
| 9 | +Before creating bug reports, please check the [existing issues](https://github.com/OMOPHub/omophub-python/issues) to avoid duplicates. |
| 10 | + |
| 11 | +When creating a bug report, please include: |
| 12 | + |
| 13 | +- **Python version** (`python --version`) |
| 14 | +- **SDK version** (`pip show omophub`) |
| 15 | +- **Operating system** |
| 16 | +- **Minimal code example** that reproduces the issue |
| 17 | +- **Full error traceback** |
| 18 | +- **Expected vs actual behavior** |
| 19 | + |
| 20 | +### Suggesting Features |
| 21 | + |
| 22 | +Feature requests are welcome! Please open an issue with: |
| 23 | + |
| 24 | +- Clear description of the feature |
| 25 | +- Use case: why would this be useful? |
| 26 | +- Possible implementation approach (optional) |
| 27 | + |
| 28 | +### Pull Requests |
| 29 | + |
| 30 | +1. **Fork the repository** and create your branch from `main` |
| 31 | +2. **Install development dependencies:** |
| 32 | + ```bash |
| 33 | + git clone https://github.com/YOUR_USERNAME/omophub-python.git |
| 34 | + cd omophub-python |
| 35 | + pip install -e ".[dev]" |
| 36 | + ``` |
| 37 | +3. **Make your changes** with clear, descriptive commits |
| 38 | +4. **Add tests** for new functionality |
| 39 | +5. **Run the test suite:** |
| 40 | + ```bash |
| 41 | + pytest |
| 42 | + ``` |
| 43 | +6. **Ensure code style compliance:** |
| 44 | + ```bash |
| 45 | + ruff check . |
| 46 | + ruff format . |
| 47 | + mypy src/ |
| 48 | + ``` |
| 49 | +7. **Update documentation** if needed |
| 50 | +8. **Submit a pull request** with a clear description |
| 51 | + |
| 52 | +## Development Setup |
| 53 | + |
| 54 | +### Prerequisites |
| 55 | + |
| 56 | +- Python 3.9+ |
| 57 | +- pip |
| 58 | + |
| 59 | +### Installation |
| 60 | + |
| 61 | +```bash |
| 62 | +# Clone your fork |
| 63 | +git clone https://github.com/YOUR_USERNAME/omophub-python.git |
| 64 | +cd omophub-python |
| 65 | + |
| 66 | +# Create virtual environment |
| 67 | +python -m venv venv |
| 68 | +source venv/bin/activate # On Windows: venv\Scripts\activate |
| 69 | + |
| 70 | +# Install in development mode |
| 71 | +pip install -e ".[dev]" |
| 72 | +``` |
| 73 | + |
| 74 | +### Running Tests |
| 75 | + |
| 76 | +```bash |
| 77 | +# Run all tests |
| 78 | +pytest |
| 79 | + |
| 80 | +# Run with coverage |
| 81 | +pytest --cov=omophub --cov-report=html |
| 82 | + |
| 83 | +# Run specific test file |
| 84 | +pytest tests/test_concepts.py |
| 85 | + |
| 86 | +# Run tests matching a pattern |
| 87 | +pytest -k "test_search" |
| 88 | +``` |
| 89 | + |
| 90 | +### Code Style |
| 91 | + |
| 92 | +We use: |
| 93 | +- **Ruff** for linting and formatting |
| 94 | +- **mypy** for type checking |
| 95 | + |
| 96 | +```bash |
| 97 | +# Check linting |
| 98 | +ruff check . |
| 99 | + |
| 100 | +# Auto-format code |
| 101 | +ruff format . |
| 102 | + |
| 103 | +# Type checking |
| 104 | +mypy src/ |
| 105 | +``` |
| 106 | + |
| 107 | +## Project Structure |
| 108 | + |
| 109 | +``` |
| 110 | +omophub-python/ |
| 111 | +├── src/omophub/ |
| 112 | +│ ├── __init__.py # Public API exports |
| 113 | +│ ├── client.py # OMOPHub client class |
| 114 | +│ ├── resources/ # API resource classes |
| 115 | +│ │ ├── concepts.py |
| 116 | +│ │ ├── search.py |
| 117 | +│ │ ├── hierarchy.py |
| 118 | +│ │ └── ... |
| 119 | +│ ├── types.py # TypedDict definitions |
| 120 | +│ └── exceptions.py # Custom exceptions |
| 121 | +├── tests/ |
| 122 | +│ ├── test_concepts.py |
| 123 | +│ ├── test_search.py |
| 124 | +│ └── ... |
| 125 | +├── examples/ |
| 126 | +│ └── ... |
| 127 | +└── pyproject.toml |
| 128 | +``` |
| 129 | + |
| 130 | +## Commit Messages |
| 131 | + |
| 132 | +We follow [Conventional Commits](https://www.conventionalcommits.org/): |
| 133 | + |
| 134 | +- `feat:` New feature |
| 135 | +- `fix:` Bug fix |
| 136 | +- `docs:` Documentation changes |
| 137 | +- `test:` Adding or updating tests |
| 138 | +- `refactor:` Code refactoring |
| 139 | +- `chore:` Maintenance tasks |
| 140 | + |
| 141 | +Examples: |
| 142 | +``` |
| 143 | +feat: add semantic search endpoint |
| 144 | +fix: handle rate limit errors correctly |
| 145 | +docs: update README with new examples |
| 146 | +test: add tests for batch concept lookup |
| 147 | +``` |
| 148 | + |
| 149 | +## Questions? |
| 150 | + |
| 151 | +- Open a [GitHub Discussion](https://github.com/OMOPHub/omophub-python/discussions) |
| 152 | +- Email: support@omophub.com |
| 153 | + |
| 154 | +## License |
| 155 | + |
| 156 | +By contributing, you agree that your contributions will be licensed under the MIT License. |
| 157 | + |
| 158 | +--- |
| 159 | + |
| 160 | +Thank you for helping make OMOPHub better! |
0 commit comments