redsun
A component-based, customizable application framework for scientific hardware orchestration, based on the Bluesky framework.
[!NOTE]
redsunis slowly reaching maturity, enough that it is safe to start being deployed. Still, expect major breaking changes as the API crystallizes.
Problem statement
In scientific research involving device control, one of the major problems is orchestrating different hardware units to achieve reusable, reliable and documentable workflows. On top of that, such hardware orchestration should provide a coherent and understandable user interface that less technical inclined users are able to understand and leverage accurately.
This proves challenging, because making experiments is a fluid endevour. It's hard (next to impossible) to predict what are the actual final requirements a software should encapsulate, especially if the final output is to face this to scientists with no engineering background.
Rather than trying to ship an entire software on its own, redsun follows the idea of component-based development: ship off-the-shelf components, assemble and wire them depending on the needs.
Component-based development (CBD)
In CBD, interfaces are key. Each component express what it requires to be built, as well as offering functionalities that can be leveraged by other components.
Components are wrapped into an AppContainer that takes care of bootstrapping the actual application for you, letting you focus on what each component should deliver.
from mylab.devices import MyMotor
from mylab.presenters import MyController
from mylab.views import MyView
from redsun.containers import declare_device, declare_presenter, declare_view
from redsun.qt import QtAppContainer
class MyApp(QtAppContainer):
stage = declare_device(MyMotor, axis=["X", "Y"], egu="mm")
ctrl = declare_presenter(MyController, timeout=2.0)
panel = declare_view(MyView)
def wire(self) -> None:
self.connect(self.ctrl.sig_position_changed, self.panel.update_position)
MyApp(session="my-session").run()
Each component is declared once, with the arguments it needs. wire says which signal reaches which method; the container builds everything in dependency order and connects it.
redsun provides the common glue code that each component can use to ship entire applications or single, reusable components. Leveraging Python entry points, an application can also be shipped as a single YAML configuration file, provided that different contributing components expose a redsun.yaml manifest.
So the same application can be expressed as:
# session.yaml
schema_version: 1.0
frontend: pyqt
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:
- from: ctrl.sig_position_changed
to: panel.update_position
plugin_id is resolved through the manifest 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.container import AppContainer
AppContainer.from_config("session.yaml").run()
[!TIP] When launching an app container from a configuration file, make sure that your involved component packages (i.e.
mylabin this example) are installed in the same environment where yourAppContaineris launched.
AppContainer architecture
Each redsun container is structured as a Device-View-Presenter (DVP) application. This resembles the Model-View-Presenter (MVP) architecture, with the difference that at the lower level of the application sits the Device layer, leveraging ophyd-async, to interact with hardware components.
This is to make a clear statement: redsun is primarely about device control, and tries to do it well.
Documentation
See the documentation for more informations.
License
redsun is released under license Apache 2.0.
See the license for further details.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file redsun-0.12.0.tar.gz.
File metadata
- Download URL: redsun-0.12.0.tar.gz
- Upload date:
- Size: 87.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e494493a9e9eebe2aba1da8dc29025b10f32669387633f38eeb46ba6bc82cd7d
|
|
| MD5 |
f19f13601c1863c0dde69e7d60318736
|
|
| BLAKE2b-256 |
af7a170d7f898b3932e965cbd4e75071e0fe4ac540dc4c89c83a60d954bf3476
|
Provenance
The following attestation bundles were made for redsun-0.12.0.tar.gz:
Publisher:
ci.yaml on redsun-acquisition/redsun
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
redsun-0.12.0.tar.gz -
Subject digest:
e494493a9e9eebe2aba1da8dc29025b10f32669387633f38eeb46ba6bc82cd7d - Sigstore transparency entry: 2647760368
- Sigstore integration time:
-
Permalink:
redsun-acquisition/redsun@14014bd9f73d8328624e171b823282c6412f1dff -
Branch / Tag:
refs/tags/v0.12.0 - Owner: https://github.com/redsun-acquisition
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yaml@14014bd9f73d8328624e171b823282c6412f1dff -
Trigger Event:
push
-
Statement type:
File details
Details for the file redsun-0.12.0-py3-none-any.whl.
File metadata
- Download URL: redsun-0.12.0-py3-none-any.whl
- Upload date:
- Size: 104.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d60f409c685de7b49a209c5cb4d209b767862d2c0dde4aa438562aa42b5b3e3f
|
|
| MD5 |
01ccc25c6a28fb8410884addd6f9db88
|
|
| BLAKE2b-256 |
55441f05b84bfe8d017d94cb2e7467401a4c0cf591feae6172f8fc6883f48eee
|
Provenance
The following attestation bundles were made for redsun-0.12.0-py3-none-any.whl:
Publisher:
ci.yaml on redsun-acquisition/redsun
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
redsun-0.12.0-py3-none-any.whl -
Subject digest:
d60f409c685de7b49a209c5cb4d209b767862d2c0dde4aa438562aa42b5b3e3f - Sigstore transparency entry: 2647760399
- Sigstore integration time:
-
Permalink:
redsun-acquisition/redsun@14014bd9f73d8328624e171b823282c6412f1dff -
Branch / Tag:
refs/tags/v0.12.0 - Owner: https://github.com/redsun-acquisition
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
ci.yaml@14014bd9f73d8328624e171b823282c6412f1dff -
Trigger Event:
push
-
Statement type: