redsun
redsun is a Python toolkit for building your own modular software for scientific data acquisition. You describe your instrument in Python, and redsun assembles it into an application with a graphical interface. It builds on the Bluesky project, where bluesky runs acquisitions as plans and ophyd-async describes hardware as devices. redsun ships no hardware drivers, so the devices for your instruments come from you or from a plugin.
To learn redsun, start with the tutorials, where you build one application step by step without any hardware. They assume no knowledge of bluesky or ophyd-async.
Problem statement
When research depends on controlling hardware, one of the hardest problems is making different instruments work together in workflows that are reusable, reliable and documented. On top of that, the software needs an interface that people with less technical background can understand and use correctly.
That's hard because experiments keep changing. It's next to impossible to predict everything the software will finally need to do, especially when the people using it are scientists with no engineering background.
So redsun follows the idea of component-based development: it ships ready-made components, and you assemble and wire them for what you need.
Component-based development (CBD)
In component-based development, each component is defined by its interface: it says what it needs to be built, and offers features that other components can use.
You put components together in a session, which builds the application for you, so you can focus on what each component does. In the example below, mylab stands for your own package:
from collections.abc import Iterator
from typing import Annotated
from mylab.devices import MyMotor
from mylab.presenters import MyController
from mylab.views import MyView
from redsun import AsDevice, AsPresenter, AsView, Declare, Link
from redsun.qt import QtSession
class MyApp(QtSession):
stage: Annotated[AsDevice[MyMotor], Declare(axis=["X", "Y"], egu="mm")]
ctrl: Annotated[AsPresenter[MyController], Declare(timeout=2.0)]
panel: AsView[MyView]
def wire(self) -> Iterator[Link]:
yield self.ctrl.sig_position_changed, self.panel.update_position
MyApp({"session": "my-session"}).run()
You declare each component once, with the arguments it needs, and wire says which signal reaches which slot. The session then builds everything in order and connects it.
redsun provides the shared code that connects components, so you can use it to ship a whole application or a single reusable component. A package that contributes components lists them in a redsun.yaml manifest, which redsun finds through a Python entry point once the package is installed. An application can then be shipped as a single YAML configuration file.
As a file, the application above looks like this:
# session.yaml
schema_version: 1.0
frontend: qt
session: my-session
devices:
stage:
plugin_name: mylab
plugin_id: my_motor
axis: ["X", "Y"]
egu: mm
presenters:
ctrl:
plugin_name: mylab
plugin_id: my_controller
timeout: 2.0
views:
panel:
plugin_name: mylab
plugin_id: my_view
wiring:
ctrl.sig_position_changed: panel.update_position
The session looks up each plugin_id in the manifest that the contributing package ships:
# mylab/redsun.yaml
devices:
my_motor: mylab.devices:MyMotor
presenters:
my_controller: mylab.presenters:MyController
views:
my_view: mylab.views:MyView
Launch it with:
from redsun import Session
Session.from_config("session.yaml").run()
Session architecture
Each redsun session is a Device-View-Presenter (DVP) application with three layers: devices talk to the hardware through ophyd-async, presenters hold the application's logic, and views show it to the user. The layout follows Model-View-Presenter, a common way to keep an interface apart from the logic behind it, with devices in place of the model. Devices form the bottom layer because redsun is first of all about device control.
Documentation
The documentation covers everything else.
License
redsun is released under the Apache 2.0 license. See the license for the full text.
Metadata
Release files for redsun 0.18.2
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 |
|---|---|---|---|---|
| redsun-0.18.2.tar.gz | 321.6 kB | With provenance | Details for redsun-0.18.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| redsun-0.18.2-py3-none-any.whl | Python 3 | none | any | Details for redsun-0.18.2-py3-none-any.whl |
Total release size: 745.9 kB
Release files / redsun-0.18.2.tar.gz
| Download URL | redsun-0.18.2.tar.gz |
|---|---|
| Size | 321.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1cfde53a74baa93cc2fa2ae007608d968d61ee86615bbad2ab11e62584b18960
|
|
BLAKE2b-256 checksum How to use checksums |
5f46d951ead6e9d9b43388e4a8c116e6ca4cf6448b2e55ada6b8520b06752920
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 23, 2026.
Transparency logRelease files / redsun-0.18.2-py3-none-any.whl
| Download URL | redsun-0.18.2-py3-none-any.whl |
|---|---|
| Size | 424.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
41be9e467abf7ac547ed63ea4c63faeea8c46b1f6ebb43c3cb44a9425891c054
|
|
BLAKE2b-256 checksum How to use checksums |
7db4ccd33186d18a4f2834e045df4992225d7ff874f0f9de9023bbad6fdc8d96
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
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 Nov 23, 2026.
Transparency logSecurity for redsun 0.18.2
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 redsun-0.18.2.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 Nov 23, 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.