Skip to main content

PyroLab


PyPI Version PyPI - Python Version Documentation Status License Latest Commit

A framework for using remote lab instruments as local resources, built on Pyro5.

Developed by Sequoia Ploeg (for CamachoLab, Brigham Young University).

About

This project aims to allow all laboratory instruments to be accessed as local objects from a remote machine. Instruments that don't natively support such access, such as those required to be connected by a USB cable (or similar), are wrapped with a Pyro5 interface. However, this library may contain other instruments that are already internet-capable and don't rely on Pyro5. That's alright; we're just trying to create a minimal-dependency, one-stop-shop for laboratory instruments!

Note: while the software says "OS Independent", some of the servers are OS-specific. For example, ThorLabs DLL's only work on Windows. However, you could use PyroLab to connect to those devices from any operating system.

Installation

PyroLab is pip installable:

pip install pyrolab

PyroLab declares several "extras", depending on which instruments you need to support:

pip install "pyrolab[tsl550,rto]"

The full list of supported extras is:

  • tsl550 (Santec lasers)
  • ppcl55x (PurePhotonics lasers)
  • rto (Rohde & Schwarz oscilloscopes)
  • arduino (Arduino)
  • cameras (ThorCam and AmScope cameras, via OpenCV)

You can also clone the repository, navigate to the toplevel, and install in editable mode:

pip install -e .

For development, use uv. From the toplevel, make install (equivalent to uv sync --all-extras followed by uv run pre-commit install) creates a .venv with PyroLab, every extra, and the development tools, and installs the pre-commit hooks. Run tests with make test (or uv run pytest).

Web Monitor

There's a web application that can monitor your PyroLab nameserver and provide an easy-to-access status board. It's a Flask app that can be served using a production grade server. Install it using pip:

pip install pyromonitor

To run:

pyromonitor up

Example

Local Instruments

Locally available instruments just import drivers without using any of the other features of PyroLab.

from pyrolab.drivers.lasers.tsl550 import TSL550

laser = TSL550("COM4")
laser.on()
laser.power_dBm(12)
laser.open_shutter()
laser.sweep_set_mode(continuous=True, twoway=True, trigger=False, const_freq_step=False)

Remote Instruments

First, make sure all configurations on the nameserver computer, instrument server computer, and client are correct (with the proper keys, if configured, etc.).

Run a nameserver:

from pyrolab.api import start_ns_loop

start_ns_loop()

Provide a service:

from pyrolab.api import Daemon, locate_ns
from pyrolab.drivers.sample import SampleService

daemon = Daemon()
ns = locate_ns(host="localhost")
uri = daemon.register(SampleService)
ns.register("test.SampleService", uri)

try:
    daemon.requestLoop()
finally:
    ns.remove("test.SampleService")

Connect using a remote client:

from pyrolab.api import locate_ns, Proxy

ns = locate_ns(host="localhost")
uri = ns.lookup("test.SampleService")

with Proxy(uri) as service:
    resp = service.echo("Hello, server!")
    print(type(resp), resp)

Instrument Server Configuration

PyroLab stores information about instruments and servers when it closes. This means that once PyroLab has been configured once, each time it is restarted, it will remember and reload the previous configuration. Hence, once a server is set up, unless the available instruments, nameserver, or other configurations change, PyroLab will automatically work when started, every time!

For an example of how a new PyroLab instrument server should be configured the first time it's run, see examples/library-catalog/config.yaml.

FAQ's

  1. Another instrument library? What about all the others?
    In our experience, many of the other libraries are buggy or have difficulty with network connections. So, our approach was to rely on a well developed and time-tested framework (Pyro) instead of worrying about developing and supporting our own custom set of servers.

  2. Is this a standalone software that automatically supports all the advertised instruments?
    No; many of these instruments depend on other software already being installed. In particular, ThorLabs equipment depends on ThorLabs software already being installed on the computer connected to the physical hardware (but not on the remote computer!). As much as possible, though, we try to make the drivers standalone capable.

