Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,17 @@ poetry run sphinx-build docs docs/_build --builder html --fail-on-warning
start docs\_build\index.html
```

## Running examples

1. First, run the PythonPanelService (not part of this repo, provided seperately)
2. Run the command `poetry run python examples/sample/sample.py`
3. Open http://localhost:42001/panel-service/panels/sample_panel/ in your browser
4. If there is an error about missing imports (especially nipanel), execute this
command to install the dependencies into the venv: `C:\Users\mprosser\AppData\Local\Temp\python_panel_service_venv\Scripts\python.exe
-m pip install C:\dev\fireserp\nipanel-python[examples,dev]`, then restart the PythonPanelService and re-run sample.py.

You can see all running panels (and stop them) at: http://localhost:42001/panel-service/

# Debugging on the streamlit side

Debugging the measurement script can be done using standard Python debugging
Expand Down
2 changes: 1 addition & 1 deletion examples/all_types/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ This is an example for `nipanel` that demonstrates all supported data types

### Usage

Run `poetry run examples/all_types/all_types.py`
Run `poetry run python examples/all_types/all_types.py`
2 changes: 1 addition & 1 deletion examples/sample/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ This is a nipanel example that displays an interactive Streamlit app and updates

### Usage

Run `poetry run examples/sample/sample.py`
Run `poetry run python examples/sample/sample.py`
2 changes: 1 addition & 1 deletion examples/simple_graph/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ This example demonstrates using nipanel with Streamlit to display a dynamic sine

### Usage

Run `poetry run examples/simple_graph/simple_graph.py`
Run `poetry run python examples/simple_graph/simple_graph.py`
2 changes: 1 addition & 1 deletion examples/simple_graph/simple_graph_panel.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Example of displaying a sine wave using streamlit-echarts in a nipanel."""

import streamlit as st
from streamlit_echarts import st_echarts
from streamlit_echarts import st_echarts # type: ignore

from nipanel import initialize_panel

Expand Down
7 changes: 6 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ protobuf = {version=">=4.21"}
ni-measurement-plugin-sdk = {version=">=2.3"}
typing-extensions = ">=4.13.2"
streamlit = ">=1.24"
streamlit-echarts = ">=0.4.0"
nitypes = {version=">=0.1.0dev2", allow-prereleases=true}
debugpy = ">=1.8.1"

Expand Down Expand Up @@ -53,6 +52,12 @@ sphinx-autoapi = ">=1.8.4"
m2r2 = ">=0.3.2"
toml = ">=0.10.2"

[tool.poetry.group.examples]
optional = true

[tool.poetry.group.examples.dependencies]
streamlit-echarts = ">=0.4.0"

[build-system]
requires = ["poetry-core>=1.8.0"]
build-backend = "poetry.core.masonry.api"
Expand Down
2 changes: 1 addition & 1 deletion src/nipanel/converters/protobuf_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ def _value_to_attribute(self, value: ExtendedPropertyValue) -> WaveformAttribute
def to_python_value(self, protobuf_message: DoubleAnalogWaveform) -> AnalogWaveform[np.float64]:
"""Convert the protobuf DoubleAnalogWaveform to a Python AnalogWaveform."""
# Declare timing to accept both bintime and dt.datetime to satisfy mypy.
timing: Timing[bt.DateTime | dt.datetime]
timing: Timing[Union[bt.DateTime, dt.datetime]]
if not protobuf_message.dt and not protobuf_message.HasField("t0"):
# If both dt and t0 are unset, use Timing.empty.
timing = Timing.empty
Expand Down
Loading