Name | wasm-runtime JSON |
Version |
0.2
JSON |
| download |
home_page | None |
Summary | WebAssembly-powered, sandboxed implementation of Python runtime for safely exec()-cuting dynamic Python code. |
upload_time | 2024-04-28 12:14:04 |
maintainer | None |
docs_url | None |
author | None |
requires_python | >=3 |
license | MIT License Copyright (c) 2024 JC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
wasm
runtime
python
sandbox
restricted
limited
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
No coveralls.
|
# wasm-runtime
WebAssembly-powered, sandboxed implementation of Python runtime for safely `exec()`-cuting dynamic Python code.
This is an active version of [wasm_exec](https://github.com/Jflick58/wasm_exec) created by [Justin Flick](https://github.com/Jflick58).<br />See [Jflick58/wasm_exec/LICENSE](https://github.com/Jflick58/wasm_exec/blob/main/LICENSE) and [● wasm_runtime/LICENSE](https://github.com/AWeirdDev/wasm_runtime).
<div align="center">
`$ pip install wasm-runtime`
</div>
<br />
## Use
```python
from wasm_runtime import WasmRuntime
runtime = WasmRuntime()
result = runtime.exec("print('Hi, Mom!')")
print(result)
# Result(stdout='Hi, Mom!\n', stderr='', ...)
```
## <kbd>class</kbd> WasmRuntime
```python
__init__(
self,
use_fuel: bool = False,
fuel: int = 400_000_000,
runtime_path: str = ""
)
```
Creates a new instance of WebAssembly runtime.
Original code by Justin Flick.
**Args:**
- use_fuel (`bool`): Whether to use fuel.
- fuel (`int`): Fuel.
- runtime_path (`str`): Runtime path. If not specified, the runtime will be downloaded automatically.
### <kbd>def</kbd> exec
```python
exec(self, code: str) -> Result
```
Execute Python code.
**Args:**
- code (`str`): Python code.
## <kbd>dataclass</kbd> Result
```python
stdout: str
stderr: str
memory_size: int
data_len: int
fuel_consumed: int
```
Raw data
{
"_id": null,
"home_page": null,
"name": "wasm-runtime",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3",
"maintainer_email": null,
"keywords": "wasm, runtime, python, sandbox, restricted, limited",
"author": null,
"author_email": "AWeirdDev <aweirdscratcher@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/7d/7a/d01f4ebb5fda2f64be741d041e72fbddbebbde103bb5b4e9d7ee0b443a1b/wasm-runtime-0.2.tar.gz",
"platform": null,
"description": "# wasm-runtime\r\n\r\nWebAssembly-powered, sandboxed implementation of Python runtime for safely `exec()`-cuting dynamic Python code.\r\n\r\nThis is an active version of [wasm_exec](https://github.com/Jflick58/wasm_exec) created by [Justin Flick](https://github.com/Jflick58).<br />See [Jflick58/wasm_exec/LICENSE](https://github.com/Jflick58/wasm_exec/blob/main/LICENSE) and [\u25cf wasm_runtime/LICENSE](https://github.com/AWeirdDev/wasm_runtime).\r\n\r\n<div align=\"center\">\r\n\r\n`$ pip install wasm-runtime`\r\n\r\n</div>\r\n\r\n<br />\r\n\r\n## Use\r\n\r\n```python\r\nfrom wasm_runtime import WasmRuntime\r\n\r\nruntime = WasmRuntime()\r\nresult = runtime.exec(\"print('Hi, Mom!')\")\r\n\r\nprint(result)\r\n# Result(stdout='Hi, Mom!\\n', stderr='', ...)\r\n```\r\n\r\n## <kbd>class</kbd> WasmRuntime\r\n\r\n```python\r\n__init__(\r\n self, \r\n use_fuel: bool = False, \r\n fuel: int = 400_000_000, \r\n runtime_path: str = \"\"\r\n)\r\n```\r\n\r\nCreates a new instance of WebAssembly runtime.\r\n\r\nOriginal code by Justin Flick.\r\n\r\n**Args:**\r\n- use_fuel (`bool`): Whether to use fuel.\r\n- fuel (`int`): Fuel.\r\n- runtime_path (`str`): Runtime path. If not specified, the runtime will be downloaded automatically.\r\n\r\n### <kbd>def</kbd> exec\r\n\r\n```python\r\nexec(self, code: str) -> Result\r\n```\r\n\r\nExecute Python code.\r\n\r\n**Args:**\r\n- code (`str`): Python code.\r\n\r\n## <kbd>dataclass</kbd> Result\r\n\r\n```python\r\nstdout: str\r\nstderr: str\r\nmemory_size: int\r\ndata_len: int\r\nfuel_consumed: int\r\n```\r\n",
"bugtrack_url": null,
"license": "MIT License Copyright (c) 2024 JC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "WebAssembly-powered, sandboxed implementation of Python runtime for safely exec()-cuting dynamic Python code.",
"version": "0.2",
"project_urls": {
"Bug Tracker": "https://github.com/AWeirdScratcher/wasm_runtime/issues",
"Source": "https://github.com/AWeirdScratcher/wasm_runtime"
},
"split_keywords": [
"wasm",
" runtime",
" python",
" sandbox",
" restricted",
" limited"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7d7ad01f4ebb5fda2f64be741d041e72fbddbebbde103bb5b4e9d7ee0b443a1b",
"md5": "7e984fcefa4e4cb4c83dfc98fb634dd8",
"sha256": "431f9530e3dbf1bfcd2bc93997e6092198131197b4457199109d1b79d7792b55"
},
"downloads": -1,
"filename": "wasm-runtime-0.2.tar.gz",
"has_sig": false,
"md5_digest": "7e984fcefa4e4cb4c83dfc98fb634dd8",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3",
"size": 4755,
"upload_time": "2024-04-28T12:14:04",
"upload_time_iso_8601": "2024-04-28T12:14:04.627400Z",
"url": "https://files.pythonhosted.org/packages/7d/7a/d01f4ebb5fda2f64be741d041e72fbddbebbde103bb5b4e9d7ee0b443a1b/wasm-runtime-0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-28 12:14:04",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "AWeirdScratcher",
"github_project": "wasm_runtime",
"github_not_found": true,
"lcname": "wasm-runtime"
}