Skip to content

Commit f259379

Browse files
Mike ProsserMike Prosser
authored andcommitted
Merge remote-tracking branch 'origin/main' into users/mprosser/add-more-samples
2 parents 4c1483e + 58bd0c3 commit f259379

24 files changed

+819
-121
lines changed

.github/renovate.json

Lines changed: 0 additions & 11 deletions
This file was deleted.

.github/renovate.json5

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
3+
"branchPrefix": "users/renovate/",
4+
"extends": [
5+
"config:recommended",
6+
":maintainLockFilesWeekly",
7+
":automergePatch",
8+
"schedule:automergeDaily",
9+
"helpers:pinGitHubActionDigestsToSemver",
10+
":enableVulnerabilityAlerts"
11+
],
12+
"packageRules": [
13+
{
14+
// Do not update Python packages when new versions are released. Instead,
15+
// let lock file maintenance update them once a week.
16+
"enabled": false,
17+
"matchCategories": ["python"]
18+
}
19+
],
20+
"osvVulnerabilityAlerts": true
21+
}

.github/workflows/check_docs.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
- name: Check out repo
1313
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1414
- name: Set up Python
15-
uses: ni/python-actions/setup-python@97860b52be87c788fb6df812bd8d1ca68c7aa885 # v0.3.0
15+
uses: ni/python-actions/setup-python@a3bfe1baa6062fd6157683651d653d527967d4d4 # v0.3.1
1616
id: setup-python
1717
- name: Set up Poetry
18-
uses: ni/python-actions/setup-poetry@97860b52be87c788fb6df812bd8d1ca68c7aa885 # v0.3.0
18+
uses: ni/python-actions/setup-poetry@a3bfe1baa6062fd6157683651d653d527967d4d4 # v0.3.1
1919
- name: Check for lock changes
2020
run: poetry check --lock
2121
- name: Cache virtualenv (with docs)

.github/workflows/check_nipanel.yml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ jobs:
1212
- name: Check out repo
1313
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
1414
- name: Set up Python
15-
uses: ni/python-actions/setup-python@97860b52be87c788fb6df812bd8d1ca68c7aa885 # v0.3.0
15+
uses: ni/python-actions/setup-python@a3bfe1baa6062fd6157683651d653d527967d4d4 # v0.3.1
1616
id: setup-python
1717
- name: Set up Poetry
18-
uses: ni/python-actions/setup-poetry@97860b52be87c788fb6df812bd8d1ca68c7aa885 # v0.3.0
18+
uses: ni/python-actions/setup-poetry@a3bfe1baa6062fd6157683651d653d527967d4d4 # v0.3.1
1919
- name: Check for lock changes
2020
run: poetry check --lock
2121
- name: Cache virtualenv
@@ -33,3 +33,15 @@ jobs:
3333
run: poetry run mypy --platform win32
3434
- name: Bandit security checks
3535
run: poetry run bandit -c pyproject.toml -r src/nipanel
36+
- name: Add virtualenv to the path for pyright-action
37+
run: echo "$(poetry env info --path)/bin" >> $GITHUB_PATH
38+
- name: Pyright static analysis (Linux)
39+
uses: jakebailey/pyright-action@b5d50e5cde6547546a5c4ac92e416a8c2c1a1dfe # v2.3.2
40+
with:
41+
python-platform: Linux
42+
version: PATH
43+
- name: Pyright static analysis (Windows)
44+
uses: jakebailey/pyright-action@b5d50e5cde6547546a5c4ac92e416a8c2c1a1dfe # v2.3.2
45+
with:
46+
python-platform: Windows
47+
version: PATH

.github/workflows/run_unit_tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ jobs:
1919
- name: Check out repo
2020
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
2121
- name: Set up Python
22-
uses: ni/python-actions/setup-python@97860b52be87c788fb6df812bd8d1ca68c7aa885 # v0.3.0
22+
uses: ni/python-actions/setup-python@a3bfe1baa6062fd6157683651d653d527967d4d4 # v0.3.1
2323
id: setup-python
2424
with:
2525
python-version: ${{ matrix.python-version }}
2626
- name: Set up Poetry
27-
uses: ni/python-actions/setup-poetry@97860b52be87c788fb6df812bd8d1ca68c7aa885 # v0.3.0
27+
uses: ni/python-actions/setup-poetry@a3bfe1baa6062fd6157683651d653d527967d4d4 # v0.3.1
2828
- name: Cache virtualenv
2929
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
3030
with:

.gitignore

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,3 @@ cython_debug/
172172

173173
# PyPI configuration file
174174
.pypirc
175-
176-
# VS Code settings
177-
.vscode/launch.json

