|
| 1 | +# Contributing to Permis.io Python SDK |
| 2 | + |
| 3 | +Thank you for your interest in contributing to the Permis.io Python SDK! This document provides guidelines and steps for contributing. |
| 4 | + |
| 5 | +## Code of Conduct |
| 6 | + |
| 7 | +By participating in this project, you agree to abide by our Code of Conduct. |
| 8 | + |
| 9 | +## How to Contribute |
| 10 | + |
| 11 | +### Reporting Bugs |
| 12 | + |
| 13 | +1. Check if the bug has already been reported in [Issues](https://github.com/permisio/permis-python/issues) |
| 14 | +2. If not, create a new issue with: |
| 15 | + - A clear, descriptive title |
| 16 | + - Steps to reproduce the bug |
| 17 | + - Expected vs actual behavior |
| 18 | + - Python version and SDK version |
| 19 | + - Any relevant code snippets or error messages |
| 20 | + |
| 21 | +### Suggesting Features |
| 22 | + |
| 23 | +1. Check existing issues for similar suggestions |
| 24 | +2. Create a new issue with the `enhancement` label |
| 25 | +3. Describe the feature and its use case |
| 26 | + |
| 27 | +### Pull Requests |
| 28 | + |
| 29 | +1. Fork the repository |
| 30 | +2. Create a feature branch: `git checkout -b feature/your-feature-name` |
| 31 | +3. Make your changes |
| 32 | +4. Write or update tests as needed |
| 33 | +5. Ensure all tests pass: `pytest` |
| 34 | +6. Run linting: `ruff check .` |
| 35 | +7. Run type checking: `mypy permisio` |
| 36 | +8. Format code: `black .` |
| 37 | +9. Commit with clear messages following [Conventional Commits](https://www.conventionalcommits.org/) |
| 38 | +10. Push to your fork and create a Pull Request |
| 39 | + |
| 40 | +## Development Setup |
| 41 | + |
| 42 | +### Prerequisites |
| 43 | + |
| 44 | +- Python 3.9 or later |
| 45 | +- pip or poetry |
| 46 | + |
| 47 | +### Installation |
| 48 | + |
| 49 | +```bash |
| 50 | +# Clone your fork |
| 51 | +git clone https://github.com/YOUR_USERNAME/permis-python.git |
| 52 | +cd permis-python |
| 53 | + |
| 54 | +# Create virtual environment |
| 55 | +python -m venv venv |
| 56 | +source venv/bin/activate # On Windows: venv\Scripts\activate |
| 57 | + |
| 58 | +# Install development dependencies |
| 59 | +pip install -e ".[dev]" |
| 60 | +``` |
| 61 | + |
| 62 | +### Running Tests |
| 63 | + |
| 64 | +```bash |
| 65 | +# Run all tests |
| 66 | +pytest |
| 67 | + |
| 68 | +# Run tests with coverage |
| 69 | +pytest --cov=permisio --cov-report=term-missing |
| 70 | + |
| 71 | +# Run specific test file |
| 72 | +pytest tests/test_client.py |
| 73 | + |
| 74 | +# Run tests in verbose mode |
| 75 | +pytest -v |
| 76 | +``` |
| 77 | + |
| 78 | +### Code Quality |
| 79 | + |
| 80 | +```bash |
| 81 | +# Run linter |
| 82 | +ruff check . |
| 83 | + |
| 84 | +# Fix linting issues |
| 85 | +ruff check . --fix |
| 86 | + |
| 87 | +# Run type checker |
| 88 | +mypy permisio |
| 89 | + |
| 90 | +# Format code |
| 91 | +black . |
| 92 | + |
| 93 | +# Check formatting without changing files |
| 94 | +black . --check |
| 95 | +``` |
| 96 | + |
| 97 | +### Code Style |
| 98 | + |
| 99 | +- Follow PEP 8 style guidelines |
| 100 | +- Use type hints for all public functions |
| 101 | +- Document public APIs with docstrings (Google style) |
| 102 | +- Keep functions focused and small |
| 103 | +- Write meaningful test cases |
| 104 | + |
| 105 | +### Commit Messages |
| 106 | + |
| 107 | +Follow the [Conventional Commits](https://www.conventionalcommits.org/) specification: |
| 108 | + |
| 109 | +- `feat:` - New features |
| 110 | +- `fix:` - Bug fixes |
| 111 | +- `docs:` - Documentation changes |
| 112 | +- `test:` - Test changes |
| 113 | +- `refactor:` - Code refactoring |
| 114 | +- `chore:` - Maintenance tasks |
| 115 | + |
| 116 | +Example: `feat: add tenant filtering to role assignment` |
| 117 | + |
| 118 | +## Release Process |
| 119 | + |
| 120 | +Releases are managed by the maintainers. Version bumps follow [Semantic Versioning](https://semver.org/). |
| 121 | + |
| 122 | +## Questions? |
| 123 | + |
| 124 | +Feel free to open an issue for any questions or reach out to the maintainers. |
| 125 | + |
| 126 | +Thank you for contributing! 🎉 |
0 commit comments