Skip to main content

A terminal-based TUI code playground for multiple languages.

Project description

⚡ Runner: Terminal-Based Code Playground

Demo Gif

A terminal-based TUI (Textual User Interface) playground for quickly running code snippets. It supports:

  • Python
  • JavaScript (Node.js)
  • Go
  • Kotlin

Easy to add support for new languages.


⚙️ Getting Started

Homebrew

brew install runner

Run Runner:

runner

Manual Installation

  1. Python 3.8+
  2. Install the package: Install the package along with its dependencies (like Textual) in editable development mode:
    pip install -e .
    
  3. (Optional) Runtimes for languages you wish to run:
    • Node.js (for JavaScript)
    • Go toolchain (for Go)
    • Kotlin compiler & Java Runtime (for Kotlin)

Runtime Path Configuration Overrides (.env)

By default, runner searches your system PATH to resolve compiler paths. If you have runtimes installed in custom paths (e.g., via pyenv, nvm, or Homebrew), you can copy .env.example to .env and fill in the absolute paths. You can use standard home directory shorthands (~) or environment variables in these paths:

RUNNER_PYTHON3_PATH=~/.pyenv/shims/python3
RUNNER_NODE_PATH=~/.nvm/versions/node/v18.0.0/bin/node
RUNNER_GO_PATH=/usr/local/go/bin/go
RUNNER_KOTLINC_PATH=/opt/kotlin/bin/kotlinc
RUNNER_JAVA_PATH=/opt/java/bin/java

Note: runner will load configuration files from ~/.runner/.env, the current working directory .env, or the project root .env.

Running the App

You can run runner using any of the following methods:

  • As an installed package (after running pip install . or pip install -e .):
    runner
    
  • Using the launcher script (directly from the repository root):
    ./runner
    
  • Directly via Python module execution:
    python3 -m runner
    

🧩 Adding a New Language

The application is designed to automatically register new languages. To add support for a new language (e.g. rust):

  1. Create a new folder under src/runner/languages/ (e.g., src/runner/languages/rust/).
  2. Add your native starting template code to src/runner/languages/rust/template.rs.
  3. Create src/runner/languages/rust/runner.py defining a subclass of BaseLanguage:
    from ..base import BaseLanguage, resolve_executable, run_subprocess
    
    class RustLanguage(BaseLanguage):
        name = "rust"
        display_name = "Rust 🦀"
        editor_language = "rust"  # Syntax highlighting spec
        extension = "rs"
        template_file = "template.rs"
        executables = ["rustc", "cargo"]  # Required system binaries
        install_instructions = {
            "macos": "brew install rustup-init",
            "linux": "curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh",
            "web": "https://www.rust-lang.org/tools/install"
        }
    
        @classmethod
        async def get_version(cls) -> str:
            # Execute 'rustc --version' and parse it
            cmd = [resolve_executable("rustc"), "--version"]
            output, _, code = await run_subprocess(cmd)
            if code == 0:
                return output.strip().split()[1]
            return "unknown"
    
    
        @classmethod
        async def run(cls, code: str) -> tuple[str, float, int]:
            # Write code to temp file, compile and execute it
            ...
    

Upon launching the app, the discovery module will automatically import the new package, sort it alphabetically, load the native template, and enforce path/binary checks before running.

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

runner_playground-0.1.0.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

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

runner_playground-0.1.0-py3-none-any.whl (18.9 kB view details)

Uploaded Python 3

File details

Details for the file runner_playground-0.1.0.tar.gz.

File metadata

  • Download URL: runner_playground-0.1.0.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.4

File hashes

Hashes for runner_playground-0.1.0.tar.gz
Algorithm Hash digest
SHA256 e52dd478860e038b94fe98ca505e75dce9c636905ec64d8c07351ce061690845
MD5 c38523cc9ea798d7a6ae922bba891e25
BLAKE2b-256 443ba122907e74c3afdd2ea82749b9cc5be89b8205a5919862eb39852982f7e2

See more details on using hashes here.

File details

Details for the file runner_playground-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for runner_playground-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fabba06a70939d2fdd67044c37094a3816de6932d7d4091e444cf7dabdb53458
MD5 be4adb7d507c7dfc21547910d1f3b6a3
BLAKE2b-256 59b2d477641f52325fd68f4df9c3e6977a1cd5390b6240a2b6d3526d972a862b

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