Skip to content

Commit

Permalink
feat(python_wasi): vm docking (#520)
Browse files Browse the repository at this point in the history
<!--
Pull requests are squash merged using:
- their title as the commit message
- their description as the commit body

Having a good title and description is important for the users to get
readable changelog and understand when they need to update his code and
how.
-->

### Describe your change

- Bump all WasmEdge dependencies to latest version
- Replace `wasmedge_sdk_bindgen` with `VmDock`

### Motivation and context

`wasmedge_sdk_bindgen` is deprecated, `VmDock` replaces it entirely. 


### Checklist

- [ ] The change come with new or modified tests
- [x] Hard-to-understand functions have explanatory comments
- [ ] End-user documentation is updated to reflect the change
  • Loading branch information
michael-0acf4 authored Dec 11, 2023
1 parent 734b366 commit 6dbb239
Show file tree
Hide file tree
Showing 11 changed files with 109 additions and 599 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ env:
REGISTRY_IMAGE: ghcr.io/${{ github.repository_owner }}/typegate
WASM_TOOLS_VERSION: "1.0.45"
JCO_VERSION: "0.12.1"
WASMEDGE_VERSION: "0.12.1"
WASMEDGE_VERSION: "0.13.5"
WASM_OPT_VERSION: "0.116.0"
PNPM_VERSION: "8.8.0"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ env:
NODE_VERSION: "20.8.0"
WASM_TOOLS_VERSION: "1.0.45"
JCO_VERSION: "0.12.1"
WASMEDGE_VERSION: "0.12.1"
WASMEDGE_VERSION: "0.13.5"
RUST_BACKTRACE: "full"
RUST_LOG: "info,swc_ecma_codegen=off,tracing::span=off"

Expand Down
106 changes: 68 additions & 38 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ env_logger = "=0.10.0"
clap = "=4.3.3"
clap_complete = "=4.3.1"
# https://github.com/WasmEdge/wasmedge-rust-sdk
wasmedge-sdk = "=0.8.1"
wasmedge-sys = "=0.13.1"
wasmedge-types = "=0.4.1"
wasmedge-sdk = "=0.13.2"
wasmedge-sys = "=0.17.5"
wasmedge-types = "=0.4.4"
# https://github.com/denoland/deno_ast/blob/main/Cargo.toml
swc_common = "=0.32.0"
swc_ecma_ast = "=0.109.0"
Expand Down
2 changes: 1 addition & 1 deletion dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ FROM lukechannings/deno:v${DENO_VERSION} AS deno-bin
#
FROM base AS builder

ARG WASMEDGE_VERSION=0.12.1
ARG WASMEDGE_VERSION=0.13.5

ENV DENO_DIR /deno-dir/
ENV DENO_INSTALL /root/.deno
Expand Down
2 changes: 1 addition & 1 deletion dev/lock.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ dev:
WASM_TOOLS_VERSION: 1.0.45
JCO_VERSION: 0.12.1
WASMTIME_VERSION: 13.0.2
WASMEDGE_VERSION: 0.12.1
WASMEDGE_VERSION: 0.13.5
TYPEGRAPH_VERSION: 0.0.3
PRISMA_VERSION: 5.5.2
METATYPE_VERSION: 0.3.1
Expand Down
1 change: 0 additions & 1 deletion typegate/engine/src/runtimes/python.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,3 @@

pub mod python_bindings;
pub mod wasi_vm;
pub mod wasmedge_sdk_bindgen;
12 changes: 6 additions & 6 deletions typegate/engine/src/runtimes/python/python_bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ use crate::interlude::*;
use dashmap::{mapref::one::Ref, DashMap};
#[rustfmt::skip]
use deno_core as deno_core; // necessary for re-exported macros to work

use std::path::PathBuf;
use wasmedge_sdk::dock::{Param, VmDock};
use wasmedge_sdk::{params, Vm};

use super::{
wasi_vm,
wasmedge_sdk_bindgen::{Bindgen, Param},
};
use super::wasi_vm;

#[derive(Default)]
pub struct Ctx {
Expand Down Expand Up @@ -95,8 +95,8 @@ pub struct PythonApplyInp {
}

fn run_wasi_func(vm: &Vm, fn_name: String, args: Vec<Param>) -> Result<String> {
let mut bg = Bindgen::new(vm.to_owned());
match bg.run_wasm(fn_name, args) {
let vm_dock = VmDock::new(vm.to_owned());
match vm_dock.run_func(fn_name, args) {
Ok(ret) => {
let ret = ret.unwrap().pop().unwrap().downcast::<String>().unwrap();
Ok(ret.as_ref().to_owned())
Expand Down
Loading

0 comments on commit 6dbb239

Please sign in to comment.