Contributing Guide
Thank you for your interest in contributing to PyReact Framework!
Table of Contents
Code of Conduct
Please read and follow our Code of Conduct.
How to Contribute
Reporting Bugs
Check if the bug has already been reported in Issues
If not, create a new issue with: - Clear title - Steps to reproduce - Expected behavior - Actual behavior - Environment details
Suggesting Features
Check if the feature has been suggested
Create a new issue with: - Clear title - Use case description - Proposed solution (optional)
Pull Requests
Development Setup
Fork the repository
Clone your fork:
git clone https://github.com/wanbnn/pyreact.git cd pyreact
Create a virtual environment:
python -m venv venv source venv/bin/activate # Linux/Mac venv\Scripts\activate # Windows
Install dependencies:
pip install -e ".[dev]"
Create a branch:
git checkout -b feature/my-feature
Coding Standards
Follow these guidelines:
Python Style
Follow PEP 8
Use type hints
Write docstrings
Code Example:
def calculate_total(items: list[dict]) -> float:
"""
Calculate the total price of items.
Args:
items: List of item dictionaries with 'price' key
Returns:
Total price as float
Raises:
ValueError: If items list is empty
"""
if not items:
raise ValueError("Items list cannot be empty")
return sum(item['price'] for item in items)
Testing
Write tests for your code:
import pytest
from pyreact.utils import calculate_total
def test_calculate_total():
items = [{'price': 10}, {'price': 20}]
assert calculate_total(items) == 30
def test_calculate_total_empty():
with pytest.raises(ValueError):
calculate_total([])
Run tests:
pytest tests/
Documentation
Update documentation:
Update docstrings
Update API reference if needed
Add examples
Update changelog
Commit Messages
Follow conventional commits:
type(scope): subject
body (optional)
footer (optional)
Types:
feat- New featurefix- Bug fixdocs- Documentationstyle- Formattingrefactor- Code refactoringtest- Adding testschore- Maintenance
Examples:
feat(hooks): add useTransition hook
Implement useTransition hook for managing transition state.
Closes #123
fix(router): handle nested routes correctly
Fix issue where nested routes were not rendering properly.
Submitting PRs
Push your branch:
git push origin feature/my-feature
Create a Pull Request on GitHub
Fill in the PR template
Wait for review
Review Process
All PRs require:
At least one approval
All tests passing
No merge conflicts
Documentation updated
Reviewers will check:
Code quality
Test coverage
Documentation
Performance impact
Breaking changes
Release Process
Update version in
pyproject.tomlUpdate
CHANGELOG.mdCreate a release PR
Merge to main
Tag the release:
git tag v1.0.0 git push origin v1.0.0
GitHub Actions will publish to PyPI
Getting Help
GitHub Discussions: https://github.com/wanbnn/pyreact/discussions
Discord: https://discord.gg/pyreact
License
By contributing, you agree that your contributions will be licensed under the MIT License.
Thank You!
Your contributions make PyReact better for everyone. Thank you for your time and effort!
Next Steps
Installation - Install PyReact
Tutorial: Building a Todo App - Build a Todo app
Hooks API - Explore hooks