Python project to set up a connection towards Axis Communications devices and to subscribe to specific events on the metadatastream.
uv is required for development setup:
uv python install 3.14
uv sync --python 3.14 --all-extrasOr run the bootstrap script, which installs uv if needed and provisions Python 3.14 automatically:
./setup.shDependencies are locked via uv.lock. Regenerate lock data when dependency inputs change:
uv lockRun checks with uv:
uv run ruff check .
uv run ruff format --check .
uv run mypy axis
uv run pytestInitial ty support is configured as an opt-in check and does not replace mypy:
uvx ty checkVapix initialization is phase-based and driven by handler metadata:
API_DISCOVERY: handlers initialized after API discovery.PARAM_CGI_FALLBACK: handlers that may initialize from parameter support when not listed in discovery.APPLICATION: handlers initialized after applications are loaded.
Handlers declare phase membership through handler_groups and may customize phase eligibility through should_initialize_in_group.
Vapix.api_request() is the single typed request entrypoint.
- Request models declare their decode contract with
ApiRequest[ResponseT]. - Every
ApiRequestsubclass must setresponse_typeexplicitly. - Decoded/read requests use their concrete response model as
response_type. - Write-style requests use
BytesResponseasresponse_type.
Examples:
@dataclass
class ListApisRequest(ApiRequest[GetAllApisResponse]):
response_type = GetAllApisResponse
@dataclass
class SetPortsRequest(ApiRequest[ApiResponse[bytes]]):
response_type = BytesResponseHandler methods may unwrap .data when they intentionally preserve a bytes-returning boundary.
Example fallback policy:
LightHandlerparticipates in bothAPI_DISCOVERYandPARAM_CGI_FALLBACK.- In
PARAM_CGI_FALLBACK, it initializes only when not listed in API discovery and listed in parameters.
EventInstance keeps name as the raw device-provided NiceName value.
EventInstance.source and EventInstance.data are typed containers (EventInstanceSource and EventInstanceData) built from SimpleItemInstance payloads.
For compatibility with integrations that still need the historical raw payload shape, EventInstance also exposes:
raw_source: returns{}or a dict or a list of dicts.raw_data: returns{}or a dict or a list of dicts.