Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Polywrap Origin (0.10.5)
## Bugs
**`@polywrap/schema-bind`:**
* [PR-1786](https://github.com/polywrap/cli/pull/1786) **Update `plugin/python` plugin bindings to latest client**

# Polywrap Origin (0.10.4)
## Features
**`polywrap` CLI:**
Expand Down
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.10.4
0.10.5
2 changes: 1 addition & 1 deletion packages/cli/src/__tests__/e2e/p2/build.wasm.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ const HELP = `Usage: polywrap build|b [options]
Build Polywrap Projects (type: interface, wasm)

Options:
-m, --manifest-file <path> Path to the Polywrap Build manifest file
-m, --manifest-file <path> Path to the Polywrap manifest file
(default: polywrap.yaml | polywrap.yml)
-o, --output-dir <path> Output directory for build results
(default: ./build)
Expand Down
11 changes: 5 additions & 6 deletions packages/js/cli/src/__tests__/commands.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,14 +225,13 @@ const testData: CommandTestCaseData<CommandTypings> = {
}],
docs: {
init: [{
cwd: fs.mkdtempSync(path.join(os.tmpdir(), "docs-init")),
before: async (test) => {
if(!test.cwd)
throw Error("This shouldn't happen");
},
after: (_, stdout, __, exitCode) => {
cwd: path.join(GetPathToCliTestFiles(), "build-cmd/wasm/assemblyscript/001-sanity"),
after: (test, stdout, __, exitCode) => {
expect(stdout).toContain("Written docs manifest to");
expect(exitCode).toBe(0);
if (test.cwd) {
fs.rmSync(path.join(test.cwd, "polywrap.docs.yaml"));
}
}
}]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ from typing import TypeVar, Generic, TypedDict, Optional

from .types import *

from polywrap_core import InvokerClient, UriPackageOrWrapper
from polywrap_core import InvokerClient
from polywrap_plugin import PluginModule
from polywrap_msgpack import GenericMap

Expand Down Expand Up @@ -39,10 +39,10 @@ class Module(Generic[TConfig], PluginModule[TConfig]):
{{#moduleType}}
{{#methods}}
@abstractmethod
async def {{#detectKeyword}}{{#toLower}}{{name}}{{/toLower}}{{/detectKeyword}}(
def {{#detectKeyword}}{{#toLower}}{{name}}{{/toLower}}{{/detectKeyword}}(
self,
args: Args{{#toUpper}}{{name}}{{/toUpper}},
client: InvokerClient[UriPackageOrWrapper],
client: InvokerClient,
{{^env}}env: None{{/env}}{{#env}}env: {{^required}}Optional[{{/required}}Env{{^required}}] = None{{/required}}{{/env}}
) -> {{#return}}{{#toPython}}{{toGraphQLType}}{{/toPython}}{{/return}}:
pass
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ from __future__ import annotations
from typing import TypedDict, Optional
from enum import IntEnum

from polywrap_core import InvokerClient, Uri, UriPackageOrWrapper
from polywrap_core import InvokerClient, Uri
from polywrap_msgpack import GenericMap


Expand Down Expand Up @@ -100,16 +100,14 @@ class {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}}(IntEn
class {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}}:
{{#methods}}
@staticmethod
async def {{#detectKeyword}}{{#toLower}}{{name}}{{/toLower}}{{/detectKeyword}}(
def {{#detectKeyword}}{{#toLower}}{{name}}{{/toLower}}{{/detectKeyword}}(
args: {{#toUpper}}{{parent.type}}{{/toUpper}}Args{{#toUpper}}{{name}}{{/toUpper}},
client: InvokerClient[UriPackageOrWrapper]
client: InvokerClient
) -> {{#return}}{{#toPython}}{{toGraphQLType}}{{/toPython}}{{/return}}:
return client.invoke(
InvokeOptions(
uri=Uri.from_str("{{parent.uri}}"),
method="{{name}}",
args=args,
)
uri=Uri.from_str("{{parent.uri}}"),
method="{{name}}",
args=args,
)
{{^last}}

Expand All @@ -127,17 +125,15 @@ class {{#detectKeyword}}{{#toUpper}}{{type}}{{/toUpper}}{{/detectKeyword}}:
self.uri = uri

{{#methods}}
async def {{#detectKeyword}}{{#toLower}}{{name}}{{/toLower}}{{/detectKeyword}}(
def {{#detectKeyword}}{{#toLower}}{{name}}{{/toLower}}{{/detectKeyword}}(
self,
args: {{#toUpper}}{{parent.type}}{{/toUpper}}Args{{#toUpper}}{{name}}{{/toUpper}},
client: InvokerClient[UriPackageOrWrapper]
client: InvokerClient
) -> {{#return}}{{#toPython}}{{toGraphQLType}}{{/toPython}}{{/return}}:
return client.invoke(
InvokeOptions(
uri=self.uri,
method="{{name}}",
args=args,
)
uri=self.uri,
method="{{name}}",
args=args,
)
{{^last}}

Expand All @@ -160,7 +156,7 @@ class {{#detectKeyword}}{{#toUpper}}{{namespace}}{{/toUpper}}{{/detectKeyword}}:
{{#getImplementations}}
{{#enabled}}
def get_implementations(
client: InvokerClient[UriPackageOrWrapper]
client: InvokerClient
) -> list[str]:
impls = client.getImplementations(self.uri)
return [impl.uri for impl in impls]
Expand Down
8 changes: 3 additions & 5 deletions packages/templates/plugin/python/tests/test_plugin.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,16 @@
from hypothesis import given, strategies as st

from polywrap_core import InvokeOptions

from sample import sample_plugin

@given(st.text())
async def test_sample_method(s: str):
plugin = sample_plugin()
wrapper = await plugin.create_wrapper()
res = await wrapper.invoke(InvokeOptions(
wrapper = plugin.create_wrapper()
res = wrapper.invoke(
uri="plugin/sample-plugin",
method="sample_method",
args={"data": s}
), NotImplemented)
)

assert not res.encoded
assert res.result == f"{s} from sample_method"
Loading