Skip to content

Commit 5af7a1e

Browse files
Mike ProsserMike Prosser
authored andcommitted
update proto and implementations and tests
1 parent dfe8a7e commit 5af7a1e

14 files changed

+368
-436
lines changed

examples/placeholder.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ class MyStrEnum(str, enum.Enum):
3232
if __name__ == "__main__":
3333
my_panel = nipanel.StreamlitPanel(
3434
panel_id="placeholder",
35-
streamlit_script_uri=__file__,
35+
streamlit_script_path=__file__,
3636
)
3737

3838
my_types = {

examples/sample/sample.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,12 @@
99

1010
panel = nipanel.StreamlitPanel(
1111
panel_id="sample_panel",
12-
streamlit_script_uri=panel_script_path,
12+
streamlit_script_path=panel_script_path,
1313
)
14-
panel.open_panel()
1514
panel.set_value("sample_string", "Hello, World!")
1615
panel.set_value("sample_int", 42)
1716
panel.set_value("sample_float", 3.14)
1817
panel.set_value("sample_bool", True)
1918
panel.set_value("float_values", [1.1, 2.2, 3.3])
2019

21-
input("Press Enter to close the panel...")
22-
23-
panel.close_panel(reset=True)
20+
print(f"Panel URL: {panel.panel_url}")

protos/ni/pythonpanel/v1/python_panel_service.proto

Lines changed: 35 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,20 @@ option ruby_package = "NI::PythonPanel::V1";
1616

1717
// Service interface for interacting with python panels
1818
service PythonPanelService {
19-
// Enumerate the panels available in the system, including information about the state of the panels and what values they have.
19+
// Start a panel (or connect to if it has already been started)
2020
// Status Codes for errors:
21-
rpc EnumeratePanels(EnumeratePanelsRequest) returns (EnumeratePanelsResponse);
21+
// - INVALID_ARGUMENT: The specified identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
22+
// - NOT_FOUND: the file for the panel was not found
23+
rpc StartPanel(StartPanelRequest) returns (StartPanelResponse);
2224

23-
// Open a panel
25+
// Stop a panel
2426
// Status Codes for errors:
2527
// - INVALID_ARGUMENT: The specified identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
26-
// - NOT_FOUND: the file for the panel was not found
27-
rpc OpenPanel(OpenPanelRequest) returns (OpenPanelResponse);
28+
rpc StopPanel(StopPanelRequest) returns (StopPanelResponse);
29+
30+
// Enumerate the panels available in the system, including information about the state of the panels and what values they have.
31+
// Status Codes for errors:
32+
rpc EnumeratePanels(EnumeratePanelsRequest) returns (EnumeratePanelsResponse);
2833

2934
// Get a value for a control on the panel
3035
// Status Codes for errors:
@@ -36,41 +41,49 @@ service PythonPanelService {
3641
// Status Codes for errors:
3742
// - INVALID_ARGUMENT: The specified identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
3843
rpc SetValue(SetValueRequest) returns (SetValueResponse);
44+
}
3945

40-
// Close a panel
41-
// Status Codes for errors:
42-
// - INVALID_ARGUMENT: The specified identifier contains invalid characters. Only alphanumeric characters and underscores are allowed.
43-
rpc ClosePanel(ClosePanelRequest) returns (ClosePanelResponse);
46+
message StartPanelRequest {
47+
// Unique ID of the panel
48+
string panel_id = 1;
49+
50+
// Absolute path of the panel script's file on disk, or network path to the file
51+
string panel_script_path = 2;
4452
}
4553

46-
message EnumeratePanelsRequest {
54+
message StartPanelResponse {
55+
// Location of the panel's webpage
56+
string panel_url = 1;
4757
}
4858

49-
message PanelInformation {
59+
message StopPanelRequest {
5060
// Unique ID of the panel
5161
string panel_id = 1;
5262

53-
// Is the panel currently open?
54-
bool is_open = 2;
63+
// Reset all storage associated with panel
64+
bool reset = 2;
65+
}
5566

56-
// IDs of all of the values associated with the panel
57-
repeated string value_ids = 3;
67+
message StopPanelResponse {
5868
}
5969

60-
message EnumeratePanelsResponse {
61-
// The list of panels available in the system
62-
repeated PanelInformation panels = 1;
70+
message EnumeratePanelsRequest {
6371
}
6472

65-
message OpenPanelRequest {
73+
message PanelInformation {
6674
// Unique ID of the panel
6775
string panel_id = 1;
6876

69-
// Absolute path of the panel's file on disk, or network path to the file
70-
string panel_uri = 2;
77+
// Location of the panel's webpage
78+
string panel_url = 2;
79+
80+
// IDs of all of the values associated with the panel
81+
repeated string value_ids = 3;
7182
}
7283

73-
message OpenPanelResponse {
84+
message EnumeratePanelsResponse {
85+
// The list of panels available in the system
86+
repeated PanelInformation panels = 1;
7487
}
7588

7689
message GetValueRequest {
@@ -98,15 +111,4 @@ message SetValueRequest {
98111
}
99112

100113
message SetValueResponse {
101-
}
102-
103-
message ClosePanelRequest {
104-
// Unique ID of the panel
105-
string panel_id = 1;
106-
107-
// Reset all storage associated with panel
108-
bool reset = 2;
109-
}
110-
111-
message ClosePanelResponse {
112114
}

src/ni/pythonpanel/v1/python_panel_service_pb2.py

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

src/ni/pythonpanel/v1/python_panel_service_pb2.pyi

Lines changed: 69 additions & 63 deletions
Original file line numberDiff line numberDiff line change
@@ -14,88 +14,124 @@ import typing
1414
DESCRIPTOR: google.protobuf.descriptor.FileDescriptor
1515

1616
@typing.final
17-
class EnumeratePanelsRequest(google.protobuf.message.Message):
17+
class StartPanelRequest(google.protobuf.message.Message):
1818
DESCRIPTOR: google.protobuf.descriptor.Descriptor
1919

20+
PANEL_ID_FIELD_NUMBER: builtins.int
21+
PANEL_SCRIPT_PATH_FIELD_NUMBER: builtins.int
22+
panel_id: builtins.str
23+
"""Unique ID of the panel"""
24+
panel_script_path: builtins.str
25+
"""Absolute path of the panel script's file on disk, or network path to the file"""
2026
def __init__(
2127
self,
28+
*,
29+
panel_id: builtins.str = ...,
30+
panel_script_path: builtins.str = ...,
2231
) -> None: ...
32+
def ClearField(self, field_name: typing.Literal["panel_id", b"panel_id", "panel_script_path", b"panel_script_path"]) -> None: ...
2333

24-
global___EnumeratePanelsRequest = EnumeratePanelsRequest
34+
global___StartPanelRequest = StartPanelRequest
2535

2636
@typing.final
27-
class PanelInformation(google.protobuf.message.Message):
37+
class StartPanelResponse(google.protobuf.message.Message):
38+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
39+
40+
PANEL_URL_FIELD_NUMBER: builtins.int
41+
panel_url: builtins.str
42+
"""Location of the panel's webpage"""
43+
def __init__(
44+
self,
45+
*,
46+
panel_url: builtins.str = ...,
47+
) -> None: ...
48+
def ClearField(self, field_name: typing.Literal["panel_url", b"panel_url"]) -> None: ...
49+
50+
global___StartPanelResponse = StartPanelResponse
51+
52+
@typing.final
53+
class StopPanelRequest(google.protobuf.message.Message):
2854
DESCRIPTOR: google.protobuf.descriptor.Descriptor
2955

3056
PANEL_ID_FIELD_NUMBER: builtins.int
31-
IS_OPEN_FIELD_NUMBER: builtins.int
32-
VALUE_IDS_FIELD_NUMBER: builtins.int
57+
RESET_FIELD_NUMBER: builtins.int
3358
panel_id: builtins.str
3459
"""Unique ID of the panel"""
35-
is_open: builtins.bool
36-
"""Is the panel currently open?"""
37-
@property
38-
def value_ids(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]:
39-
"""IDs of all of the values associated with the panel"""
40-
60+
reset: builtins.bool
61+
"""Reset all storage associated with panel"""
4162
def __init__(
4263
self,
4364
*,
4465
panel_id: builtins.str = ...,
45-
is_open: builtins.bool = ...,
46-
value_ids: collections.abc.Iterable[builtins.str] | None = ...,
66+
reset: builtins.bool = ...,
4767
) -> None: ...
48-
def ClearField(self, field_name: typing.Literal["is_open", b"is_open", "panel_id", b"panel_id", "value_ids", b"value_ids"]) -> None: ...
68+
def ClearField(self, field_name: typing.Literal["panel_id", b"panel_id", "reset", b"reset"]) -> None: ...
4969

50-
global___PanelInformation = PanelInformation
70+
global___StopPanelRequest = StopPanelRequest
5171

5272
@typing.final
53-
class EnumeratePanelsResponse(google.protobuf.message.Message):
73+
class StopPanelResponse(google.protobuf.message.Message):
5474
DESCRIPTOR: google.protobuf.descriptor.Descriptor
5575

56-
PANELS_FIELD_NUMBER: builtins.int
57-
@property
58-
def panels(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___PanelInformation]:
59-
"""The list of panels available in the system"""
76+
def __init__(
77+
self,
78+
) -> None: ...
79+
80+
global___StopPanelResponse = StopPanelResponse
81+
82+
@typing.final
83+
class EnumeratePanelsRequest(google.protobuf.message.Message):
84+
DESCRIPTOR: google.protobuf.descriptor.Descriptor
6085

6186
def __init__(
6287
self,
63-
*,
64-
panels: collections.abc.Iterable[global___PanelInformation] | None = ...,
6588
) -> None: ...
66-
def ClearField(self, field_name: typing.Literal["panels", b"panels"]) -> None: ...
6789

68-
global___EnumeratePanelsResponse = EnumeratePanelsResponse
90+
global___EnumeratePanelsRequest = EnumeratePanelsRequest
6991

7092
@typing.final
71-
class OpenPanelRequest(google.protobuf.message.Message):
93+
class PanelInformation(google.protobuf.message.Message):
7294
DESCRIPTOR: google.protobuf.descriptor.Descriptor
7395

7496
PANEL_ID_FIELD_NUMBER: builtins.int
75-
PANEL_URI_FIELD_NUMBER: builtins.int
97+
PANEL_URL_FIELD_NUMBER: builtins.int
98+
VALUE_IDS_FIELD_NUMBER: builtins.int
7699
panel_id: builtins.str
77100
"""Unique ID of the panel"""
78-
panel_uri: builtins.str
79-
"""Absolute path of the panel's file on disk, or network path to the file"""
101+
panel_url: builtins.str
102+
"""Location of the panel's webpage"""
103+
@property
104+
def value_ids(self) -> google.protobuf.internal.containers.RepeatedScalarFieldContainer[builtins.str]:
105+
"""IDs of all of the values associated with the panel"""
106+
80107
def __init__(
81108
self,
82109
*,
83110
panel_id: builtins.str = ...,
84-
panel_uri: builtins.str = ...,
111+
panel_url: builtins.str = ...,
112+
value_ids: collections.abc.Iterable[builtins.str] | None = ...,
85113
) -> None: ...
86-
def ClearField(self, field_name: typing.Literal["panel_id", b"panel_id", "panel_uri", b"panel_uri"]) -> None: ...
114+
def ClearField(self, field_name: typing.Literal["panel_id", b"panel_id", "panel_url", b"panel_url", "value_ids", b"value_ids"]) -> None: ...
87115

88-
global___OpenPanelRequest = OpenPanelRequest
116+
global___PanelInformation = PanelInformation
89117

90118
@typing.final
91-
class OpenPanelResponse(google.protobuf.message.Message):
119+
class EnumeratePanelsResponse(google.protobuf.message.Message):
92120
DESCRIPTOR: google.protobuf.descriptor.Descriptor
93121

122+
PANELS_FIELD_NUMBER: builtins.int
123+
@property
124+
def panels(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[global___PanelInformation]:
125+
"""The list of panels available in the system"""
126+
94127
def __init__(
95128
self,
129+
*,
130+
panels: collections.abc.Iterable[global___PanelInformation] | None = ...,
96131
) -> None: ...
132+
def ClearField(self, field_name: typing.Literal["panels", b"panels"]) -> None: ...
97133

98-
global___OpenPanelResponse = OpenPanelResponse
134+
global___EnumeratePanelsResponse = EnumeratePanelsResponse
99135

100136
@typing.final
101137
class GetValueRequest(google.protobuf.message.Message):
@@ -172,33 +208,3 @@ class SetValueResponse(google.protobuf.message.Message):
172208
) -> None: ...
173209

174210
global___SetValueResponse = SetValueResponse
175-
176-
@typing.final
177-
class ClosePanelRequest(google.protobuf.message.Message):
178-
DESCRIPTOR: google.protobuf.descriptor.Descriptor
179-
180-
PANEL_ID_FIELD_NUMBER: builtins.int
181-
RESET_FIELD_NUMBER: builtins.int
182-
panel_id: builtins.str
183-
"""Unique ID of the panel"""
184-
reset: builtins.bool
185-
"""Reset all storage associated with panel"""
186-
def __init__(
187-
self,
188-
*,
189-
panel_id: builtins.str = ...,
190-
reset: builtins.bool = ...,
191-
) -> None: ...
192-
def ClearField(self, field_name: typing.Literal["panel_id", b"panel_id", "reset", b"reset"]) -> None: ...
193-
194-
global___ClosePanelRequest = ClosePanelRequest
195-
196-
@typing.final
197-
class ClosePanelResponse(google.protobuf.message.Message):
198-
DESCRIPTOR: google.protobuf.descriptor.Descriptor
199-
200-
def __init__(
201-
self,
202-
) -> None: ...
203-
204-
global___ClosePanelResponse = ClosePanelResponse

0 commit comments

Comments
 (0)