Skip to content

Development

This page summarizes the local development workflow for MicroDCS, including environment setup, test execution, documentation work, and container packaging.

Environment Setup

MicroDCS targets Python 3.14 and uses uv for dependency management, virtual environment creation, and packaging.

# Install dependencies and create the local virtual environment
uv sync

Common Commands

Run the main unit test suite:

uv run pytest tests/ --ignore=tests/test_mqtt_integration.py --ignore=tests/test_msgpack_integration.py

Run test coverage:

uv run pytest --cov=microdcs --cov-report=term-missing tests/ --ignore=tests/test_mqtt_integration.py --ignore=tests/test_msgpack_integration.py

Run the example application:

# Requires a reachable MQTT broker and Redis server
uv run python -m app

Generate typed models from a JSON Schema file:

uv run microdcs dataclassgen dataclasses my-schema.schema.json

Generate models with advanced options (custom metadata, init fields, validation, and root-union workaround):

uv run microdcs dataclassgen dataclasses \
    --custom-metadata \
    --init-fields 'mystatus->MyStatus' \
    --validation \
    --collapse-root-workaround \
    my-schema.schema.json

Documentation

The documentation site is built with MkDocs Material.

# Start the local docs server
mkdocs serve

Container Build

The project ships with a distroless multi-stage Docker build.

docker build -t aschamberger/microdcs .

Main Libraries

The framework is built around a small set of core dependencies: