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 tap Aystub/tap
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.1.tar.gz (15.4 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.1-py3-none-any.whl (19.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: runner_playground-0.1.1.tar.gz
  • Upload date:
  • Size: 15.4 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.1.tar.gz
Algorithm Hash digest
SHA256 c2e64968958219395796568243ccf852a00389a4730fe482f589a9f6301d7ad0
MD5 3824e0578fefc3946ed7d578f56e9165
BLAKE2b-256 9059be6f865eb609fb58fb40e2540fc83c69e57f3990b407c174a955ef58fd52

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for runner_playground-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ffe69b7f177bb0d73895d007aabe79e112d702b23084cee5e7b9d5e2f299c8d8
MD5 9f93fbef3893a4038f6b9a5f478593e3
BLAKE2b-256 72e35810f646aad201ba2c97b32bfac195a8bbf04dd7a04e236eef16ebe3f26e

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