Skip to main content

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.

Used for example by BlenderDMX.

Source code

PyPi page

Pytest

Check links in markdown

Installation

pip install pygdtf

To install latest version from this git repository, run pip:

python -m pip install https://codeload.github.com/open-stage/python-gdtf/zip/refs/heads/master

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")

# get info about DMX Modes:
pygdtf.utils.get_dmx_modes_info(gdtf_fixture)

[{'mode_id': 0,
  'mode_name': 'Default',
  'mode_dmx_channel_count': 5,
  'mode_virtual_channel_count': 0}]

# get list of DMX channels with geometries, channels functions
pygdtf.utils.get_dmx_channels(gdtf_fixture, "Default")

[[{'dmx': 1,
  'id': 'Dimmer',
  'default': 0,
  'geometry': 'Beam',
  'break': 1,
  'channel_functions': [<pygdtf.ChannelFunction at 0x7f122435c8b0>]}]

#you can get the full info with chanells and with channel functions at once:
pygdtf.utils.get_dmx_modes_info(f, include_channels=True, include_channel_functions=True)

See BlenderDMX and tests for reference implementation and usage examples.

Usage principles

  • for list of channels, use pygdtf.utils.get_dmx_channels as per example above, do not presume that plain layout of DMX Channels in a DMX Mode is defining the DMX footprint of the device. Geometry references are (frequently) used to re-use parts of the device. This means that a channel(s) defined once can be multiplied, over several times duplicated geometry (tree).

  • do not use geometry names for anything related to function of the geometry (yoke, pan, tilt, head), use attached GDTF attributes ("Pan", "Tilt") to know what functions should the geometry perform

Status

  • Many GDTF 1.2 features have been implemented
  • Some GDTF 1.1 features have been kept in

Development

PRs appreciated.

Typing

  • We try to type the main library as well as the utils module, to test run:
mypy pygdtf/**py  --pretty

Format

Testing

  • to test, run: pytest
  • to test typing with mypy run pytest:
pytest --mypy -m mypy pygdtf/**py

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pygdtf-1.0.5.dev8-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file pygdtf-1.0.5.dev8-py3-none-any.whl.

File metadata

File hashes

Hashes for pygdtf-1.0.5.dev8-py3-none-any.whl
Algorithm Hash digest
SHA256 ce39eeee5c43e55398242be35e5ae68eb8a5e01f05aa43dac4e2e9e3f1cdca90
MD5 61752cf4307a9324e9c47cd45106a469
BLAKE2b-256 ca935360167383d28cdd8dd2e26a217fffd40330bb35f8bdde17a445573b9fa7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page