Skip to content

Commit 694837e

Browse files
committed
Update python plugin example for compatibility with v0.100.0
1 parent b730509 commit 694837e

File tree

1 file changed

+24
-18
lines changed

1 file changed

+24
-18
lines changed

contributor-book/plugins.md

Lines changed: 24 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,8 +1020,8 @@ def signature():
10201020
return {
10211021
"sig": {
10221022
"name": "len",
1023-
"usage": "calculates the length of its input",
1024-
"extra_usage": "",
1023+
"description": "calculates the length of its input",
1024+
"extra_description": "",
10251025
"search_terms": [],
10261026
"required_positional": [],
10271027
"optional_positional": [],
@@ -1052,7 +1052,7 @@ def send_hello():
10521052
hello = {
10531053
"Hello": {
10541054
"protocol": "nu-plugin",
1055-
"version": "0.90.2",
1055+
"version": "0.100.0",
10561056
"features": []
10571057
}
10581058
}
@@ -1081,15 +1081,18 @@ def send_error(id, error_msg, span):
10811081

10821082
def handle_call(id, call_info):
10831083
try:
1084-
input = call_info["input"]["Value"]["String"]
1084+
input = call_info["input"]["Value"][0]["String"]
10851085
output = {
10861086
"PipelineData": {
1087-
"Value": {
1088-
"Int": {
1089-
"val": len(input["val"]),
1090-
"span": input["span"]
1091-
}
1092-
}
1087+
"Value": [
1088+
{
1089+
"Int": {
1090+
"val": len(input["val"]),
1091+
"span": input["span"]
1092+
}
1093+
},
1094+
None
1095+
]
10931096
}
10941097
}
10951098
send_response(id, output)
@@ -1176,7 +1179,7 @@ def send_hello():
11761179
hello = {
11771180
"Hello": {
11781181
"protocol": "nu-plugin",
1179-
"version": "0.90.2",
1182+
"version": "0.100.0",
11801183
"features": []
11811184
}
11821185
}
@@ -1195,15 +1198,18 @@ When sent a `Run` request, we parse the supplied JSON and respond to the request
11951198
```python
11961199
def handle_call(id, call_info):
11971200
try:
1198-
input = call_info["input"]["Value"]["String"]
1201+
input = call_info["input"]["Value"][0]["String"]
11991202
output = {
12001203
"PipelineData": {
1201-
"Value": {
1202-
"Int": {
1203-
"val": len(input["val"]),
1204-
"span": input["span"]
1205-
}
1206-
}
1204+
"Value": [
1205+
{
1206+
"Int": {
1207+
"val": len(input["val"]),
1208+
"span": input["span"]
1209+
}
1210+
},
1211+
None
1212+
]
12071213
}
12081214
}
12091215
send_response(id, output)

0 commit comments

Comments
 (0)