Skip to content

Commit dea4895

Browse files
Mike ProsserMike Prosser
authored andcommitted
rework streamlit and numpy deps to work better with python 3.9
1 parent 2d3f737 commit dea4895

File tree

7 files changed

+376
-185
lines changed

7 files changed

+376
-185
lines changed

CONTRIBUTING.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -56,15 +56,14 @@ start docs\_build\index.html
5656

5757
## Running examples
5858

59-
1. First, run the PythonPanelService (not part of this repo, provided seperately)
60-
2. Run the command `poetry run python examples/hello/hello.py`
61-
3. Open http://localhost:42001/panel-service/panels/hello_panel/ in your browser
62-
4. If there is an error about missing imports (especially nipanel), execute this
63-
command (from the nipanel-python directory) to install the dependencies into the venv:
64-
`%localappdata%\Temp\python_panel_service_venv\Scripts\python.exe -m pip install .\[examples,dev]`,
65-
then restart the PythonPanelService and re-run hello.py.
66-
67-
You can see all running panels (and stop them) at: http://localhost:42001/panel-service/
59+
1. Run the **PythonPanelService** (not part of this repo, provided seperately)
60+
2. `poetry install --with examples` to get the dependencies needed for the examples
61+
3. Run the command(s):
62+
- `poetry run python examples/hello/hello.py`
63+
- `poetry run python examples/all_types/all_types.py`
64+
- `poetry run python examples/simple_graph/simple_graph.py`
65+
- `poetry run python examples/nidaqmx/nidaqmx_continuous_analog_input.py` (requires real or simulated devices)
66+
4. Open http://localhost:42001/panel-service/ in your browser, which will show all running panels
6867

6968
# Debugging on the streamlit side
7069

examples/all_types/all_types_panel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
import nipanel
77

8-
panel = nipanel.get_panel_accessor()
98

109
st.set_page_config(page_title="All Types Example", page_icon="📊", layout="wide")
1110
st.title("All Types Example")
1211

12+
panel = nipanel.get_panel_accessor()
1313
for name in all_types_with_values.keys():
1414
col1, col2 = st.columns([0.4, 0.6])
1515

examples/hello/hello_panel.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@
44

55
import nipanel
66

7-
panel = nipanel.get_panel_accessor()
87

98
st.set_page_config(page_title="Hello World Example", page_icon="📊", layout="wide")
109
st.title("Hello World Example")
10+
11+
panel = nipanel.get_panel_accessor()
1112
st.write(panel.get_value("hello_string", ""))

examples/nidaqmx/nidaqmx_continuous_analog_input.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,9 @@
2121
try:
2222
print(f"\nPress Ctrl + C to stop")
2323
while True:
24-
data = task.read(number_of_samples_per_channel=1000)
24+
data = task.read(
25+
number_of_samples_per_channel=1000 # pyright: ignore[reportArgumentType]
26+
)
2527
panel.set_value("voltage_data", data[0])
2628
panel.set_value("thermocouple_data", data[1])
2729
except KeyboardInterrupt:

examples/simple_graph/simple_graph_panel.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55

66
import nipanel
77

8-
panel = nipanel.get_panel_accessor()
98

109
st.set_page_config(page_title="Simple Graph Example", page_icon="📈", layout="wide")
1110
st.title("Simple Graph Example")
1211

12+
panel = nipanel.get_panel_accessor()
1313
time_points = panel.get_value("time_points", [0.0])
1414
sine_values = panel.get_value("sine_values", [0.0])
1515
amplitude = panel.get_value("amplitude", 1.0)

poetry.lock

Lines changed: 353 additions & 170 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,15 @@ grpcio = {version=">=1.49.0,<2.0"}
1212
protobuf = {version=">=4.21"}
1313
ni-measurement-plugin-sdk = {version=">=2.3"}
1414
typing-extensions = ">=4.13.2"
15-
streamlit = ">=1.24"
16-
streamlit-echarts = ">=0.4.0"
15+
streamlit = [
16+
{version=">=1.24,<1.33", python=">=3.9,<3.10"},
17+
{version=">=1.24", python=">=3.10"}
18+
]
1719
nitypes = {version=">=0.1.0dev2", allow-prereleases=true}
20+
numpy = [
21+
{version=">=1.20.0,<2.0.0", python=">=3.9,<3.10"},
22+
{version=">=2.0.0", python=">=3.10"}
23+
]
1824
debugpy = ">=1.8.1"
1925

2026
[tool.poetry.group.dev.dependencies]

0 commit comments

Comments
 (0)