Add a panel accessor class for streamlit scripts to call#31
Merged
Conversation
Contributor
added 8 commits
May 22, 2025 16:29
There was a problem hiding this comment.
Pull Request Overview
Adds a generic panel accessor and streamlines Streamlit panel APIs while updating dependencies
- Introduce PanelAccessor and specialized StreamlitPanelAccessor to consolidate get/set logic
- Refactor StreamlitPanel to inherit from PanelAccessor and use a shared constant
- Bump Python requirement to 3.9.8 and add Streamlit dependency; update tests for the new accessor
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/test_streamlit_panel.py | Updated imports and added tests for StreamlitPanelAccessor |
| src/nipanel/_streamlit_panel_accessor.py | New StreamlitPanelAccessor class wrapping PanelAccessor |
| src/nipanel/_streamlit_panel.py | Refactored to inherit PanelAccessor and use STREAMLIT_PYTHON_PANEL_SERVICE |
| src/nipanel/_streamlit_constants.py | New constant for the Streamlit panel service interface |
| src/nipanel/_panel_accessor.py | New base class consolidating get/set value functionality |
| src/nipanel/_panel.py | Refactored Panel to subclass PanelAccessor, removed duplication |
| src/nipanel/init.py | Exported StreamlitPanelAccessor |
| pyproject.toml | Bumped Python to ^3.9.8 and added Streamlit >=1.24 dependency |
Comments suppressed due to low confidence (3)
src/nipanel/_panel.py:7
- GrpcChannelPool is imported but unused in this file. Consider removing the import to keep the code clean.
from ni_measurement_plugin_sdk_service.grpc.channelpool import GrpcChannelPool
src/nipanel/_panel_accessor.py:22
- The constructor docstring only documents
panel_idandgrpc_channel. Please add entries fordiscovery_clientandgrpc_channel_poolto fully describe all parameters.
"""Create an accessor for a Streamlit panel.
src/nipanel/_panel.py:12
- The class references ABC but does not import it. Add
from abc import ABCat the top of the file to avoid a NameError.
class Panel(PanelAccessor, ABC):
csjall
approved these changes
May 23, 2025
bkeryan
approved these changes
May 24, 2025
bkeryan
left a comment
Collaborator
There was a problem hiding this comment.
Approved with suggestions
added 3 commits
May 27, 2025 09:19
…s/mprosser/task-3121341-panel-accessor
jfriedri-ni
reviewed
May 27, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this Pull Request accomplish?
The PythonPanelService has two clients, the measurement script and the streamlit script. This PR is providing a new
PanelAccessorclass for the streamlit script to use to get/set values for controls. UnlikePanel, thePanelAccessorcannot open or close panels, it can only get and set values.Note, I changed the available python versions of this project to exclude 3.9.7, because streamlit (which is now a dependency) doesn't work with 3.9.7.
Why should this Pull Request be merged?
Implements AB#3121341 - Create client library to connect Streamlit panel to Python Panel Service
What testing has been done?
Added new autotests