.vscode/launch.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
// Use IntelliSense to learn about possible attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"name": "Python Debugger: Current File",
9+
"type": "debugpy",
10+
"request": "launch",
11+
"program": "${file}",
12+
"console": "integratedTerminal"
13+
},
14+
{
15+
// To use this configuration, add `debugpy.listen(("localhost", 5678))` to the script you wish to debug
16+
"name": "Attach to Streamlit at localhost:5678",
17+
"type": "debugpy",
18+
"request": "attach",
19+
"connect": {
20+
"host": "localhost",
21+
"port": 5678
22+
},
23+
"justMyCode": false
24+
}
25+
]
26+
}

CONTRIBUTING.md

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,11 @@ start docs\_build\index.html
5656

5757
# Debugging on the streamlit side
5858

59-
Debugging the measurement script can be done using standard Python debugging techniques. However, debugging the Streamlit script—or any code invoked by the Streamlit script—is more complex because it runs in a separate process launched by the PythonPanelServer. To debug the Streamlit script, you can use debugpy to attach the Visual Studio Code debugger as follows:
59+
Debugging the measurement script can be done using standard Python debugging
60+
techniques. However, debugging the Streamlit script—or any code invoked by the
61+
Streamlit script—is more complex because it runs in a separate process launched
62+
by the PythonPanelServer. To debug the Streamlit script, you can use debugpy to
63+
attach the Visual Studio Code debugger as follows:
6064

6165
## Instrument Streamlit script to debug
6266

@@ -73,9 +77,15 @@ except RuntimeError as e:
7377
raise
7478
```
7579

76-
The `debugpy.listen()` function opens a port that allows the debugger to attach to the running process. You can specify any available port, as long as it matches the port configured in the launch.json file shown below. Since calling listen() more than once will raise an exception, it is wrapped in a try block to prevent the script from crashing if it is rerun.
80+
The `debugpy.listen()` function opens a port that allows the debugger to attach
81+
to the running process. You can specify any available port, as long as it
82+
matches the port configured in the launch.json file shown below. Since calling
83+
listen() more than once will raise an exception, it is wrapped in a try block to
84+
prevent the script from crashing if it is rerun.
7785

78-
The `debugpy.wait_for_client()` function pauses script execution until the debugger is attached. This is helpful if you need to debug initialization code, but you can omit this line if it is not required.
86+
The `debugpy.wait_for_client()` function pauses script execution until the
87+
debugger is attached. This is helpful if you need to debug initialization code,
88+
but you can omit this line if it is not required.
7989

8090
The `import debugpy` statement includes a type suppression comment to satisfy mypy.
8191

@@ -96,7 +106,12 @@ You will also need this configuration in your launch.json:
96106
}
97107
```
98108

99-
After running your measurement script and allowing the PythonPanelServer to launch Streamlit with your Streamlit script, you can attach the debugger by clicking the **Attach to Streamlit at localhost:5678** button in the VS Code **Run and Debug** tab. Once attached, you can set breakpoints and use all standard debugging features in your Streamlit script, as well as in any nipanel code invoked by the Streamlit script.
109+
After running your measurement script and allowing the PythonPanelServer to
110+
launch Streamlit with your Streamlit script, you can attach the debugger by
111+
clicking the **Attach to Streamlit at localhost:5678** button in the VS Code
112+
**Run and Debug** tab. Once attached, you can set breakpoints and use all
113+
standard debugging features in your Streamlit script, as well as in any nipanel
114+
code invoked by the Streamlit script.
100115

101116
# Developer Certificate of Origin (DCO)
102117

docs/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,13 +73,13 @@ def setup(sphinx):
7373
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
7474

7575

76-
# TODO: AB#3120159 - Update nipanel intersphinx mapping for nitypes
7776
intersphinx_mapping = {
7877
"grpc": ("https://grpc.github.io/grpc/python/", None),
7978
"measurement-plugin-python": (
8079
"https://measurement-plugin-python.readthedocs.io/en/latest/",
8180
None,
8281
),
82+
"nitypes": ("https://nitypes.readthedocs.io/en/latest/", None),
8383
"numpy": ("https://numpy.org/doc/stable/", None),
8484
"protobuf": ("https://googleapis.dev/python/protobuf/latest/", None),
8585
"python": ("https://docs.python.org/3", None),

examples/sample/sample_panel.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
st.write("List")
1919

2020
with col2:
21-
st.write(panel.get_value("sample_string"))
22-
st.write(panel.get_value("sample_int"))
23-
st.write(panel.get_value("sample_float"))
24-
st.write(panel.get_value("sample_bool"))
25-
st.write(panel.get_value("float_values"))
21+
st.write(panel.get_value("sample_string", ""))
22+
st.write(panel.get_value("sample_int", 0))
23+
st.write(panel.get_value("sample_float", 0.0))
24+
st.write(panel.get_value("sample_bool", False))
25+
st.write(panel.get_value("float_values", []))

0 commit comments

Comments
 (0)