This document provides essential information for agentic coding assistants.
Agents must NEVER COMMIT changes, unless explicitly requested by the user.
Agents must NEVER PUSH changes.
# Install/update dependencies
uv sync
# Type checking
uv run ty check
# Linting (auto-fixes issues)
uv run ruff check --fix
# Format code
uv run ruff format
# Run all tests
uv run pytest
# Run tests in a specific file
uv run pytest test/test_model.py
# Run a specific test function
uv run pytest test/test_model.py::test_attitude
# Run tests matching a pattern
uv run pytest -k "test_uavstatus"
# Run tests with coverage
uv run pytest --cov=src/flockwave/server- Group imports: standard library → third-party → local imports
- Use absolute imports from the
flockwavepackage - Use
TYPE_CHECKINGblock for type-only imports
- Use modern union syntax with
|(e.g.,int | None,str | list[str]) - Use
TypedDictfor structured data with known fields - Define type aliases for complex types
- Use
TypeVarwithbound=for generic types (e.g.,T = TypeVar("T", bound="UAVDriver")) - Classes: PascalCase (
CommandExecutionManager,UAVStatusInfo) - Functions/Methods/Variables: snake_case (
get_cache_dir,charging) - Constants: UPPER_SNAKE_CASE (
PACKAGE_NAME) - Private members: Leading underscore (
_driver,_voltage)
- Use properties with getters/setters for validation and conversion
- Store internal values with leading underscore
- Include
json()methodjsonproperty for serialization
- Create custom exceptions inheriting from
FlockwaveError(insrc/flockwave/server/errors.py) - Use
NotSupportedErrorfor unimplemented operations - Use
CommandInvocationErrorfor user command errors - Provide default error messages in constructors
- Use
triofor async operations (notasyncio) - Use
async/awaitfor I/O operations - Use
AsyncGeneratorfor data streams - Import from
trioandtrio_util
- Use Google-style docstrings with
Args:,Returns:, andRaises:sections if applicable - Add module-level docstrings
- Mark features with
@versionaddedor@deprecateddecorators
- Use descriptive module-level docstrings
- Keep related classes/functions in the same file
- Use hierarchical loggers:
log = base_log.getChild("submodule") - Import base logger from
flockwave.server.logger
- Tests in
test/directory - Test functions named with
test_prefix - Use descriptive test names
src/flockwave/server/- main server codesrc/flockwave/server/ext/- extension modulessrc/flockwave/server/model/- data model classessrc/flockwave/server/utils/- utility functionstest/- tests mirroring source structure