General Device Type Format (GDTF) library for Python
Project description
python-gdtf
Python library for General Device Type Format
GDTF specification as per https://gdtf.eu/gdtf/prologue/introduction/
See source code for documentation. Naming conventions, in general, are identical to that on the GDTF, CamelCase is replaced with underscore_delimiters.
Credits
Originally created by Jack Page. Friendly forked to Open-Stage by vanous. We continue publishing to pypi under the same pygdtf name with Jack's permission.
This library is used for example by BlenderDMX (BlenderDMX on GitHub).
Important changes when updating from 1.0
⚠️ List of DMX Channels provided by dmx_mode.dmx_channels is now a complete list of all DMX channels calculated by obtaining DMX channels for geometries, Geometry References and so on, no need to use the .utils methods anymore.
⚠️ The list of channels as dictionaries can be obtained by dmx_mode.dmx_channels.as_dicts(), the "id" has been renamed to "attribute". DMX Channel now contains Logical Channels and then Channel Functions. The as_dict() is now also in dmx_modes, dmx_mode, dmx_channels and so on.
⚠️ Many of the .utils package methods have been moved directly to the main part of pygdtf. External usage of methods from .utils should not be needed anymore.
See CHANGELOG for details.
Status
- Reading of most aspects of GDTF 1.2 (DIN SPEC 15800:2022-02) should be covered.
- Writing is currently not implemented.
Installation
- With uv:
uv add pygdtf
- With pip
pip install pygdtf
Latest development version (if exists on pypi.org)
uv add pygdtf --pre
Usage
# import
import pygdtf
# parse a GDTF file
gdtf_fixture = pygdtf.FixtureType("BlenderDMX@LED_PAR_64_RGBW@v0.3.gdtf")
# one can also parse just a description.xml file during development or testing
gdtf_fixture = pygdtf.FixtureType(dsc_file="description.xml")
# now access things like DMX modes, channels and so on
# get DMX Mode name
gdtf_fixture.dmx_modes[0].name
'Mode 1 - Standard 16 - bit'
# get total number of DMX channels
gdtf_fixture.dmx_modes[0].dmx_channels_count
39
# get number of Virtual channels
gdtf_fixture.dmx_modes[0].virtual_channels_count
0
# get DMX breaks and DMX channels count:
gdtf_fixture.dmx_modes[0].dmx_breaks[0].dmx_break
1
gdtf_fixture.dmx_modes[0].dmx_breaks[0].channels_count
39
# get DMX channels as objects gdtf_fixture.dmx_modes[0].dmx_channels
<pygdtf.DmxChannel object at 0x7f789c63bb60>, <pygdtf.DmxChannel object at
0x7f789c375590>, <pygdtf.DmxChannel object at 0x7f789c375a90>,...
# get DMX channels as dict
gdtf_fixture.dmx_modes[0].dmx_channels.as_dict()
[[{'dmx': 1, 'offset': [1, 2], 'id': 'Pan', 'default': 128, 'highlight': None,
'geometry': 'Yoke', 'break': 1, 'parent_name': 'Base', 'channel_functions':
[{'name': 'Pan', 'attribute': 'Pan', 'dmx_from': 0, 'dmx_to': 255, 'default':
128, 'real_fade': 1.833, 'physical_to': 270.0, 'physical_from': -270.0,
'channel_sets': ['', 'Center', '']}, ...
# see the source code for more methods
See BlenderDMX and tests for reference implementation and usage examples.
Development
PRs appreciated. You can use uv to get the project setup by running:
uv sync
Format
- To format, use ruff
uv run ruff format pygdtf/*
Pre-commit hooks
- You can use the pre-commit hooks
uv run pre-commit install
Testing
- To test, use pytest
uv run pytest
- To test typing with mypy use:
uv run pytest --mypy -m mypy pygdtf/*py
Citation
If you use this library in your research, publication, or software project, please cite it as follows:
@software{pygdtf2025,
title = {pyGDTF: Python Library for General Device Type Format},
author = {{OpenStage}},
year = {2025},
version = {1.3.0},
url = {https://github.com/open-stage/python-gdtf}
}
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pygdtf-1.3.1-py3-none-any.whl.
File metadata
- Download URL: pygdtf-1.3.1-py3-none-any.whl
- Upload date:
- Size: 33.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d80e62f9cce6519453fc1814bc87b49b4b788c27804cbf0c09a2f5eb3699d7bf
|
|
| MD5 |
8c38479e45f99313eda673f0cdfb43da
|
|
| BLAKE2b-256 |
db9f1c164bc7373eb0deb6d174fed36c57caabc0abdf7013606c8c54dde5482e
|