Contributing to FletX¶
Thank you for your interest in FletX! ๐ This comprehensive guide outlines how to contribute effectively.
๐ Table of Contents¶
- Getting Started
- Project Structure
- Development Workflow
- Code Conventions
- Testing & Quality
- Documentation
- Reporting Bugs
- Feature Proposals
- Code of Conduct
๐ Getting Started¶
Local Setup¶
-
Clone the repository
git clone https://github.com/AllDotPy/FletX.git cd FletX
-
Set up virtual environment (Recommended: UV)
pip install uv uv venv source venv/bin/activate # Linux/Mac # or .\venv\Scripts\activate # Windows
-
Install dependencies
uv pip install -e .[dev] # Development mode
-
Verify installation
pytest tests/
๐ Project Structure¶
.
โโโ CONTRIBUTING.md
โโโ LICENSE
โโโ README.md
โโโ architecture.svg
โโโ docs/
โโโ examples/
โโโ fletx
โย ย โโโ __init__.py
โย ย โโโ app.py
โย ย โโโ core
โย ย โย ย โโโ __init__.py
โย ย โย ย โโโ controller.py
โย ย โย ย โโโ di.py
โย ย โย ย โโโ effects.py
โย ย โย ย โโโ factory.py
โย ย โย ย โโโ navigation
โย ย โย ย โย ย โโโ guards.py
โย ย โย ย โย ย โโโ middleware.py
โย ย โย ย โย ย โโโ transitions.py
โย ย โย ย โโโ observer.py
โย ย โย ย โโโ page.py
โย ย โย ย โโโ route_config.py
โย ย โย ย โโโ router.py
โย ย โย ย โโโ state.py
โย ย โย ย โโโ types.py
โย ย โย ย โโโ widget.py
โย ย โโโ decorators
โย ย โย ย โโโ controllers.py
โย ย โย ย โโโ reactive.py
โย ย โย ย โโโ route.py
โย ย โโโ utils
โย ย โย ย โโโ __init__.py
โย ย โย ย โโโ context.py
โย ย โย ย โโโ exceptions.py
โย ย โย ย โโโ logger.py
โย ย โโโ widgets
โย ย โโโ __init__.py
โย ย โโโ text.py
โโโ main.py
โโโ pyproject.toml
โโโ setup.py
๐ Development Workflow¶
-
Create a branch
Branch frommaster
with descriptive naming:git checkout -b feat/new-reactive-component
-
Implement changes
- Keep commits atomic
-
Document new features
-
Run tests
uv pip install -e .[test] pytest tests/
-
Submit a Pull Request
- Clearly describe changes
- Reference related issues
- Address code review feedback
โจ Code Conventions¶
Style Guide¶
- Follow PEP 8 (88 chars max line length)
- Type hints for all public functions
- Google-style docstrings for key modules
Reactivity Pattern¶
# Good
class ReactiveButton(ft.ElevatedButton, FletXWidget):
""" My Reactive Button which.... """
def __init__(self, text: RxStr, **kwargs):
super().__init__(**kwargs)
# Create a reactive object
self.rx_text: RxStr = RxStr('')
# And bind it to self (@ft.ElevatedButton) text attribute
self.bind('text', self.rx_text)
Widget Standards¶
- Prefix reactive widgets with
Reactive
- Isolate state logic in dedicated classes
๐งช Testing & Quality¶
Running Tests¶
pytest tests/ --cov=fletx --cov-report=html
Quality Standards¶
- Maintain >90% code coverage
- All new widgets require:
- Unit tests
- Functional example
- Documentation
๐ Documentation¶
Writing Docs¶
class ReactiveText(ft.Text, FletXWidget):
"""Text widget with reactive value binding.
Args:
value: RxStr to bind to text value
color: RxStr for text color (optional)
"""
Building Documentation¶
cd docs/
make html
๐ Reporting Bugs¶
- Check existing issues for duplicates
- Include:
- Steps to reproduce
- Expected vs actual behavior
- FletX/Python versions
- Minimal reproducible example
๐ก Feature Proposals¶
- Clearly describe the use case
- Suggest technical approach
- Outline potential impacts
- Attach mockups if applicable
๐ค Code of Conduct¶
We adhere to the Contributor Covenant Code of Conduct. By participating: - Be kind and open-minded - Respect differing viewpoints - Assume good faith
Thank you for helping build FletX! Together we're creating the best reactive framework for Flet. ๐