Python bindings for GLDF (General Lighting Data Format) parsing library
Project description
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
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
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 gldf_rs_python-0.3.3.tar.gz.
File metadata
- Download URL: gldf_rs_python-0.3.3.tar.gz
- Upload date:
- Size: 101.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c1f2bce4a4d3db6f1f45324f5c661519adf58c8ffb63ff06ebcce164a6a24f3f
|
|
| MD5 |
1b865fdd418a568eca5498184d8610c1
|
|
| BLAKE2b-256 |
6c84c46c9de3e15256dc35ec60855404cce37b836b0f15a8c2da5d5202d84fdf
|
Provenance
The following attestation bundles were made for gldf_rs_python-0.3.3.tar.gz:
Publisher:
python-publish.yml on holg/gldf-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gldf_rs_python-0.3.3.tar.gz -
Subject digest:
c1f2bce4a4d3db6f1f45324f5c661519adf58c8ffb63ff06ebcce164a6a24f3f - Sigstore transparency entry: 767448891
- Sigstore integration time:
-
Permalink:
holg/gldf-rs@89455c18067ac934b916764ac82831893fb1ee42 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/holg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@89455c18067ac934b916764ac82831893fb1ee42 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gldf_rs_python-0.3.3-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: gldf_rs_python-0.3.3-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 2.1 MB
- Tags: PyPy, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7448c978b7b6721f4e483790db44972c0361973e1d3b01efa7b2cbb0f2f312fb
|
|
| MD5 |
0b904d9480d6a81d271bf63834b0e5e7
|
|
| BLAKE2b-256 |
c8e51bdb81cffcdb0788ac7569465a807ac64acba51b101313fc7e7db81c91c9
|
Provenance
The following attestation bundles were made for gldf_rs_python-0.3.3-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
python-publish.yml on holg/gldf-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gldf_rs_python-0.3.3-pp310-pypy310_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
7448c978b7b6721f4e483790db44972c0361973e1d3b01efa7b2cbb0f2f312fb - Sigstore transparency entry: 767448899
- Sigstore integration time:
-
Permalink:
holg/gldf-rs@89455c18067ac934b916764ac82831893fb1ee42 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/holg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@89455c18067ac934b916764ac82831893fb1ee42 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gldf_rs_python-0.3.3-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: gldf_rs_python-0.3.3-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 2.1 MB
- Tags: PyPy, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ab8bdb795a8285c5588d5d3f3a0919d8fc9dfbd38eaa740fe55c81c4c1992618
|
|
| MD5 |
df95a8af66a4c7e1b23a5278f98bb7da
|
|
| BLAKE2b-256 |
370d2638a193e67cb350665c6b4db2e7be3e9d820a57d20ce6da5419bf814dd1
|
Provenance
The following attestation bundles were made for gldf_rs_python-0.3.3-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
python-publish.yml on holg/gldf-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gldf_rs_python-0.3.3-pp39-pypy39_pp73-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
ab8bdb795a8285c5588d5d3f3a0919d8fc9dfbd38eaa740fe55c81c4c1992618 - Sigstore transparency entry: 767448893
- Sigstore integration time:
-
Permalink:
holg/gldf-rs@89455c18067ac934b916764ac82831893fb1ee42 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/holg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@89455c18067ac934b916764ac82831893fb1ee42 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gldf_rs_python-0.3.3-cp38-abi3-win_amd64.whl.
File metadata
- Download URL: gldf_rs_python-0.3.3-cp38-abi3-win_amd64.whl
- Upload date:
- Size: 1.8 MB
- Tags: CPython 3.8+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
51cfeb9b9666ec7bdc6296783502aa07b7ca6a1a38d46831bf42eddd4c801923
|
|
| MD5 |
c1afecdcd8f5ffff14b9159daeffe0ed
|
|
| BLAKE2b-256 |
92ad218725535e4ac7ddf6e91235757d381195dc875dcbc38874eb1011932956
|
Provenance
The following attestation bundles were made for gldf_rs_python-0.3.3-cp38-abi3-win_amd64.whl:
Publisher:
python-publish.yml on holg/gldf-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gldf_rs_python-0.3.3-cp38-abi3-win_amd64.whl -
Subject digest:
51cfeb9b9666ec7bdc6296783502aa07b7ca6a1a38d46831bf42eddd4c801923 - Sigstore transparency entry: 767448904
- Sigstore integration time:
-
Permalink:
holg/gldf-rs@89455c18067ac934b916764ac82831893fb1ee42 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/holg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@89455c18067ac934b916764ac82831893fb1ee42 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gldf_rs_python-0.3.3-cp38-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: gldf_rs_python-0.3.3-cp38-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 2.4 MB
- Tags: CPython 3.8+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d7681b44c8cfa3fd26086bf025b5b59c2eeccb351539ab5d4b22c1c3f7bf1751
|
|
| MD5 |
98dee8374acbf23754b3354ec7e8ca04
|
|
| BLAKE2b-256 |
3fb15741cad3794497ffa0601590a9ff2c8343da8ad11fc4ae496ac161e7531a
|
Provenance
The following attestation bundles were made for gldf_rs_python-0.3.3-cp38-abi3-musllinux_1_2_x86_64.whl:
Publisher:
python-publish.yml on holg/gldf-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gldf_rs_python-0.3.3-cp38-abi3-musllinux_1_2_x86_64.whl -
Subject digest:
d7681b44c8cfa3fd26086bf025b5b59c2eeccb351539ab5d4b22c1c3f7bf1751 - Sigstore transparency entry: 767448915
- Sigstore integration time:
-
Permalink:
holg/gldf-rs@89455c18067ac934b916764ac82831893fb1ee42 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/holg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@89455c18067ac934b916764ac82831893fb1ee42 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gldf_rs_python-0.3.3-cp38-abi3-musllinux_1_2_aarch64.whl.
File metadata
- Download URL: gldf_rs_python-0.3.3-cp38-abi3-musllinux_1_2_aarch64.whl
- Upload date:
- Size: 2.2 MB
- Tags: CPython 3.8+, musllinux: musl 1.2+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7c5cea37f75d326e766d420d373152aefc3ac1192a44c6269c59969239817b70
|
|
| MD5 |
5c7ac42e7be438183748f2c15bbc246e
|
|
| BLAKE2b-256 |
9dc1e79b34e34388381689813c7eb0ba097ea364dbe1cbc2b6858ef6f4daeb59
|
Provenance
The following attestation bundles were made for gldf_rs_python-0.3.3-cp38-abi3-musllinux_1_2_aarch64.whl:
Publisher:
python-publish.yml on holg/gldf-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gldf_rs_python-0.3.3-cp38-abi3-musllinux_1_2_aarch64.whl -
Subject digest:
7c5cea37f75d326e766d420d373152aefc3ac1192a44c6269c59969239817b70 - Sigstore transparency entry: 767448895
- Sigstore integration time:
-
Permalink:
holg/gldf-rs@89455c18067ac934b916764ac82831893fb1ee42 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/holg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@89455c18067ac934b916764ac82831893fb1ee42 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gldf_rs_python-0.3.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: gldf_rs_python-0.3.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 2.1 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
446f97c67e191b5b206bb7f6cfe661f164271523ae511ccbfe61d1497153727e
|
|
| MD5 |
5652096ae4a2935bc406f42301ba6950
|
|
| BLAKE2b-256 |
811667a18046ce7bf0bbf42800c00feee349bd47b22bc12087ec34f557e1aaa7
|
Provenance
The following attestation bundles were made for gldf_rs_python-0.3.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
python-publish.yml on holg/gldf-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gldf_rs_python-0.3.3-cp38-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
446f97c67e191b5b206bb7f6cfe661f164271523ae511ccbfe61d1497153727e - Sigstore transparency entry: 767448903
- Sigstore integration time:
-
Permalink:
holg/gldf-rs@89455c18067ac934b916764ac82831893fb1ee42 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/holg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@89455c18067ac934b916764ac82831893fb1ee42 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gldf_rs_python-0.3.3-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: gldf_rs_python-0.3.3-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 2.1 MB
- Tags: CPython 3.8+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8384385ce4ab159eef9a30f6c6e9572cdc23ee88c9065e9e1bb05967ffef1d26
|
|
| MD5 |
dc8593a442dbef7c6b7cee38b205b5f6
|
|
| BLAKE2b-256 |
351b807fcb93f3c41e14666f3e5ff09964df62c7118ba1fbfc5b53857ec5bf4a
|
Provenance
The following attestation bundles were made for gldf_rs_python-0.3.3-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
python-publish.yml on holg/gldf-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gldf_rs_python-0.3.3-cp38-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
8384385ce4ab159eef9a30f6c6e9572cdc23ee88c9065e9e1bb05967ffef1d26 - Sigstore transparency entry: 767448905
- Sigstore integration time:
-
Permalink:
holg/gldf-rs@89455c18067ac934b916764ac82831893fb1ee42 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/holg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@89455c18067ac934b916764ac82831893fb1ee42 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gldf_rs_python-0.3.3-cp38-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: gldf_rs_python-0.3.3-cp38-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 1.9 MB
- Tags: CPython 3.8+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
def15f536ba9f6d67989c9536d65be13d261a08326ad8742d03be1e31cba9589
|
|
| MD5 |
efc5548f18d1ce1a2ef32cd5bc0dc4be
|
|
| BLAKE2b-256 |
b3d312a70e1398a236476a24d9e464dab962813abae0c5719036a9bbb9db0b67
|
Provenance
The following attestation bundles were made for gldf_rs_python-0.3.3-cp38-abi3-macosx_11_0_arm64.whl:
Publisher:
python-publish.yml on holg/gldf-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gldf_rs_python-0.3.3-cp38-abi3-macosx_11_0_arm64.whl -
Subject digest:
def15f536ba9f6d67989c9536d65be13d261a08326ad8742d03be1e31cba9589 - Sigstore transparency entry: 767448907
- Sigstore integration time:
-
Permalink:
holg/gldf-rs@89455c18067ac934b916764ac82831893fb1ee42 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/holg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@89455c18067ac934b916764ac82831893fb1ee42 -
Trigger Event:
push
-
Statement type:
File details
Details for the file gldf_rs_python-0.3.3-cp38-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: gldf_rs_python-0.3.3-cp38-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 2.0 MB
- Tags: CPython 3.8+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fff9e4f0f6cd5c926a7873f473bff7e682c3397666b5a91dec661a089e30b9c5
|
|
| MD5 |
0134d2ee52f283f2105532085a15ede0
|
|
| BLAKE2b-256 |
fb4a3e4829a5784d7bc142ac98216c6ae110e8aeba8dd9f5aeb0cdb30988adb2
|
Provenance
The following attestation bundles were made for gldf_rs_python-0.3.3-cp38-abi3-macosx_10_12_x86_64.whl:
Publisher:
python-publish.yml on holg/gldf-rs
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
gldf_rs_python-0.3.3-cp38-abi3-macosx_10_12_x86_64.whl -
Subject digest:
fff9e4f0f6cd5c926a7873f473bff7e682c3397666b5a91dec661a089e30b9c5 - Sigstore transparency entry: 767448911
- Sigstore integration time:
-
Permalink:
holg/gldf-rs@89455c18067ac934b916764ac82831893fb1ee42 -
Branch / Tag:
refs/tags/v0.3.3 - Owner: https://github.com/holg
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@89455c18067ac934b916764ac82831893fb1ee42 -
Trigger Event:
push
-
Statement type: