Metadata-Version: 2.4
Name: runno
Version: 0.1.2
Summary: Run untrusted code inside the Runno WebAssembly sandbox.
Project-URL: Homepage, https://runno.dev
Author-email: Ben Taylor <me@taybenlor.com>
Maintainer-email: Ben Taylor <me@taybenlor.com>
License-Expression: MIT
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: System
Requires-Python: >=3.13
Requires-Dist: pydantic~=2.10.4
Provides-Extra: dev
Requires-Dist: black~=24.10.0; extra == 'dev'
Description-Content-Type: text/markdown

# runno

Package for running code inside the Runno WebAssembly sandbox.

## Quickstart

The `run_code` method allows you to run a snippet of code.

```python
from runno import run_code

code = "print('Hello, World!')"
result = await run_code("python", code)

if result.result_type == "complete":
    print("OUTPUT:")
    print(result.tty)
else:
    print("ERROR")
```

Available runtimes are: `python`, `quickjs`, `sqlite`, `clang`, `clangpp`, `ruby`, and `php-cgi`.

## Including Files

If you want to process files within your sandbox, you can include them in the
file system by using the `run_fs` method.

```python
from runno import run_code, WASIFS, StringFile
fs: WASIFS = {
    "/program.py": StringFile(
        path="/program.py",
        timestamps=WASITimestamps(
            access=datetime.now(),
            modification=datetime.now(),
            change=datetime.now(),
        ),
        mode="string",
        content="""
print(open('data.csv'))
""",
    ),
    "/data.csv": StringFile(
        path="/data.csv",
        timestamps=WASITimestamps(
            access=datetime.now(),
            modification=datetime.now(),
            change=datetime.now(),
        ),
        mode="string",
        content="""
a,b,c
1,2,3
""",
    )
}

await run_fs(runtime, "/program", fs)
```

## Including Dependencies

You can use the same technique to include pure python packages as dependencies.
The interface for this is not super nice right now, but it's on the way.
