π Flowerfy Development Guide
Modern Development Setup (2025)
This project uses modern Python development tools for code quality and consistency.
π οΈ Development Tools
Ruff - The Modern Python Linter & Formatter
- Ultra-fast linting and formatting (written in Rust)
- Replaces multiple tools: flake8, black, isort, pyupgrade
- Industry standard for Python development in 2025
MyPy - Static Type Checking
- Gradual typing support
- Catches type-related bugs early
Pre-commit - Automated Code Quality
- Runs checks automatically before commits
- Ensures consistent code quality
π§ Quick Start
Install development dependencies:
uv add --dev ruff mypy pre-commit
Setup pre-commit hooks:
uv run pre-commit install
Format and lint code:
# Format all Python files uv run ruff format . # Lint and fix issues uv run ruff check --fix . # Type checking uv run mypy .
π Code Quality Commands
Use the Makefile or direct commands:
# Using Makefile (recommended)
make format # Format code
make lint # Lint and fix
make quality # All checks
# Or direct commands
uv run ruff format .
uv run ruff check --fix .
βοΈ Configuration
All tool configurations are in pyproject.toml
:
- Ruff: Modern linting rules, import sorting, code formatting
- MyPy: Type checking with gradual typing
- Pre-commit: Automated hooks for code quality
π― Code Standards
- Line length: 88 characters (Black compatibility)
- Import sorting: Automatic with ruff
- String quotes: Double quotes preferred
- Python version: 3.13+ with modern features
- Type hints: Gradual adoption encouraged
π Workflow
- Write code with your favorite editor
- Pre-commit hooks run automatically on commit
- CI/CD can run the same tools for consistency
- Manual checks available via provided scripts
π Benefits
- 10-100x faster than traditional tools (flake8, black)
- Single tool replaces multiple dependencies
- Modern Python features and best practices
- Consistent formatting across the entire codebase
- Automated quality checks prevent issues
π Resources
πΈ Project Architecture
FLUX.1 Image Generation
- Model: black-forest-labs/FLUX.1-schnell
- Quality: Superior to SDXL-Turbo
- Features: Better text rendering, improved accuracy
ConvNeXt Classification
- Model: facebook/convnext-tiny-224
- Fallback: openai/clip-vit-base-patch32
- Performance: Optimized for flower identification
Modular Structure
src/
βββ core/ # Configuration and constants
βββ services/ # Business logic (models, training)
βββ ui/ # Gradio interface components
βββ utils/ # Utility functions
βββ training/ # Training implementations
Happy coding! π¨