Testing single Python scripts from remote repositories introduces unnecessary friction. The traditional routine forces developers to git clone an entire repository, navigate directories, and manually delete the folder just to test a utility function. It clutters the hard drive and slows down iteration.
I built Githrun to turn GitHub repositories into a personal script library, bypassing the local disk entirely.
In-Memory Execution Architecture
Githrun interacts directly with the GitHub Raw API. Instead of downloading and writing files to local storage, the CLI fetches the target script via HTTP and pulls the raw byte string directly into system memory.
- Subprocess Pipelining: Once the code string is in memory, Githrun spawns an isolated Python interpreter instance and pipes the code string directly into standard input (
stdin). - Stream Routing: The parent process listens to the child process, seamlessly capturing the standard output (
stdout) and standard error (stderr) streams, printing them back to the user's terminal in real-time.
--inspect flag, which prints the syntax-highlighted code to the terminal without executing it.
VS Code Integration
To eliminate friction completely, Githrun is packaged as a VS Code Extension. It automatically scans open Markdown or Python files. If it detects a valid GitHub or Gist URL ending in .py, it injects a "Smart CodeLens" directly above the line.
Clicking the lens executes the remote script in a new integrated terminal window instantly.
CLI Tooling & API
Beyond remote execution, Githrun offers extensive workflow tools:
- Tool Installation: The
installcommand downloads a script, creates an executable shim in~/.githrun/bin/, and turns it into a permanent command-line tool on the system. - Search & Find: Don't clone a 1GB repo to find one file. The
findcommand recursively searches remote repository trees, allowing users to execute matching scripts interactively. - Python API: The core logic is exposed as a library, allowing developers to build dynamic setups, like
githrun.execute_remote_code("https://...").