databpy
| Blender | Tests |
|---|---|
| 5.1 | |
| 5.2 | |
| 5.3 (beta) | |
| 5.4 (alpha) |
Data-oriented wrappers around Blender’s Python API, which read and write the attributes of mesh, curves and point cloud objects as NumPy arrays.
databpy started inside Molecular Nodes and was split into a separate Python package for use in other projects.
Installation
databpy supports Blender 5.1 and later, which use Python 3.13. Install it from PyPI with pip:
pip install databpy
Usage
databpy creates objects, and stores and retrieves their attributes.
store_named_attribute()
and
named_attribute()
are named after the Store Named Attribute and Named Attribute nodes
in Geometry Nodes, and work on mesh, curves and point cloud objects.
To store an attribute on a new object:
import numpy as np
import databpy as db
coords = np.array([[0, 0, 0], [0, 5, 0], [5, 0, 0], [5, 5, 0]])
obj = db.create_object(coords, name="Box")
db.store_named_attribute(obj, np.array([10, 20, 31, 42]), "vals")
Attributes are stored and retrieved as NumPy arrays:
import numpy as np
import databpy as db
np.random.seed(6)
# Create a mesh object
random_verts = np.random.rand(10, 3)
obj = db.create_object(random_verts, name="RandomMesh")
obj.name
'RandomMesh'
Read an attribute from the object’s mesh:
db.named_attribute(obj, "position")
array([[0.8928602 , 0.3319798 , 0.8212291 ],
[0.04169663, 0.10765668, 0.59505206],
[0.52981734, 0.41880742, 0.33540785],
[0.62251943, 0.43814144, 0.7358821 ],
[0.5180364 , 0.5788586 , 0.6453551 ],
[0.99022424, 0.8198582 , 0.41320094],
[0.8762677 , 0.82375944, 0.05447451],
[0.7186372 , 0.8021706 , 0.7364066 ],
[0.7091318 , 0.5409368 , 0.12482417],
[0.9576473 , 0.4032563 , 0.21695116]], dtype=float32)
BlenderObject class (bob)
BlenderObject wraps a bpy.types.Object and provides databpy’s
functions as methods. Wrap an existing object, or create a new one with
create_bob().
Attributes can be read with named_attribute(), or as properties and
items such as bob.position and bob["position"].
# wrap an existing object or create a new one
bob = db.BlenderObject(obj)
bob = db.create_bob(random_verts)
# these two are identical
bob.named_attribute("position")
bob.position
AttributeArray(name='position', object='NewObject', mesh='NewObject', domain=POINT, type=FLOAT_VECTOR, shape=(10, 3), dtype=float32)
array([[0.8928602 , 0.3319798 , 0.8212291 ],
[0.04169663, 0.10765668, 0.59505206],
[0.52981734, 0.41880742, 0.33540785],
[0.62251943, 0.43814144, 0.7358821 ],
[0.5180364 , 0.5788586 , 0.6453551 ],
[0.99022424, 0.8198582 , 0.41320094],
[0.8762677 , 0.82375944, 0.05447451],
[0.7186372 , 0.8021706 , 0.7364066 ],
[0.7091318 , 0.5409368 , 0.12482417],
[0.9576473 , 0.4032563 , 0.21695116]], dtype=float32)
new_from_pydata() clears the geometry of the object’s mesh and fills
it with new vertices, edges and faces:
bob.new_from_pydata(np.random.randn(5, 3))
bob.position
AttributeArray(name='position', object='NewObject', mesh='NewObject', domain=POINT, type=FLOAT_VECTOR, shape=(5, 3), dtype=float32)
array([[ 0.82465386, -1.1764315 , 1.5644896 ],
[ 0.7127051 , -0.1810066 , 0.53419954],
[-0.58661294, -1.4818532 , 0.8572476 ],
[ 0.94309896, 0.11444143, -0.02195668],
[-2.1271446 , -0.83440745, -0.4655083 ]], dtype=float32)
Example with Polars data
import polars as pl
import databpy as db
from io import StringIO
json_file = StringIO("""
{
"Dino": [
[55.3846, 97.1795, 0.0],
[51.5385, 96.0256, 0.0]
],
"Star": [
[58.2136, 91.8819, 0.0],
[58.1961, 92.215, 0.0]
]
}
""")
df = pl.read_json(json_file)
columns_to_explode = [col for col in df.columns if df[col].dtype == pl.List(pl.List)]
df = df.explode(columns_to_explode, empty_as_null=True)
vertices = np.zeros((len(df), 3), dtype=np.float32)
bob = db.create_bob(vertices, name="DinoStar")
for col in df.columns:
data = np.vstack(df.get_column(col).to_numpy())
bob.store_named_attribute(data, col)
bob.named_attribute("Dino")
array([[55.3846, 97.1795, 0. ],
[51.5385, 96.0256, 0. ]], dtype=float32)
bob.named_attribute("Star")
array([[58.2136, 91.8819, 0. ],
[58.1961, 92.215 , 0. ]], dtype=float32)
Metadata
Release files for databpy 0.11.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 | Provenance | Actions |
|---|---|---|---|---|
| databpy-0.11.0.tar.gz | 39.8 kB | With provenance | Details for databpy-0.11.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| databpy-0.11.0-py3-none-any.whl | Python 3 | none | any | Details for databpy-0.11.0-py3-none-any.whl |
Total release size: 86.8 kB
Release files / databpy-0.11.0.tar.gz
| Download URL | databpy-0.11.0.tar.gz |
|---|---|
| Size | 39.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d57089881c14dc073328e781670744d34f6f6298577471283d2775e698c12214
|
|
BLAKE2b-256 checksum How to use checksums |
9eeb5bd941ed2a72e30e5b537762be5357f8f30ea392a35d81cd1b9edc304080
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 20, 2026.
Transparency logRelease files / databpy-0.11.0-py3-none-any.whl
| Download URL | databpy-0.11.0-py3-none-any.whl |
|---|---|
| Size | 47.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f90496479684a2c948990199014b140f95e5bd715b3ef74a9b01f30ebc6f9e28
|
|
BLAKE2b-256 checksum How to use checksums |
43bfef55d789ddb1ef4f2443ca0546a6526f1c50b194ea8f7edc3b3f89e1d131
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 20, 2026.
Transparency logSecurity for databpy 0.11.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for databpy-0.11.0.tar.gz
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 Oct 20, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.