Skip to content

Commit b6a0e37

Browse files
committed
feat: add readme for polywrap-client
1 parent 4ae6ae0 commit b6a0e37

1 file changed

Lines changed: 40 additions & 1 deletion

File tree

packages/polywrap-client/README.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,40 @@
1-
TODO
1+
# polywrap-client
2+
3+
Python implementation of the polywrap client.
4+
5+
## Usage
6+
7+
### Configure and Instantiate
8+
9+
Use the `polywrap-uri-resolvers` package to configure resolver and build config for the client.
10+
11+
```python
12+
from polywrap_uri_resolvers import FsUriResolver, SimpleFileReader
13+
14+
config = ClientConfig(
15+
resolver=FsUriResolver(file_reader=SimpleFileReader())
16+
)
17+
18+
client = PolywrapClient(config)
19+
```
20+
21+
### Invoke
22+
23+
Invoke a wrapper.
24+
25+
```python
26+
uri = Uri.from_str(
27+
'fs/<path to wrapper>' # Example uses simple math wrapper
28+
)
29+
args = {
30+
"arg1": "123", # The base number
31+
"obj": {
32+
"prop1": "1000", # multiply the base number by this factor
33+
},
34+
}
35+
options: InvokerOptions[UriPackageOrWrapper] = InvokerOptions(
36+
uri=uri, method="method", args=args, encode_result=False
37+
)
38+
result = await client.invoke(options)
39+
assert result == "123000"
40+
```

0 commit comments

Comments
 (0)