Skip to main content

Run untrusted code inside the Runno WebAssembly sandbox.

Project description

runno

Package for running code inside the Runno WebAssembly sandbox.

Quickstart

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

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.

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

runno-0.1.1.tar.gz (47.0 MB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

runno-0.1.1-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl (81.2 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.24+ x86-64manylinux: glibc 2.28+ x86-64

runno-0.1.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl (79.7 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ ARM64manylinux: glibc 2.28+ ARM64

runno-0.1.1-cp313-cp313-macosx_15_0_x86_64.whl (77.4 MB view details)

Uploaded CPython 3.13macOS 15.0+ x86-64

File details

Details for the file runno-0.1.1.tar.gz.

File metadata

  • Download URL: runno-0.1.1.tar.gz
  • Upload date:
  • Size: 47.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.13.1

File hashes

Hashes for runno-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c0887db0778609dae50cdebd19f54015d0dfc4e9fe884bcea0c09425ea2fc95e
MD5 d09c60f82ee57a41ccece5f59350c3c8
BLAKE2b-256 5e84a6acd2c0112893cb4c95c06f39ebdbf3bd014920aee6aa772cfc9b406e32

See more details on using hashes here.

File details

Details for the file runno-0.1.1-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for runno-0.1.1-cp313-cp313-manylinux_2_24_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 35d0d465a06356f5a5b4c246201bd2f0fe8c3aa7c77f00b3eb5b49e288d7e485
MD5 95b9e35e7292f1673c72e189dac1fb4a
BLAKE2b-256 3af1fdbfcb4cb00130fbe526b72b9348f0f1fa59397a8d67e8f3fff1d9e56665

See more details on using hashes here.

File details

Details for the file runno-0.1.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for runno-0.1.1-cp313-cp313-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 b54b6691154211955c33c1be87cc860f51e5b978d5f548ab8ab214c4746948e7
MD5 1be68bc26c01c343fafe605256d0b595
BLAKE2b-256 0ea7102d40d41723b00b83279384a54e479d629a6dc8bd4cb27dd3675582bf3e

See more details on using hashes here.

File details

Details for the file runno-0.1.1-cp313-cp313-macosx_15_0_x86_64.whl.

File metadata

File hashes

Hashes for runno-0.1.1-cp313-cp313-macosx_15_0_x86_64.whl
Algorithm Hash digest
SHA256 9d94d0bd9ca33baf96206656a746b74cc6a25dd1a8faeebfb77524ce2053d0b3
MD5 4c6799c1a0e4667f04efcdd1ad56e05f
BLAKE2b-256 8f553cd47ce9b8cc3eec30cf22988f14d643d34b1c6c04ef19c113166b3110a6

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page