Skip to main content

nodebpy

Run Tests

Build node trees in Blender more elegantly with Python code. Geometry Nodes, Shader Nodes and Compositor nodes are all fully supported, with type hints and IDE auto-completion throughout.

pip install nodebpy

A text-based version of nodes should bring the convenience of writing code with IDE auto-completion, type hinting, with overall compactness and readability, while staying as close as possible to what building a node tree via the GUI feels like.

from nodebpy import geometry as g

with g.tree("AnotherTree", collapse=True) as tree:
    rotation = (
        g.RandomValue.vector(min=-1, seed=2)
        >> g.AlignRotationToVector()
        >> g.RotateRotation(rotate_by=g.AxisAngleToRotation(angle=0.3))
    )

    _ = (
        tree.inputs.integer("Count", 10)
        >> g.Points(position=g.RandomValue.vector(min=-1))
        >> g.InstanceOnPoints(instance=g.Cube(), rotation=rotation)
        >> g.SetPosition(
            position=g.Position() * 2.0 + (0, 0.2, 0.3),
            offset=(0, 0, 0.1),
        )
        >> g.RealizeInstances()
        >> g.InstanceOnPoints(g.Cube(), instance=...)
        >> tree.outputs.geometry("Instances")
    )

  • Every node is a typed class named after the node it creates — 'Random Value' becomes g.RandomValue() — and node subtypes are class methods: g.RandomValue.vector().
  • Trees are built inside a with g.tree(...): context; instantiating a node class adds it to the current tree, and the tree's interface is declared with tree.inputs.* / tree.outputs.*.
  • Nodes are linked with the >> operator, which picks the most compatible socket pair automatically (much like Node Wrangler's Alt + Right Click drag) — or address sockets explicitly through the .i.* / .o.* accessors.
  • Python's arithmetic, comparison and boolean operators create the matching Math / VectorMath / Compare / BooleanMath nodes: g.Value(1.0) * 2 + (0, 0, 1).
  • Existing node trees — including ones wired up by hand in the GUI — can be exported back to nodebpy source with to_python().

Documentation

Guides and the full node reference live at bradyajohnston.github.io/nodebpy:

Like databpy, this project started as an internal tool inside molecularnodes before being broken out into its own robustly typed and tested package.

Contributing

Development setup, running the tests and regenerating the node classes (most of src/nodebpy/nodes/ is auto-generated by the gen/ package) are covered in CONTRIBUTING.md.

Download files

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

Source Distribution

nodebpy-520.13.0.tar.gz (330.5 kB view details)

Uploaded Source

Built Distribution

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

nodebpy-520.13.0-py3-none-any.whl (371.1 kB view details)

Uploaded Python 3

File details

Details for the file nodebpy-520.13.0.tar.gz.

File metadata

  • Download URL: nodebpy-520.13.0.tar.gz
  • Upload date:
  • Size: 330.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for nodebpy-520.13.0.tar.gz
Algorithm Hash digest
SHA256 29e18993309b2283c2eda1ec97940f6acbce27da839cf59747928d8288dd5580
MD5 977ec111b7c11111fdee16feac69f82f
BLAKE2b-256 770009ad46ee3c7e66de01024eb32c0e09f28711fbfb4e282f3eed0d55b339d8

See more details on using hashes here.

Provenance

The following attestation bundles were made for nodebpy-520.13.0.tar.gz:

Publisher: pypi.yml on BradyAJohnston/nodebpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nodebpy-520.13.0-py3-none-any.whl.

File metadata

  • Download URL: nodebpy-520.13.0-py3-none-any.whl
  • Upload date:
  • Size: 371.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for nodebpy-520.13.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0fdf5d11459c3fcc6c62049d8dd5a0471d2b7a7b35673899723c0848dacbcf24
MD5 1dddfab5fd4b33af7e96fc6076be3bcc
BLAKE2b-256 70d06aa8e54f170e9ffa7a92f9507ed3e2f62c1b26bc97091b77dd6cfd956c4a

See more details on using hashes here.

Provenance

The following attestation bundles were made for nodebpy-520.13.0-py3-none-any.whl:

Publisher: pypi.yml on BradyAJohnston/nodebpy

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

520.13.0 This release

2 files

520.11.0

2 files

520.10.0

2 files

520.9.0

2 files

520.8.0

2 files

520.7.0

2 files

520.6.0

2 files

520.5.2

2 files

520.5.1

2 files

520.5.0

2 files

520.4.0

2 files

520.3.0

2 files

520.2.0

2 files

520.1.0

2 files

520.0.1

2 files

520.0.0

2 files

0.18.0

2 files

0.17.0

2 files

0.16.0

2 files

0.15.1

2 files

0.15.0

2 files

0.14.0

2 files

0.13.0

2 files

0.12.0

2 files

0.11.1

2 files

0.11.0

2 files

0.10.2

2 files

0.10.1

2 files

0.10.0

2 files

0.9.1

2 files

0.9.0

2 files

0.8.0

2 files

0.7.2

2 files

0.7.1

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.1

2 files

0.4.0

2 files

0.3.1

2 files

0.3.0

2 files

0.2.1

2 files

0.2.0

2 files

0.1.1

2 files

0.1.0

2 files

Supported by

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