Python
Overview
Python library for reading, writing and manipulating .duc CAD files — backed by SQLite.
Installation
or
How it works
A .duc file is a standard SQLite database. ducpy provides two complementary APIs
for working with these files:
| API | Best for |
|---|---|
| Builders | Constructing elements programmatically with type-safe Python classes |
| DucSQL | Raw SQL access — batch inserts, complex queries, schema introspection |
Builders API
Use the fluent builder DSL to create elements, then serialize to bytes or a .duc file.
SQL Builder API
For direct, low-level access to the SQLite schema:
Parsing an existing file
Package structure
| Module | Purpose |
|---|---|
builders | Fluent builders for elements, states, styles |
builders.sql_builder | DucSQL — raw SQLite access |
classes | Dataclass definitions for all duc entities |
enums | Integer enum constants matching the schema |
parse | parse_duc(), parse_duc_lazy(), get_external_file() |
serialize | serialize_duc() |
utils | Helper utilities |
Edit on GitHub
Last updated on