Development
CLI commands and development workflow
Prerequisites
- Python 3.12+
- uv package manager
Setup
# Clone the repository git clone https://github.com/your-org/psp.git cd psp # Install dependencies uv sync # Verify installation uv run psp --help
Running the Server
# Start the development server uv run psp # Server runs at http://localhost:8000 # API docs at http://localhost:8000/docs # Catalogue at http://localhost:8000/v1/catalogue
Testing
# Run all tests uv run pytest # Run with coverage uv run pytest --cov=src/psp --cov-report=term-missing # Run specific tests uv run pytest tests/components/todos/ -v # Run a single test uv run pytest tests/test_boundaries.py::test_no_cross_component_imports -v # Run tests matching a pattern uv run pytest -k "complete_task"
Linting
# Check for linting errors uv run ruff check src tests # Auto-fix linting errors uv run ruff check --fix src tests # Format code uv run ruff format src tests
Type Checking
# Run type checker uv run mypy src # Check specific module uv run mypy src/psp/components/todos
Full Quality Check
# Run all checks (lint, type check, test)
uv run ruff check src tests && \
uv run mypy src && \
uv run pytest
Project Structure
psp/ ├── src/ │ └── psp/ │ ├── __init__.py │ ├── main.py # Application entry point │ ├── components/ # Domain components │ │ ├── todos/ │ │ ├── budget/ │ │ └── catalogue/ │ ├── platform/ # Platform primitives │ │ ├── clock/ │ │ ├── eventbus/ │ │ ├── hooks/ │ │ ├── policy/ │ │ └── ... │ └── runtime/ # Runtime infrastructure │ ├── host.py │ └── module.py ├── tests/ │ ├── components/ │ └── platform/ ├── docs/ # This documentation ├── pyproject.toml └── uv.lock
Adding Dependencies
# Add a runtime dependency uv add some-package # Add a dev dependency uv add --dev some-dev-package # Update dependencies uv sync
Common Tasks
| Task | Command |
|---|---|
| Start server | uv run psp |
| Run tests | uv run pytest |
| Lint | uv run ruff check src tests |
| Format | uv run ruff format src tests |
| Type check | uv run mypy src |
| View API docs | http://localhost:8000/docs |
| View catalogue | http://localhost:8000/v1/catalogue |