gldf-rs-python
Python bindings for the gldf-rs GLDF parsing library.
Overview
gldf-rs-python provides Python access to GLDF (General Lighting Data Format) file parsing and manipulation. It wraps the high-performance Rust gldf-rs library using PyO3/maturin.
GLDF files are ZIP containers containing product.xml definitions along with embedded images, photometry files (Eulumdat/IES), and L3D 3D models.
Learn more at: https://gldf.io
Installation
pip install gldf-rs-python
GLDF Viewer
Quick Start
import gldf_rs_python
# Load GLDF and convert to XML
xml = gldf_rs_python.gldf_to_xml('path/to/file.gldf')
# Load GLDF and convert to JSON
json = gldf_rs_python.gldf_to_json('path/to/file.gldf')
# Round-trip: JSON back to XML
xml2 = gldf_rs_python.xml_from_json(json)
assert xml == xml2 # True
Converting LDT/IES to GLDF
import gldf_rs_python
# Convert LDT to GLDF JSON
with open("luminaire.ldt", "rb") as f:
gldf_json = gldf_rs_python.ldt_to_gldf_json(f.read(), "luminaire.ldt")
# Convert LDT to GLDF file
with open("luminaire.ldt", "rb") as f:
gldf_bytes = gldf_rs_python.ldt_to_gldf_bytes(f.read(), "luminaire.ldt")
with open("luminaire.gldf", "wb") as out:
out.write(gldf_bytes)
# Works with IES files too
with open("luminaire.ies", "rb") as f:
gldf_json = gldf_rs_python.ldt_to_gldf_json(f.read(), "luminaire.ies")
Working with GLDF Bytes
import gldf_rs_python
# Load GLDF from bytes (useful for web apps, streaming)
with open("product.gldf", "rb") as f:
json_data = gldf_rs_python.gldf_from_bytes(f.read())
# Export GLDF JSON back to bytes
gldf_bytes = gldf_rs_python.gldf_json_to_bytes(json_data)
API Reference
| Function | Description |
|---|---|
gldf_to_xml(path) |
Load GLDF file and convert to XML string |
gldf_to_json(path) |
Load GLDF file and convert to JSON string |
json_from_xml_str(xml_str) |
Parse XML string to JSON |
xml_from_json(json_str) |
Parse JSON string to XML |
gldf_from_bytes(data) |
Load GLDF from bytes and return JSON |
ldt_to_gldf_json(data, filename) |
Convert LDT/IES to GLDF JSON |
ldt_to_gldf_bytes(data, filename) |
Convert LDT/IES to GLDF bytes (ZIP) |
gldf_json_to_bytes(json_str) |
Export GLDF JSON to bytes (ZIP) |
Development
# Create virtual environment
python -m venv .venv
source .venv/bin/activate
# Install maturin
pip install maturin
# Build and install in development mode
maturin develop
# Build release wheel
maturin build --release
Live Demo
Try the WASM-based GLDF viewer at: https://gldf.icu
Related Crates
| Crate | Description |
|---|---|
| gldf-rs | Core Rust library |
| gldf-rs-wasm | WebAssembly viewer application |
| l3d-rs | L3D 3D model format parsing |
| eulumdat | Eulumdat/LDT photometry parsing |
Release Notes
0.3.3
- New:
ldt_to_gldf_json()- Convert LDT/IES photometry to GLDF JSON - New:
ldt_to_gldf_bytes()- Convert LDT/IES photometry to GLDF bytes (ZIP) - New:
gldf_from_bytes()- Load GLDF from bytes and return JSON - New:
gldf_json_to_bytes()- Export GLDF JSON to bytes (ZIP) - Improved error handling with proper
PyValueErrorexceptions - Added
eulumdatfeature for LDT/IES conversion support
0.3.1
- Updated to gldf-rs 0.3.1 with quick-xml parser
- Part of gldf-rs monorepo restructure
0.2.0
- Support for URL file types
- Support for BOM-encoded UTF8 product.xml
License
MIT License
Metadata
Release files for gldf-rs-python 0.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| gldf_rs_python-0.4.0.tar.gz | 191.1 kB | Details |
Built distributions (wheels)
| File | Reset | |||
|---|---|---|---|---|
| gldf_rs_python-0.4.0-cp38-abi3-win_amd64.whl | CPython 3.8 | abi3 | Windows x86-64 | Details |
| gldf_rs_python-0.4.0-cp38-abi3-musllinux_1_2_x86_64.whl | CPython 3.8 | abi3 | Linux musl 1.2+ x86-64 | Details |
| gldf_rs_python-0.4.0-cp38-abi3-musllinux_1_2_aarch64.whl | CPython 3.8 | abi3 | Linux musl 1.2+ ARM64 | Details |
| gldf_rs_python-0.4.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ x86-64 | Details |
| gldf_rs_python-0.4.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl | CPython 3.8 | abi3 | Linux glibc 2.17+ ARM64 | Details |
| gldf_rs_python-0.4.0-cp38-abi3-macosx_11_0_arm64.whl | CPython 3.8 | abi3 | macOS 11.0+ ARM64 | Details |
| gldf_rs_python-0.4.0-cp38-abi3-macosx_10_12_x86_64.whl | CPython 3.8 | abi3 | macOS 10.12+ x86-64 | Details |
Total release size: 15.1 MB
Release files / gldf_rs_python-0.4.0.tar.gz
| Download URL | gldf_rs_python-0.4.0.tar.gz |
|---|---|
| Size | 191.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
93bcf2fd9fec466cc0c9a069de207e40be9826235f31f2168d08613a0edf48e2
|
|
BLAKE2b-256 checksum How to use checksums |
01acdf9f770fc8119dcf3d60f2677fef5743e3c24b3bb65901eafeade8a65d5c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 18, 2026.
Transparency logRelease files / gldf_rs_python-0.4.0-cp38-abi3-win_amd64.whl
| Download URL | gldf_rs_python-0.4.0-cp38-abi3-win_amd64.whl |
|---|---|
| Size | 1.8 MB |
| Tags | CPython 3.8 Windows x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
59199f3066c0251a563d887f3b377376676b370178544aad3db7b20353bb3d80
|
|
BLAKE2b-256 checksum How to use checksums |
068e7460c48a71029c3756b7d93538c26b2c21d5e00ac835d9b511b0b21a0b48
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 18, 2026.
Transparency logRelease files / gldf_rs_python-0.4.0-cp38-abi3-musllinux_1_2_x86_64.whl
| Download URL | gldf_rs_python-0.4.0-cp38-abi3-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 2.4 MB |
| Tags | CPython 3.8 Linux musl 1.2+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
34dc310eb8ffc3a08e8e84bf1958754b61ecc1662806f093f678e1a422fef9b4
|
|
BLAKE2b-256 checksum How to use checksums |
226201035ed10e92baa4cc2fc0e29518494f6295c89d513c74f1194917dbf451
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 18, 2026.
Transparency logRelease files / gldf_rs_python-0.4.0-cp38-abi3-musllinux_1_2_aarch64.whl
| Download URL | gldf_rs_python-0.4.0-cp38-abi3-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 2.3 MB |
| Tags | CPython 3.8 Linux musl 1.2+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
fc99a7e19fac31321e2d6ad9745b7a94e6a07766cc259ac130f1e6037941932e
|
|
BLAKE2b-256 checksum How to use checksums |
231dc5115a33e41e7d7f3fbcdadce14b35a38821ca06f3eab003486889116a0a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 18, 2026.
Transparency logRelease files / gldf_rs_python-0.4.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
| Download URL | gldf_rs_python-0.4.0-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl |
|---|---|
| Size | 2.2 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ x86-64 abi3 |
|
SHA-256 checksum How to use checksums |
502f6690b0ceffba79b057ce278ded5cd2b5ec69271c6c2db9fc46ae7389a1c4
|
|
BLAKE2b-256 checksum How to use checksums |
baabdec49f0489155d4521477727eaf06315167c198dffa08661cde319491a76
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 18, 2026.
Transparency logRelease files / gldf_rs_python-0.4.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
| Download URL | gldf_rs_python-0.4.0-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl |
|---|---|
| Size | 2.1 MB |
| Tags | CPython 3.8 Linux glibc 2.17+ ARM64 abi3 |
|
SHA-256 checksum How to use checksums |
02502b75214700e7e7a38b80f8b77038e31ae529f838f83c63fc1c09f7eae894
|
|
BLAKE2b-256 checksum How to use checksums |
19a9ea1999a2001717c2213e49ab7acdb16e5bf28a07d3d5c1745d2bcde984c0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 18, 2026.
Transparency logRelease files / gldf_rs_python-0.4.0-cp38-abi3-macosx_11_0_arm64.whl
| Download URL | gldf_rs_python-0.4.0-cp38-abi3-macosx_11_0_arm64.whl |
|---|---|
| Size | 1.9 MB |
| Tags | CPython 3.8 abi3 macOS 11.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
dbd4a6583e4f102306fec57dce9d2cd3e7c5291a434d133e65bc2ef5712f1246
|
|
BLAKE2b-256 checksum How to use checksums |
0fb072ac4be86e2c3d5180282fff791298b084732df81bae412ec24e7423c0b9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 18, 2026.
Transparency logRelease files / gldf_rs_python-0.4.0-cp38-abi3-macosx_10_12_x86_64.whl
| Download URL | gldf_rs_python-0.4.0-cp38-abi3-macosx_10_12_x86_64.whl |
|---|---|
| Size | 2.0 MB |
| Tags | CPython 3.8 abi3 macOS 10.12+ x86-64 |
|
SHA-256 checksum How to use checksums |
cf6404f703a7fd4f8e1a7d3cc92b5dfc69d67a01bdb6755c15519ddd92a2e886
|
|
BLAKE2b-256 checksum How to use checksums |
5881f026cec2376f00e69a21c4ebac4c972f524415914dfe16d4abb276890534
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on May 18, 2026.
Transparency log