Skip to content

Commit

Permalink
feat: temporarily remove support for python -> wasm as we wait for wa…
Browse files Browse the repository at this point in the history
…smerio/wasmer#3170 to be resolved
  • Loading branch information
olix3001 committed May 31, 2023
1 parent f380243 commit ead5e5d
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 17 deletions.
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ cython = ["cpp"]
[dependencies]
derivative = "2.2.0"
tempfile = "3.5.0"
wasmer = { version = "3.3.0", optional = true }
wasmer-middlewares = { version = "3.3.0", optional = true }
wasmer-wasix = { version = "0.4.0", optional = true }
wasmer-compiler-llvm = { version = "3.3.0", optional = true }
wasmer = { version = "4.0.0-alpha.1", optional = true }
wasmer-middlewares = { version = "4.0.0-alpha.1", optional = true }
wasmer-wasix = { version = "0.5.0", optional = true }
wasmer-compiler-llvm = { version = "4.0.0-alpha.1", optional = true }
which = "4.4.0"
Binary file modified assets/python.wasm
Binary file not shown.
25 changes: 13 additions & 12 deletions src/compilers/python_compiler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ impl Compiler<WasmRuntime> for PythonCompiler {
code: &mut impl std::io::Read,
config: Self::Config,
) -> CompilationResult<super::CompiledCode<WasmRuntime>> {
panic!("Python compiler is not yet supported for wasm runtime. For more information, see https://github.com/wasmerio/wasmer/issues/3170");
// If cython is enabled, return an error.
#[cfg(feature = "cython")]
if config.use_cython {
Expand Down Expand Up @@ -261,18 +262,18 @@ print("Hello, world!", end="")
assert_eq!(result.stdout, Some("Hello, world!".to_string()));
}

#[cfg(feature = "wasm")]
#[test]
fn test_python_compile_wasm() {
let code = r#"
print("Hello, world!", end="")
"#;
// #[cfg(feature = "wasm")]
// #[test]
// fn test_python_compile_wasm() {
// let code = r#"
// print("Hello, world!", end="")
// "#;

let compiled = super::PythonCompiler
.compile(&mut code.as_bytes(), Default::default())
.unwrap();
// let compiled = super::PythonCompiler
// .compile(&mut code.as_bytes(), Default::default())
// .unwrap();

let result = super::WasmRuntime.run(&compiled, Default::default()).unwrap();
assert_eq!(result.stdout, Some("Hello, world!".to_string()));
}
// let result = super::WasmRuntime.run(&compiled, Default::default()).unwrap();
// assert_eq!(result.stdout, Some("Hello, world!".to_string()));
// }
}
2 changes: 1 addition & 1 deletion src/runtimes/wasm_runtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::{
sync::Arc, path::PathBuf,
};

use wasmer::{wasmparser::Operator, BaseTunables, Engine, Pages};
use wasmer::{wasmparser::Operator, BaseTunables, Engine, Pages, NativeEngineExt};
use wasmer_wasix::virtual_fs::TmpFileSystem;

use crate::{
Expand Down

0 comments on commit ead5e5d

Please sign in to comment.