Skip to main content

OBPlib for Python

OBPlib creates and reads OpenBeamPath (OBP) data for electron-beam powder-bed fusion systems. Build a path from lines, cubic Bézier curves, timed points, and synchronization signals, then write it as binary .obp or human-readable .obpj data.

The package requires Python 3.13 or newer.

Install

A plain wheel installation includes NumPy, Matplotlib, and ipywidgets along with the core dependencies; no viewer or notebook extras are needed. The desktop viewer also needs Tcl/Tk support in your Python installation.

On a Debian system configured with the Freemelt package repository:

$ sudo apt-get update
$ sudo apt-get install python3-obplib

To work from a source checkout on Debian 13 (Trixie), install the build and runtime dependencies from Debian, then make an editable installation in a virtual environment:

$ sudo apt-get install python3-click python3-protobuf \
    python3-grpc-tools protobuf-compiler python3-setuptools python3-wheel \
    python3-venv
$ python3 -m venv --system-site-packages .venv
$ .venv/bin/python -m pip install --no-build-isolation --no-deps --editable .

The editable-install step also generates the Python modules for OBP.proto.

Quick start

Coordinates and spot sizes are in micrometres (µm), beam power is in watts, and scan speed is in micrometres per second (µm/s).

from pathlib import Path

import obplib as obp

beam = obp.Beamparameters(spot_size=80, power=250)

path = [
    obp.Line(
        obp.Point(0, 0),
        obp.Point(10_000, 0),
        500_000,
        beam,
    ),
    obp.Curve(
        obp.Point(10_000, 0),
        obp.Point(12_000, 0),
        obp.Point(15_000, 3_000),
        obp.Point(15_000, 5_000),
        400_000,
        beam,
    ),
]

obp.write_obp(path, Path("example.obp"))
obp.write_obpj(path, Path("example.obpj"))

example.obp is the length-delimited protobuf representation used by OBP consumers. example.obpj is a JSON representation intended for inspection and conversion.

Read binary data back into library objects:

segments = obp.read_obp("example.obp")

for segment in segments:
    print(type(segment).__name__, segment)

Reading .obpj is deliberately different: read_obpj() returns the decoded JSON dictionary rather than path objects.

document = obp.read_obpj("example.obpj")
print(document["OBP"][0]["line"])

Documentation and examples

  • User guide — concepts, every public path type, transformations, file I/O, command-line tools, viewers, and current limitations.
  • Create an OBP job — builds a mixed path and writes both file formats.
  • Transform a path — scales, rotates, and translates geometry without modifying the originals.

Run an example after installing the package:

$ python3 examples/create_job.py --output-dir /tmp/obp-example

Command-line tools

Convert between binary and textual OBP:

$ obpc decompile example.obp   # writes example.obpj
$ obpc compile example.obpj    # writes example.obp

Install the viewer dependencies and inspect a binary path:

$ sudo apt-get install python3-matplotlib python3-numpy python3-tk
$ obpviewer example.obp

See the user guide for compiler usage, viewer controls and cross-platform wheel installation. SVG conversion is no longer included. See release validation for dependency and GUI qualification.

Format definition

The protocol is defined in openbeampath/OBP.proto. Each protobuf Packet is stored with a varint32 length prefix in an .obp file. An .obpj file contains the JSON form under a top-level "OBP" array.

License

Copyright © 2018–2026 Freemelt AB.

OBPlib and OpenBeamPath are licensed under the Apache License 2.0.

Metadata

Release files for obplib 3.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for obplib 3.1.0
File Size Uploaded Provenance Actions
obplib-3.1.0.tar.gz 45.6 kB Without provenance Details for obplib-3.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for obplib 3.1.0
File Interpreter ABI Platform Actions
obplib-3.1.0-py3-none-any.whl Python 3 none any Details for obplib-3.1.0-py3-none-any.whl

Total release size: 88.8 kB

Release files / obplib-3.1.0.tar.gz

Download URL obplib-3.1.0.tar.gz
Size 45.6 kB
Tags Source
SHA-256 checksum
How to use checksums
60998b605ed85b175a2fe2d4cffcc60f8aeb2c16999ccc6b415134065a548077
BLAKE2b-256 checksum
How to use checksums
d15d65c946c90bf5743d574d294b1bb66e3c8ae55a9d57297a2daa8ff42af0f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Release files / obplib-3.1.0-py3-none-any.whl

Download URL obplib-3.1.0-py3-none-any.whl
Size 43.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c6911420d3e6e6ef37090b35d16b409d2fadb9115977c028a4b0d3b43b6ce3bd
BLAKE2b-256 checksum
How to use checksums
cf4f8d418a2cc00fc05ced3b378bc7e44316ec8f8e46c45919f31fe85bc7e53d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.5

Security for obplib 3.1.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A 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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page