Skip to content

Commit a6d4b42

Browse files
authored
Create CONTRIBUTING.md
1 parent ab85f8b commit a6d4b42

File tree

1 file changed

+165
-0
lines changed

1 file changed

+165
-0
lines changed

CONTRIBUTING.md

Lines changed: 165 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,165 @@
1+
# Contributing to LLM Output Stability Gate
2+
3+
Thanks for your interest in contributing! This document provides guidelines for contributions.
4+
5+
## How to Contribute
6+
7+
### Reporting Bugs
8+
9+
- Check if the bug already exists in [Issues](https://github.com/kelpejol/llm-output-stability-gate/issues)
10+
- Use the bug report template
11+
- Include reproduction steps, expected vs actual behavior
12+
- Add relevant logs and environment info
13+
14+
### Suggesting Features
15+
16+
- Check existing [Issues](https://github.com/kelpejol/llm-output-stability-gate/issues) and [Discussions](https://github.com/kelpejol/llm-output-stability-gate/discussions)
17+
- Describe the problem you're solving
18+
- Explain your proposed solution
19+
- Consider backward compatibility
20+
21+
### Pull Requests
22+
23+
1. **Fork the repository**
24+
25+
2. **Create a branch**
26+
```bash
27+
git checkout -b feature/your-feature-name
28+
```
29+
30+
3. **Make your changes**
31+
- Write clear, documented code
32+
- Add tests for new features
33+
- Update documentation if needed
34+
35+
4. **Test your changes**
36+
```bash
37+
pytest -v
38+
black gate/ tests/
39+
ruff check gate/ tests/
40+
```
41+
42+
5. **Commit with clear messages**
43+
```bash
44+
git commit -m "feat: add new evaluation metric"
45+
```
46+
47+
6. **Push and create PR**
48+
```bash
49+
git push origin feature/your-feature-name
50+
```
51+
52+
## Development Setup
53+
54+
```bash
55+
# Clone your fork
56+
git clone https://github.com/your-username/llm-output-stability-gate.git
57+
cd llm-output-stability-gate
58+
59+
# Create virtual environment
60+
python -m venv venv
61+
source venv/bin/activate # Windows: venv\Scripts\activate
62+
63+
# Install dependencies
64+
pip install -r requirements-dev.txt
65+
66+
# Install package in editable mode
67+
pip install -e .
68+
69+
# Set up OpenAI API key (for tests that require it)
70+
export OPENAI_API_KEY=your_key_here
71+
72+
# Run tests
73+
pytest
74+
```
75+
76+
## Code Style
77+
78+
- Follow PEP 8
79+
- Use type hints where possible
80+
- Write docstrings for functions
81+
- Format with Black: `black gate/ tests/`
82+
- Lint with Ruff: `ruff check gate/ tests/`
83+
84+
## Commit Messages
85+
86+
Use conventional commit format:
87+
88+
- `feat:` New feature
89+
- `fix:` Bug fix
90+
- `docs:` Documentation changes
91+
- `test:` Test additions/changes
92+
- `refactor:` Code refactoring
93+
- `chore:` Maintenance tasks
94+
95+
Example: `feat(evaluator): add support for custom UQLM scorers`
96+
97+
## Testing Guidelines
98+
99+
### Running Tests
100+
101+
```bash
102+
# Run all tests (skips tests requiring API key)
103+
pytest
104+
105+
# Run specific test file
106+
pytest tests/test_policy.py
107+
108+
# Run with coverage
109+
pytest --cov=gate
110+
111+
# Run tests that require API key (if you have one)
112+
pytest -m requires_api_key
113+
```
114+
115+
### Writing Tests
116+
117+
- Write tests for all new features
118+
- Mock external API calls when possible
119+
- Use `@pytest.mark.requires_api_key` for tests needing OpenAI
120+
- Aim for >80% code coverage
121+
122+
### Test Structure
123+
124+
```python
125+
class TestNewFeature:
126+
"""Tests for new feature."""
127+
128+
def test_success_case(self):
129+
"""Test successful execution."""
130+
result = my_function("input")
131+
assert result == "expected"
132+
133+
def test_error_case(self):
134+
"""Test error handling."""
135+
with pytest.raises(ValueError):
136+
my_function("invalid")
137+
```
138+
139+
## Documentation
140+
141+
- Update README.md for user-facing changes
142+
- Add docstrings to new functions/classes
143+
- Update API documentation if endpoints change
144+
- Include examples in docstrings
145+
146+
## Security
147+
148+
- Never commit API keys or secrets
149+
- Use `.env` for local development
150+
- Report security issues privately via email
151+
- Follow security best practices
152+
153+
## Questions?
154+
155+
- Open a [Discussion](https://github.com/kelpejol/llm-output-stability-gate/discussions)
156+
- Check existing [Issues](https://github.com/kelpejol/llm-output-stability-gate/issues)
157+
158+
## Code of Conduct
159+
160+
- Be respectful and inclusive
161+
- Provide constructive feedback
162+
- Focus on what is best for the community
163+
- Show empathy towards others
164+
165+
Thank you for contributing! 🎉

0 commit comments

Comments
 (0)