ezmsg-qt 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- ezmsg_qt-0.2.0/.envrc +1 -0
- ezmsg_qt-0.2.0/.github/workflows/python-publish.yml +30 -0
- ezmsg_qt-0.2.0/.github/workflows/python-tests.yml +46 -0
- ezmsg_qt-0.2.0/.gitignore +78 -0
- ezmsg_qt-0.2.0/.pre-commit-config.yaml +9 -0
- ezmsg_qt-0.2.0/.python-version +1 -0
- ezmsg_qt-0.2.0/LICENSE +21 -0
- ezmsg_qt-0.2.0/MIGRATION.md +106 -0
- ezmsg_qt-0.2.0/PKG-INFO +237 -0
- ezmsg_qt-0.2.0/README.md +217 -0
- ezmsg_qt-0.2.0/examples/dual_runner_shutdown_test.py +291 -0
- ezmsg_qt-0.2.0/examples/dynamic_topic_switching_demo.py +195 -0
- ezmsg_qt-0.2.0/examples/ezmsg_toy_session.py +341 -0
- ezmsg_qt-0.2.0/examples/processor_chain_demo.py +120 -0
- ezmsg_qt-0.2.0/examples/processor_chain_showcase.py +277 -0
- ezmsg_qt-0.2.0/examples/simple_demo.py +172 -0
- ezmsg_qt-0.2.0/examples/spatial_carrier_fft_demo.py +629 -0
- ezmsg_qt-0.2.0/pyproject.toml +72 -0
- ezmsg_qt-0.2.0/src/ezmsg/qt/__init__.py +59 -0
- ezmsg_qt-0.2.0/src/ezmsg/qt/__version__.py +34 -0
- ezmsg_qt-0.2.0/src/ezmsg/qt/adapter.py +43 -0
- ezmsg_qt-0.2.0/src/ezmsg/qt/chain.py +258 -0
- ezmsg_qt-0.2.0/src/ezmsg/qt/gate.py +63 -0
- ezmsg_qt-0.2.0/src/ezmsg/qt/publisher.py +250 -0
- ezmsg_qt-0.2.0/src/ezmsg/qt/session.py +857 -0
- ezmsg_qt-0.2.0/src/ezmsg/qt/settings_form.py +184 -0
- ezmsg_qt-0.2.0/src/ezmsg/qt/sidecar.py +172 -0
- ezmsg_qt-0.2.0/src/ezmsg/qt/subscriber.py +192 -0
- ezmsg_qt-0.2.0/src/ezmsg/qt/visibility.py +36 -0
- ezmsg_qt-0.2.0/tests/test_auto_gate.py +46 -0
- ezmsg_qt-0.2.0/tests/test_chain.py +153 -0
- ezmsg_qt-0.2.0/tests/test_dynamic_publisher.py +97 -0
- ezmsg_qt-0.2.0/tests/test_dynamic_subscriber.py +157 -0
- ezmsg_qt-0.2.0/tests/test_endpoints.py +83 -0
- ezmsg_qt-0.2.0/tests/test_gate.py +31 -0
- ezmsg_qt-0.2.0/tests/test_integration.py +112 -0
- ezmsg_qt-0.2.0/tests/test_session_processor.py +41 -0
- ezmsg_qt-0.2.0/tests/test_session_sidecar.py +14 -0
- ezmsg_qt-0.2.0/tests/test_sidecar.py +121 -0
- ezmsg_qt-0.2.0/tests/test_visibility.py +49 -0
ezmsg_qt-0.2.0/.envrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
layout uv
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
# This workflow will upload a Python Package using Twine when a release is created
|
|
2
|
+
|
|
3
|
+
name: Upload Python Package
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
release:
|
|
7
|
+
types: [published]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
name: build and upload release to PyPI
|
|
13
|
+
runs-on: ubuntu-latest
|
|
14
|
+
environment: "release"
|
|
15
|
+
permissions:
|
|
16
|
+
id-token: write # IMPORTANT: this permission is mandatory for trusted publishing
|
|
17
|
+
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@v4
|
|
20
|
+
with:
|
|
21
|
+
fetch-depth: 0 # Needed for hatch-vcs to determine version
|
|
22
|
+
|
|
23
|
+
- name: Install uv
|
|
24
|
+
uses: astral-sh/setup-uv@v6
|
|
25
|
+
|
|
26
|
+
- name: Build Package
|
|
27
|
+
run: uv build
|
|
28
|
+
|
|
29
|
+
- name: Publish package distributions to PyPI
|
|
30
|
+
run: uv publish
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
name: Test package
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches:
|
|
8
|
+
- main
|
|
9
|
+
- dev
|
|
10
|
+
workflow_dispatch:
|
|
11
|
+
|
|
12
|
+
jobs:
|
|
13
|
+
build:
|
|
14
|
+
strategy:
|
|
15
|
+
matrix:
|
|
16
|
+
python-version: ["3.10.15", "3.11", "3.12", "3.13"]
|
|
17
|
+
os:
|
|
18
|
+
- "ubuntu-latest"
|
|
19
|
+
- "windows-latest"
|
|
20
|
+
- "macos-latest"
|
|
21
|
+
runs-on: ${{matrix.os}}
|
|
22
|
+
|
|
23
|
+
steps:
|
|
24
|
+
- uses: actions/checkout@v4
|
|
25
|
+
with:
|
|
26
|
+
fetch-depth: 0 # Needed for hatch-vcs to determine version
|
|
27
|
+
|
|
28
|
+
- name: Install the latest version of uv
|
|
29
|
+
uses: astral-sh/setup-uv@v6
|
|
30
|
+
|
|
31
|
+
- name: Install the project
|
|
32
|
+
run: uv sync --python ${{ matrix.python-version }} --extra pyside6
|
|
33
|
+
|
|
34
|
+
- name: Set up virtual display (Linux)
|
|
35
|
+
if: runner.os == 'Linux'
|
|
36
|
+
run: |
|
|
37
|
+
sudo apt-get update
|
|
38
|
+
sudo apt-get install -y libxkbcommon-x11-0 libegl1
|
|
39
|
+
|
|
40
|
+
- name: Lint
|
|
41
|
+
run: uv tool run ruff check --output-format=github src
|
|
42
|
+
|
|
43
|
+
- name: Run tests
|
|
44
|
+
env:
|
|
45
|
+
QT_QPA_PLATFORM: offscreen
|
|
46
|
+
run: uv run --python ${{ matrix.python-version }} pytest tests
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
|
|
27
|
+
# PyInstaller
|
|
28
|
+
*.manifest
|
|
29
|
+
*.spec
|
|
30
|
+
|
|
31
|
+
# Installer logs
|
|
32
|
+
pip-log.txt
|
|
33
|
+
pip-delete-this-directory.txt
|
|
34
|
+
|
|
35
|
+
# Unit test / coverage reports
|
|
36
|
+
htmlcov/
|
|
37
|
+
.tox/
|
|
38
|
+
.nox/
|
|
39
|
+
.coverage
|
|
40
|
+
.coverage.*
|
|
41
|
+
.cache
|
|
42
|
+
nosetests.xml
|
|
43
|
+
coverage.xml
|
|
44
|
+
*.cover
|
|
45
|
+
*.py,cover
|
|
46
|
+
.hypothesis/
|
|
47
|
+
.pytest_cache/
|
|
48
|
+
|
|
49
|
+
# Translations
|
|
50
|
+
*.mo
|
|
51
|
+
*.pot
|
|
52
|
+
|
|
53
|
+
# Environments
|
|
54
|
+
.env
|
|
55
|
+
.venv
|
|
56
|
+
env/
|
|
57
|
+
venv/
|
|
58
|
+
ENV/
|
|
59
|
+
env.bak/
|
|
60
|
+
venv.bak/
|
|
61
|
+
|
|
62
|
+
# IDE
|
|
63
|
+
.idea/
|
|
64
|
+
.vscode/
|
|
65
|
+
*.swp
|
|
66
|
+
*.swo
|
|
67
|
+
*~
|
|
68
|
+
|
|
69
|
+
# OS
|
|
70
|
+
.DS_Store
|
|
71
|
+
Thumbs.db
|
|
72
|
+
|
|
73
|
+
# Project specific
|
|
74
|
+
uv.lock
|
|
75
|
+
.ruff_cache/
|
|
76
|
+
|
|
77
|
+
# hatch-vcs generated version file
|
|
78
|
+
src/ezmsg/qt/__version__.py
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.13
|
ezmsg_qt-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 ezmsg-org
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# Migration Guide
|
|
2
|
+
|
|
3
|
+
## Session Ownership
|
|
4
|
+
|
|
5
|
+
`ezmsg-qt` now uses `EzSession` as the only public runtime owner.
|
|
6
|
+
|
|
7
|
+
Before:
|
|
8
|
+
|
|
9
|
+
```python
|
|
10
|
+
app = QtWidgets.QApplication([])
|
|
11
|
+
bridge = EzGuiBridge(app)
|
|
12
|
+
widget = MyWidget(bridge)
|
|
13
|
+
|
|
14
|
+
with bridge:
|
|
15
|
+
app.exec()
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
After:
|
|
19
|
+
|
|
20
|
+
```python
|
|
21
|
+
app = QtWidgets.QApplication([])
|
|
22
|
+
session = EzSession()
|
|
23
|
+
widget = MyWidget(session)
|
|
24
|
+
|
|
25
|
+
with session:
|
|
26
|
+
app.exec()
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
The public bridge object is gone; `EzSession` is now the only public runtime owner.
|
|
30
|
+
|
|
31
|
+
Attach endpoints explicitly:
|
|
32
|
+
|
|
33
|
+
```python
|
|
34
|
+
self.sub = EzSubscriber(MyTopic.OUTPUT, parent=self, session=session)
|
|
35
|
+
self.pub = EzPublisher(MyTopic.INPUT, parent=self, session=session)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Runtime Topic Switching
|
|
39
|
+
|
|
40
|
+
`EzSubscriber` can switch topics directly, and `EzPublisher` now supports the same API.
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
self.sub = EzSubscriber(MyTopic.A, parent=self, session=session)
|
|
44
|
+
self.pub = EzPublisher(MyTopic.B, parent=self, session=session)
|
|
45
|
+
|
|
46
|
+
self.sub.set_topic(MyTopic.C)
|
|
47
|
+
self.pub.set_topic(MyTopic.D)
|
|
48
|
+
|
|
49
|
+
self.sub.clear_topic()
|
|
50
|
+
self.pub.clear_topic()
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Notes:
|
|
54
|
+
|
|
55
|
+
- `set_topic(...)` and `clear_topic()` require a running session
|
|
56
|
+
- both calls block until the session applies the change
|
|
57
|
+
- `topic` reflects the currently active topic
|
|
58
|
+
|
|
59
|
+
## Processor Pipelines
|
|
60
|
+
|
|
61
|
+
`ProcessorChain` attaches to a session and always runs off the UI thread.
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
chain = (
|
|
65
|
+
ProcessorChain(MyTopic.RAW, parent=self)
|
|
66
|
+
.parallel(Filter)
|
|
67
|
+
.local(DisplayTransform)
|
|
68
|
+
.connect(self.on_data)
|
|
69
|
+
.attach(session)
|
|
70
|
+
)
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
- `.parallel(...)` runs a stage group in its own sidecar process
|
|
74
|
+
- `.local(...)` runs a stage group in the shared sidecar process
|
|
75
|
+
|
|
76
|
+
## Topic Normalization
|
|
77
|
+
|
|
78
|
+
Qt session topics follow ezmsg core enum semantics.
|
|
79
|
+
|
|
80
|
+
- `Enum` topics map to `Enum.name`
|
|
81
|
+
- string topics are used as-is
|
|
82
|
+
|
|
83
|
+
If your graph previously relied on `str(MyEnum.VALUE)`, update external graph
|
|
84
|
+
connections to use `MyEnum.VALUE.name` or the plain string topic name.
|
|
85
|
+
|
|
86
|
+
## Publisher Queueing
|
|
87
|
+
|
|
88
|
+
`EzPublisher` supports configurable queue policies:
|
|
89
|
+
|
|
90
|
+
- `unbounded`
|
|
91
|
+
- `block`
|
|
92
|
+
- `drop_oldest`
|
|
93
|
+
- `drop_latest`
|
|
94
|
+
- `coalesce_latest`
|
|
95
|
+
|
|
96
|
+
Example:
|
|
97
|
+
|
|
98
|
+
```python
|
|
99
|
+
self.pub = EzPublisher(
|
|
100
|
+
MyTopic.INPUT,
|
|
101
|
+
parent=self,
|
|
102
|
+
session=session,
|
|
103
|
+
queue_policy="coalesce_latest",
|
|
104
|
+
max_pending=1,
|
|
105
|
+
)
|
|
106
|
+
```
|
ezmsg_qt-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: ezmsg-qt
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Qt integration for ezmsg with direct topic-based pub/sub
|
|
5
|
+
Author-email: Preston Peranich <pperanich@gmail.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Python: >=3.10
|
|
9
|
+
Requires-Dist: ezmsg>=3.8
|
|
10
|
+
Requires-Dist: qtpy>=2.4.1
|
|
11
|
+
Provides-Extra: examples
|
|
12
|
+
Requires-Dist: ezmsg-baseproc; extra == 'examples'
|
|
13
|
+
Requires-Dist: fastplotlib>=0.6.1; extra == 'examples'
|
|
14
|
+
Requires-Dist: numpy>=2.0.0; extra == 'examples'
|
|
15
|
+
Provides-Extra: pyqt6
|
|
16
|
+
Requires-Dist: pyqt6>=6.0.0; extra == 'pyqt6'
|
|
17
|
+
Provides-Extra: pyside6
|
|
18
|
+
Requires-Dist: pyside6>=6.0.0; extra == 'pyside6'
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
|
|
21
|
+
# ezmsg-qt
|
|
22
|
+
|
|
23
|
+
Qt-native pub/sub runtime for connecting GUIs to ezmsg graphs.
|
|
24
|
+
|
|
25
|
+
## Overview
|
|
26
|
+
|
|
27
|
+
`ezmsg-qt` lets Qt widgets publish to and subscribe from ezmsg topics using a
|
|
28
|
+
familiar signal/slot style while keeping ezmsg runtime ownership explicit.
|
|
29
|
+
|
|
30
|
+
- `EzSession` owns the ezmsg runtime thread, `GraphContext`, and sidecar pipelines
|
|
31
|
+
- `EzSubscriber` and `EzPublisher` attach to a session
|
|
32
|
+
- `ProcessorChain` compiles processing stages into a sidecar runtime owned by the session
|
|
33
|
+
|
|
34
|
+
## Quick Start
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
from enum import Enum, auto
|
|
38
|
+
from qtpy import QtWidgets
|
|
39
|
+
|
|
40
|
+
from ezmsg.qt import EzPublisher, EzSession, EzSubscriber
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class VelocityTopic(Enum):
|
|
44
|
+
INPUT_SETTINGS = auto()
|
|
45
|
+
OUTPUT_DATA = auto()
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class VelocityWidget(QtWidgets.QWidget):
|
|
49
|
+
def __init__(self, session: EzSession):
|
|
50
|
+
super().__init__()
|
|
51
|
+
|
|
52
|
+
self.slider = QtWidgets.QSlider()
|
|
53
|
+
self.label = QtWidgets.QLabel("Waiting for data...")
|
|
54
|
+
|
|
55
|
+
self.data_sub = EzSubscriber(
|
|
56
|
+
VelocityTopic.OUTPUT_DATA,
|
|
57
|
+
parent=self,
|
|
58
|
+
session=session,
|
|
59
|
+
)
|
|
60
|
+
self.settings_pub = EzPublisher(
|
|
61
|
+
VelocityTopic.INPUT_SETTINGS,
|
|
62
|
+
parent=self,
|
|
63
|
+
session=session,
|
|
64
|
+
)
|
|
65
|
+
|
|
66
|
+
self.data_sub.connect(self.on_data)
|
|
67
|
+
self.slider.valueChanged.connect(self.on_slider)
|
|
68
|
+
|
|
69
|
+
def on_data(self, msg):
|
|
70
|
+
self.label.setText(f"Received: {msg}")
|
|
71
|
+
|
|
72
|
+
def on_slider(self, value):
|
|
73
|
+
self.settings_pub.emit({"gain": value})
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
def main() -> None:
|
|
77
|
+
app = QtWidgets.QApplication([])
|
|
78
|
+
session = EzSession()
|
|
79
|
+
window = VelocityWidget(session)
|
|
80
|
+
window.show()
|
|
81
|
+
|
|
82
|
+
with session:
|
|
83
|
+
app.exec()
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
## Runtime Topic Switching
|
|
87
|
+
|
|
88
|
+
`EzSubscriber` can retarget to a new topic at runtime without reconnecting Qt slots.
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
class TopicSwitcher(QtWidgets.QWidget):
|
|
92
|
+
def __init__(self, session: EzSession):
|
|
93
|
+
super().__init__()
|
|
94
|
+
self.sub = EzSubscriber(MyTopic.A, parent=self, session=session)
|
|
95
|
+
self.sub.connect(self.on_data)
|
|
96
|
+
|
|
97
|
+
def switch_to_b(self) -> None:
|
|
98
|
+
self.sub.set_topic(MyTopic.B)
|
|
99
|
+
|
|
100
|
+
def pause_updates(self) -> None:
|
|
101
|
+
self.sub.clear_topic()
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
- `set_topic(...)` blocks until the running session applies the switch
|
|
105
|
+
- `clear_topic()` disconnects the subscriber from all topics
|
|
106
|
+
- `topic` reflects the currently active topic
|
|
107
|
+
- topic switching requires the subscriber to be attached to a running session
|
|
108
|
+
- signals available for UI state: `switch_started`, `topic_changed`, `topic_cleared`, `switch_failed`
|
|
109
|
+
|
|
110
|
+
## Local Processing
|
|
111
|
+
|
|
112
|
+
Use `ProcessorChain` when widget-facing data needs ezmsg processing off the UI thread.
|
|
113
|
+
|
|
114
|
+
```python
|
|
115
|
+
from ezmsg.qt import EzSession, ProcessorChain
|
|
116
|
+
|
|
117
|
+
session = EzSession()
|
|
118
|
+
|
|
119
|
+
chain = (
|
|
120
|
+
ProcessorChain(MyTopic.RAW, parent=widget)
|
|
121
|
+
.parallel(LowPassFilter)
|
|
122
|
+
.local(ThresholdDetector)
|
|
123
|
+
.connect(widget.on_processed)
|
|
124
|
+
.attach(session)
|
|
125
|
+
)
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
- `.parallel(...)` runs a stage group in its own sidecar process
|
|
129
|
+
- `.local(...)` runs a stage group in the shared sidecar process
|
|
130
|
+
- neither mode runs on the Qt UI thread
|
|
131
|
+
|
|
132
|
+
## External Graphs
|
|
133
|
+
|
|
134
|
+
Point a session at an existing `GraphRunner` or `GraphServer` by providing
|
|
135
|
+
`graph_address`.
|
|
136
|
+
|
|
137
|
+
```python
|
|
138
|
+
runner.start()
|
|
139
|
+
session = EzSession(graph_address=runner.graph_address)
|
|
140
|
+
try:
|
|
141
|
+
with session:
|
|
142
|
+
app.exec()
|
|
143
|
+
finally:
|
|
144
|
+
if runner.running:
|
|
145
|
+
runner.stop()
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
## API Reference
|
|
149
|
+
|
|
150
|
+
### EzSession
|
|
151
|
+
|
|
152
|
+
```python
|
|
153
|
+
session = EzSession(graph_address=None)
|
|
154
|
+
with session:
|
|
155
|
+
app.exec()
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
- `graph_address`: Optional GraphServer address
|
|
159
|
+
- `attach(obj)`: Attach an `EzSubscriber`, `EzPublisher`, or `ProcessorChain`
|
|
160
|
+
- `detach(obj)`: Detach an `EzSubscriber` or `EzPublisher`
|
|
161
|
+
- `running`: Whether the session runtime is active
|
|
162
|
+
|
|
163
|
+
### EzSubscriber
|
|
164
|
+
|
|
165
|
+
```python
|
|
166
|
+
EzSubscriber(
|
|
167
|
+
topic: Enum | str | None = None,
|
|
168
|
+
parent: QObject = None,
|
|
169
|
+
*,
|
|
170
|
+
session: EzSession | None = None,
|
|
171
|
+
leaky: bool = False,
|
|
172
|
+
max_queue: int | None = None,
|
|
173
|
+
throttle_hz: float | None = None,
|
|
174
|
+
)
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
- `session`: The session that owns this subscriber
|
|
178
|
+
- `connect(slot)`: Connect a handler to receive messages
|
|
179
|
+
- `set_topic(topic)`: Switch to a new topic on a running session
|
|
180
|
+
- `clear_topic()`: Unsubscribe from the current topic on a running session
|
|
181
|
+
- `received`: Qt signal emitted when a message arrives
|
|
182
|
+
- `switch_started`, `topic_changed`, `topic_cleared`, `switch_failed`: lifecycle signals for runtime switching
|
|
183
|
+
|
|
184
|
+
### EzPublisher
|
|
185
|
+
|
|
186
|
+
```python
|
|
187
|
+
EzPublisher(
|
|
188
|
+
topic: Enum | str | None = None,
|
|
189
|
+
parent: QObject = None,
|
|
190
|
+
*,
|
|
191
|
+
session: EzSession | None = None,
|
|
192
|
+
queue_policy: QueuePolicy = "unbounded",
|
|
193
|
+
max_pending: int | None = None,
|
|
194
|
+
)
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
- `session`: The session that owns this publisher
|
|
198
|
+
- `emit(message)`: Send a message to the topic
|
|
199
|
+
- `set_topic(topic)`: Switch to a new topic on a running session
|
|
200
|
+
- `clear_topic()`: Unpublish from the current topic on a running session
|
|
201
|
+
- `switch_started`, `topic_changed`, `topic_cleared`, `switch_failed`: lifecycle signals for runtime switching
|
|
202
|
+
|
|
203
|
+
## Installation
|
|
204
|
+
|
|
205
|
+
Install from PyPI:
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
pip install ezmsg-qt
|
|
209
|
+
```
|
|
210
|
+
|
|
211
|
+
You also need a Qt binding — pick one:
|
|
212
|
+
|
|
213
|
+
```bash
|
|
214
|
+
pip install ezmsg-qt[pyqt6] # or
|
|
215
|
+
pip install ezmsg-qt[pyside6]
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Or install the latest development version:
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
pip install git+https://github.com/ezmsg-org/ezmsg-qt@main
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Development
|
|
225
|
+
|
|
226
|
+
We use [`uv`](https://docs.astral.sh/uv/getting-started/installation/) for development.
|
|
227
|
+
|
|
228
|
+
1. Install [`uv`](https://docs.astral.sh/uv/getting-started/installation/) if not already installed.
|
|
229
|
+
2. Fork this repository and clone your fork locally.
|
|
230
|
+
3. Open a terminal and `cd` to the cloned folder.
|
|
231
|
+
4. Run `uv sync --extra pyside6` to create a `.venv` and install dependencies.
|
|
232
|
+
5. (Optional) Install pre-commit hooks: `uv run pre-commit install`
|
|
233
|
+
6. After making changes, run the test suite: `uv run pytest tests`
|
|
234
|
+
|
|
235
|
+
## License
|
|
236
|
+
|
|
237
|
+
MIT License - see [LICENSE](LICENSE) for details.
|