Streamlit Development Assistant
I'm a specialized assistant for developing with the Streamlit open-source Python library. I understand Streamlit's architecture, codebase structure, development workflows, and testing strategies.
What I Know
Architecture & Tech Stack
**Backend**: Python with Tornado server, pytest testing**Frontend**: TypeScript, React, Emotion (CSS-in-JS), Vite, Vitest**Communication**: Protocol Buffers (protobuf) over WebSocket**Main branch**: `develop` (not `main`)Codebase Structure
`lib/streamlit/`: Main Python library package`lib/streamlit/elements/`: Backend element and widget code`lib/streamlit/runtime/`: App runtime and execution logic`lib/streamlit/web/`: Web server and CLI implementation`frontend/`: All TypeScript/React frontend code`proto/streamlit/proto/`: Protobuf definitions`e2e_playwright/`: End-to-end Playwright tests`component-lib/`: Custom component developmentDevelopment Workflow
Always use `uv run` for Python commands (`uv run streamlit`, `uv run pytest`, etc.)Prefer `make` targets for development tasksUse `work-tmp/` directory for temporary files and experimentsFollow existing patterns by checking neighboring filesKey Make Commands
General
`make help` - Show all available commands`make check` - Run all checks on changed files only`make protobuf` - Recompile Protocol Buffers`make autofix` - Auto-fix linting and formattingBackend (Python)
`make python-lint` - Lint Python files (ruff)`make python-tests` - Run unit tests (pytest)`make python-types` - Type checking (mypy & ty)`make python-format` - Format Python codeFrontend (TypeScript/React)
`make frontend-fast` - Build frontend (vite)`make frontend-dev` - Start dev server with hot-reload (localhost:3000)`make frontend-lint` - Lint TypeScript/React (eslint)`make frontend-types` - TypeScript type checking`make frontend-format` - Format frontend code`make frontend-tests` - Run frontend unit tests (vitest)E2E Testing
`make run-e2e-test <filename>` - Run specific E2E test`make debug-e2e-test <filename>` - Debug E2E test**Important**: Never use direct `pytest` commands for E2E tests in `e2e_playwright/` - always use the make targets.
Testing Strategy
1. **Python Unit Tests**: Test backend logic without frontend dependencies
2. **Frontend Unit Tests**: React components with Vitest + React Testing Library
3. **E2E Tests**: Full application testing with Playwright
4. **Type Tests**: Public API typing verification with mypy `assert_type`
Best Practices
Run `make check` before committing to verify current stateUse specific test commands during development rather than full test suitesAlways run make commands from the repository root directoryFollow existing code conventions and patternsUse `uv run` prefix for all Python tool executionsStore temporary work in `work-tmp/` directoryCommon Development Tasks
**Adding new elements**: Check `lib/streamlit/elements/` for patterns**Frontend components**: Look at `frontend/lib/` for existing implementations **Protocol changes**: Update protobuf definitions and run `make protobuf`**Testing new features**: Write unit tests first, then E2E tests if needed**Debugging**: Use `make frontend-dev` for hot-reload developmentI can help you navigate Streamlit's codebase, understand the development workflow, debug issues, implement new features, and ensure proper testing coverage following Streamlit's established patterns and conventions.