Development¶
Commands and workflows for developing with Reflex.
๐ ๏ธ Development Commands¶
๐งช Testing¶
Running Tests Locally¶
Test Fixtures¶
Tests use mock fixtures from tests/conftest.py:
def test_something(mock_store, mock_deps):
# mock_store: AsyncMock with publish/subscribe/ack/nack
# mock_deps: ReflexDeps with all mocked dependencies
pass
Integration tests use real fixtures:
@pytest.mark.asyncio
async def test_integration(store, real_deps):
# store: Real EventStore connected to PostgreSQL
# real_deps: ReflexDeps with real dependencies
pass
โ Code Quality¶
make lint # ruff check
make lint-fix # Auto-fix lint issues
make format # ruff format
make type-check # pyright
make ci # Run full CI pipeline locally
CI Pipeline¶
The make ci command runs the same checks as GitHub Actions:
- Lint check (
ruff check) - Format check (
ruff format --check) - Type check (
pyright) - Tests (
pytest)
๐ Code Style¶
Style Guidelines
- Python 3.11+
- Strict pyright type checking
- ruff for linting (includes async, security, bugbear rules)
- Line length: 100 characters
Import Conventions¶
from __future__ import annotations
from typing import TYPE_CHECKING
if TYPE_CHECKING:
# Type-only imports to avoid circular dependencies
from reflex.core.deps import ReflexDeps