Architecture

dcclib is organised as a uv-managed monorepo with a shared core library and two optional packages built on top of it.

Packages

dcclib/                         ← repo root
├── src/dcclib/                 ← core library
├── packages/dcclib-cli/        ← command-line interface
└── packages/dcclib-rest-api/   ← REST API server

All three packages share the same version number and are published independently to the GitLab Package Registry.


Core library: dcclib

Abstract interfaces

Every major subsystem is expressed as a pair of abstract base classes so that callers work against a stable contract regardless of which concrete implementation is chosen.

Interface Module Methods
Constructible dcclib.constructible from_tree(), from_file(), from_str()
Validatable dcclib.validation.validatable validate_tree(), validate_file(), validate_str()
Convertible dcclib.conversion.convertible convert()
Transformable dcclib.transformation.transformable transform()
Extractable dcclib.extraction.extractable extract()

When adding new functionality, implement the appropriate interface(s) to stay consistent with the rest of the library.


CLI: dcclib-cli

The CLI is built with Click and organised as a tree of click.Group / click.Command objects:

cli (DccCLI group)
├── convert
│   └── to-json
├── extract
│   ├── files
│   └── formulae
├── signature
│   ├── sign
│   └── verify
├── transform
│   └── xslt
└── validate
    ├── all   (default)
    ├── schematron
    └── xsd

Output formatting is handled by pluggable formatter classes (plain, table, JSON, JUnit XML), selected via the --format flag available on most commands.


REST API: dcclib-rest-api

The REST API is built with APIFlask and mirrors the CLI's command structure as HTTP endpoints. It provides an OpenAPI spec at /docs and a JSON info endpoint at /.

Blueprints registered by the application:

Blueprint Endpoints
dccs Upload / retrieve DCC files
validate XSD and Schematron validation
convert XML → JSON conversion
transform XSLT transformation
extract.files Embedded file extraction
extract.formulae Formula extraction and evaluation
signature Sign / verify XML signatures