|
| 1 | +# Contributing to AGON |
| 2 | + |
| 3 | +Thank you for your interest in contributing to AGON! This document provides guidelines and instructions for contributing to the project. |
| 4 | + |
| 5 | +## Development Setup |
| 6 | + |
| 7 | +AGON uses [uv](https://github.com/astral-sh/uv) for dependency management and development workflows. |
| 8 | + |
| 9 | +### Prerequisites |
| 10 | + |
| 11 | +- Python 3.11 or higher |
| 12 | +- uv installed (`curl -LsSf https://astral.sh/uv/install.sh | sh`) |
| 13 | +- Git |
| 14 | + |
| 15 | +### Setup Instructions |
| 16 | + |
| 17 | +```bash |
| 18 | +# Clone the repository |
| 19 | +git clone https://github.com/Verdenroz/agon-python.git |
| 20 | +cd agon-python |
| 21 | + |
| 22 | +# Install dependencies (including dev dependencies) |
| 23 | +uv sync --dev |
| 24 | + |
| 25 | +# Install pre-commit hooks |
| 26 | +uv run pre-commit install |
| 27 | +``` |
| 28 | + |
| 29 | +### Running Tests |
| 30 | + |
| 31 | +```bash |
| 32 | +# Shortcut |
| 33 | +make test |
| 34 | + |
| 35 | +# Run all tests |
| 36 | +uv run pytest |
| 37 | + |
| 38 | +# Run tests with coverage report |
| 39 | +uv run pytest --cov=agon --cov-report=html --cov-report=term |
| 40 | + |
| 41 | +# Run specific test file |
| 42 | +uv run pytest tests/test_core.py -v |
| 43 | + |
| 44 | +# Run tests matching a pattern |
| 45 | +uv run pytest -k "test_encode" -v |
| 46 | +``` |
| 47 | + |
| 48 | +### Code Quality |
| 49 | + |
| 50 | +The project uses several tools to maintain code quality: |
| 51 | + |
| 52 | +```bash |
| 53 | +# Lint + format + fix |
| 54 | +make fix |
| 55 | + |
| 56 | +# Run linter (ruff) |
| 57 | +uv run ruff check src tests |
| 58 | + |
| 59 | +# Auto-fix linting issues |
| 60 | +uv run ruff check --fix src tests |
| 61 | + |
| 62 | +# Format code |
| 63 | +uv run ruff format src tests |
| 64 | + |
| 65 | +# Type checking (basedpyright) |
| 66 | +uv run basedpyright src tests |
| 67 | + |
| 68 | +# Run all quality checks (pre-commit) |
| 69 | +uv run pre-commit run --all-files |
| 70 | +``` |
| 71 | + |
| 72 | +### Building Documentation |
| 73 | + |
| 74 | +```bash |
| 75 | +# Serve documentation locally |
| 76 | +make docs |
| 77 | + |
| 78 | +# Build documentation |
| 79 | +uv run mkdocs build |
| 80 | +``` |
| 81 | + |
| 82 | +## Contribution Guidelines |
| 83 | + |
| 84 | +### Code Style |
| 85 | + |
| 86 | +- Follow PEP 8 style guidelines (enforced by ruff) |
| 87 | +- Use type hints for all function signatures |
| 88 | +- Write descriptive variable and function names |
| 89 | +- Keep functions focused and concise (prefer single responsibility) |
| 90 | + |
| 91 | +### Testing Requirements |
| 92 | + |
| 93 | +- All new features must include tests |
| 94 | +- Maintain or improve code coverage (currently >95%) |
| 95 | +- Tests should cover: |
| 96 | + - Happy path functionality |
| 97 | + - Edge cases |
| 98 | + - Error conditions |
| 99 | + - Round-trip encoding/decoding |
| 100 | + |
| 101 | +Example test structure: |
| 102 | + |
| 103 | +```python |
| 104 | +def test_feature_name() -> None: |
| 105 | + """Brief description of what this test validates.""" |
| 106 | + # Arrange |
| 107 | + data = {"key": "value"} |
| 108 | + |
| 109 | + # Act |
| 110 | + result = AGON.encode(data, format="auto") |
| 111 | + |
| 112 | + # Assert |
| 113 | + assert result.format == "json" |
| 114 | + assert AGON.decode(result) == data |
| 115 | +``` |
| 116 | + |
| 117 | +### Commit Messages |
| 118 | + |
| 119 | +Follow conventional commits format: |
| 120 | + |
| 121 | +- `feat: add new format detection heuristic` |
| 122 | +- `fix: handle empty arrays in struct encoder` |
| 123 | +- `docs: update API reference for project_data` |
| 124 | +- `test: add edge cases for columnar encoding` |
| 125 | +- `refactor: simplify auto-selection logic` |
| 126 | +- `perf: optimize token counting for large datasets` |
| 127 | + |
| 128 | +### Pull Request Process |
| 129 | + |
| 130 | +1. **Create a feature branch** from `master`: |
| 131 | + ```bash |
| 132 | + git checkout -b feat/your-feature-name |
| 133 | + ``` |
| 134 | + |
| 135 | +2. **Make your changes** following the guidelines above |
| 136 | + |
| 137 | +3. **Run all quality checks**: |
| 138 | + ```bash |
| 139 | + uv run pytest |
| 140 | + uv run ruff check src tests |
| 141 | + uv run basedpyright src tests |
| 142 | + ``` |
| 143 | + |
| 144 | +4. **Commit your changes** with descriptive messages |
| 145 | + |
| 146 | +5. **Push to your fork** and create a pull request |
| 147 | + |
| 148 | +6. **Describe your changes** in the PR: |
| 149 | + - What problem does this solve? |
| 150 | + - What approach did you take? |
| 151 | + - Are there any breaking changes? |
| 152 | + - Have you added tests? |
| 153 | + |
| 154 | +7. **Wait for review** - maintainers will review and provide feedback |
| 155 | + |
| 156 | +### Pull Request Requirements |
| 157 | + |
| 158 | +Before submitting a PR, ensure: |
| 159 | + |
| 160 | +- [ ] All tests pass (`uv run pytest`) |
| 161 | +- [ ] Code coverage is maintained or improved |
| 162 | +- [ ] Linting passes (`uv run ruff check`) |
| 163 | +- [ ] Type checking passes (`uv run basedpyright`) |
| 164 | +- [ ] Documentation is updated (if applicable) |
| 165 | +- [ ] Commit messages follow conventional commits format |
| 166 | + |
| 167 | +## Areas of Interest |
| 168 | + |
| 169 | +We welcome contributions in these areas: |
| 170 | + |
| 171 | +### Format Implementations |
| 172 | + |
| 173 | +- **New encoding formats**: Implement additional specialized formats (e.g., markdown tables, CSV variants) |
| 174 | +- **Format optimizations**: Improve token efficiency of existing formats |
| 175 | +- **Format detection**: Enhance heuristics for auto-selection |
| 176 | + |
| 177 | +### Performance |
| 178 | + |
| 179 | +- **Large dataset optimization**: Improve encoding/decoding speed for datasets >1MB |
| 180 | +- **Memory efficiency**: Reduce memory footprint during processing |
| 181 | +- **Streaming support**: Add support for streaming large datasets |
| 182 | + |
| 183 | +### Reliability |
| 184 | + |
| 185 | +- **LLM parsing tests**: Validate that LLMs can reliably parse AGON formats |
| 186 | +- **Fuzzing**: Add property-based testing for edge cases |
| 187 | +- **Error handling**: Improve error messages and recovery |
| 188 | + |
| 189 | +### Cross-Language Support |
| 190 | + |
| 191 | +- **Go implementation**: Port AGON to Go |
| 192 | +- **Rust implementation**: Port AGON to Rust |
| 193 | +- **TypeScript/JavaScript**: Port AGON to Node.js/Deno/Bun |
| 194 | +- **Language interop**: Ensure format compatibility across implementations |
| 195 | + |
| 196 | +### Tooling |
| 197 | + |
| 198 | +- **VS Code extension**: Syntax highlighting and format preview |
| 199 | +- **CLI tool**: Standalone command-line encoder/decoder |
| 200 | +- **Web playground**: Interactive demo site for testing encodings |
| 201 | +- **CI/CD improvements**: Enhance automated testing and release workflows |
| 202 | + |
| 203 | +### Documentation |
| 204 | + |
| 205 | +- **Additional examples**: Real-world use cases and patterns |
| 206 | +- **Performance guides**: Best practices for different data shapes |
| 207 | +- **Video tutorials**: Walkthrough of key features |
| 208 | +- **Blog posts**: Deep dives into format design decisions |
| 209 | + |
| 210 | +## Code Review Process |
| 211 | + |
| 212 | +Pull requests are reviewed by project maintainers. We aim to: |
| 213 | + |
| 214 | +- Provide initial feedback within 48 hours |
| 215 | +- Complete reviews within 1 week for standard PRs |
| 216 | +- Merge approved PRs promptly |
| 217 | + |
| 218 | +During review, we evaluate: |
| 219 | + |
| 220 | +- **Correctness**: Does the code work as intended? |
| 221 | +- **Tests**: Are edge cases covered? |
| 222 | +- **Performance**: Does this introduce performance regressions? |
| 223 | +- **Maintainability**: Is the code clear and well-documented? |
| 224 | +- **Compatibility**: Are there breaking changes? |
| 225 | + |
| 226 | +## Reporting Issues |
| 227 | + |
| 228 | +When reporting bugs or requesting features: |
| 229 | + |
| 230 | +### Bug Reports |
| 231 | + |
| 232 | +Include: |
| 233 | +- AGON version (`python -c "import agon; print(agon.__version__)"`) |
| 234 | +- Python version (`python --version`) |
| 235 | +- Minimal reproduction code |
| 236 | +- Expected vs actual behavior |
| 237 | +- Error messages or stack traces |
| 238 | + |
| 239 | +### Feature Requests |
| 240 | + |
| 241 | +Include: |
| 242 | +- Use case description |
| 243 | +- Proposed API (if applicable) |
| 244 | +- Alternative solutions considered |
| 245 | +- Willingness to implement (if you plan to contribute) |
| 246 | + |
| 247 | +## Questions? |
| 248 | + |
| 249 | +- **Documentation**: Check [docs/](docs/) for detailed guides |
| 250 | +- **Issues**: Search [existing issues](https://github.com/Verdenroz/agon-python/issues) |
| 251 | +- **Discussions**: Start a [discussion](https://github.com/Verdenroz/agon-python/discussions) |
| 252 | + |
| 253 | +## License |
| 254 | + |
| 255 | +By contributing to AGON, you agree that your contributions will be licensed under the MIT License. |
| 256 | + |
| 257 | +--- |
| 258 | + |
| 259 | +Thank you for contributing to AGON! Your contributions help make LLM prompt optimization more accessible and reliable. |
0 commit comments