For Developers

Since the passing of data is, by definition, between hosts and over IP, PyroLab avoids the use of complex Python objects for return values that will be transmitted to remote machines. Since serialization is complicated, and security is even harder, we resort to using only basic Python types when interfacing with hardware (i.e., Python lists, ints, tuples, and not NumPy arrays, matplotlib plot objects, custom objects, etc.).

Releasing

The version lives only in pyproject.toml; pyrolab.__version__ reads it from the installed package's metadata.

Every release starts as a release candidate on PyPI, so what gets tested is exactly what gets released. First commit a changelog file under docs/changelog titled <major>.<minor>.<patch>-changelog.md for the new version; it becomes the release notes for the candidates and the release. Then, with a clean working tree:

make minor      # start a candidate: 0.4.0 -> 0.5.0rc1 (or make patch, make major)
make rc         # if you need another: 0.5.0rc1 -> 0.5.0rc2
make release    # release the candidate: 0.5.0rc2 -> 0.5.0

Each one bumps the version with uv version, commits pyproject.toml and uv.lock, tags vX.Y.Z, and pushes the commit and tag. The tag triggers the release workflow, which runs the test suite, builds and checks the package, publishes it to PyPI, and creates the GitHub release with the changelog as its notes (marked as a pre-release for a candidate). pip installs a candidate only when asked, with pip install --pre pyrolab or pip install pyrolab==0.5.0rc1, so everyone else keeps getting the latest release.

make release only works on a candidate. While a candidate is out, make patch, make minor, or make major can only move it up a level (for example, if 0.5.1rc1 turns out to need a minor release, make minor gives 0.6.0rc1; rename the changelog to match). The rules are in scripts/release.sh.

Publishing uses PyPI's Trusted Publishing: PyPI accepts uploads only from this repository's release.yml workflow running in the pypi environment, so no PyPI token is stored in GitHub. Any PR that edits release.yml gets a dry run (checks and build, nothing published), and the workflow can also be dry-run by hand from the Actions tab.

Code Quality

Formatting and import sorting use ruff, run automatically by the pre-commit hooks that make install sets up. To run it by hand, use make format; make precommit runs every hook on every file, as CI does.

Building the Docs

Much of the API documentation is autogenerated from the source code. Gitignores are in place to prevent you from committing autogenerated pages.

To build the docs, run make doc (which installs the docs dependency group), then make serve to view them at http://localhost:8000. Read the Docs builds them the same way, from uv.lock.

Building the Package

You can test the build and view the bundled artifacts with make build (which runs uv build). It's recommended you build locally before pushing to PyPI. In particular, double check the included files and make sure only the required files are there by modifying MANIFEST.in as necessary.

Metadata

Release files for pyrolab 0.5.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 pyrolab 0.5.0
File Size Uploaded Provenance
pyrolab-0.5.0.tar.gz 195.7 kB With provenance Details

Built distribution (wheel)

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

Total release size: 374.5 kB

Release files / pyrolab-0.5.0.tar.gz

Download URL pyrolab-0.5.0.tar.gz
Size 195.7 kB
Tags Source
SHA-256 checksum
How to use checksums
0b66366fa5b7e910acf9ec78eff045d01556839452e10ece547b3f075750f9b9
BLAKE2b-256 checksum
How to use checksums
5229ee20a3fded732cf18b34b82d3559ecf1532f166589fc94646becd177c8ec
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 24, 2026.

Transparency log

Release files / pyrolab-0.5.0-py3-none-any.whl

Download URL pyrolab-0.5.0-py3-none-any.whl
Size 178.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
72d54f8c0e3be0cad06d8aa4d066002338b57ccd704887f33185948998f53e0d
BLAKE2b-256 checksum
How to use checksums
236d83b188ad47a91962a8ba39840bb0e8c4ac4445a2adeb275f29edc6832e2f
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 24, 2026.

Transparency log

Security for pyrolab 0.5.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

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pyrolab-0.5.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 24, 2026.

Transparency log

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