Skip to content

Contributing to FletX

Thank you for your interest in FletX! ๐ŸŽ‰ This comprehensive guide outlines how to contribute effectively.

๐Ÿ“‹ Table of Contents

  1. Getting Started
  2. Project Structure
  3. Development Workflow
  4. Code Conventions
  5. Testing & Quality
  6. Documentation
  7. Reporting Bugs
  8. Feature Proposals
  9. Code of Conduct

๐Ÿš€ Getting Started

Local Setup

  1. Clone the repository

    git clone https://github.com/AllDotPy/FletX.git
    cd FletX
    

  2. Set up virtual environment (Recommended: UV)

    pip install uv
    uv venv
    source venv/bin/activate  # Linux/Mac
    # or .\venv\Scripts\activate  # Windows
    

  3. Install dependencies

    uv pip install -e .[dev]  # Development mode
    

  4. 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

  1. Create a branch
    Branch from master with descriptive naming:

    git checkout -b feat/new-reactive-component
    

  2. Implement changes

  3. Keep commits atomic
  4. Document new features

  5. Run tests

    uv pip install -e .[test]
    pytest tests/
    

  6. Submit a Pull Request

  7. Clearly describe changes
  8. Reference related issues
  9. 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

  1. Check existing issues for duplicates
  2. Include:
  3. Steps to reproduce
  4. Expected vs actual behavior
  5. FletX/Python versions
  6. Minimal reproducible example

๐Ÿ’ก Feature Proposals

  1. Clearly describe the use case
  2. Suggest technical approach
  3. Outline potential impacts
  4. 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. ๐Ÿš€