[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-110386":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":9,"totalLinesOfCode":9,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":9,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":9,"rankLanguage":9,"license":9,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":22,"hasPages":22,"topics":9,"createdAt":9,"pushedAt":24,"updatedAt":25,"readmeContent":26,"aiSummary":27,"trendingCount":16,"starSnapshotCount":16,"syncStatus":28,"lastSyncTime":29,"discoverSource":30},110386,"google-colab-cli","googlecolab\u002Fgoogle-colab-cli","googlecolab","A CLI for interacting with Google Colab runtimes",null,"https:\u002F\u002Fgithub.com\u002Fgooglecolab\u002Fgoogle-colab-cli","Python",2968,400,24,20,0,201,406,820,650,106.79,false,"main","2026-11-23 09:14:48","2026-11-23 20:37:43","# Colab CLI\n\nA command-line interface for Google Colab. Provision high-performance CPU, GPU, and TPU runtimes, execute local code, manage remote files, and orchestrate automated cloud pipelines — directly from your terminal.\n\nDesigned to support seamless developer productivity, headless automation, and AI agent integrations.\n\n[Demo](https:\u002F\u002Fgithub.com\u002Fuser-attachments\u002Fassets\u002F656226a9-af13-4fdb-8eda-d7de747336a2)\n\n> [!NOTE]\n> **Platform support:** the Colab CLI currently supports **Linux and macOS** only. Windows is not supported at this time.\n\n> [!TIP]\n> Looking for in-notebook, interactive agent-assisted coding instead of a terminal workflow? See the [Colab MCP Server](https:\u002F\u002Fgithub.com\u002Fgooglecolab\u002Fcolab-mcp).\n\n---\n\n## Key Features\n\n* **Instant VM Provisioning:** Spin up CPU, GPU (T4, L4, G4, H100, A100), or TPU (v5e1, v6e1) runtimes in seconds.\n* **Robust Code Execution:** Run local Python scripts, Jupyter Notebooks (`.ipynb`), or piped `stdin` code; launch interactive REPLs or raw TTY console shells.\n* **Ephemeral Job Runner (`colab run`):** Provision a fresh VM, execute a local script with forwarded arguments, retrieve output files, and automatically tear down the runtime in a single command.\n* **Activity-Based Liveness:** Sessions stay alive as long as the kernel is active, with the Colab backend automatically maintaining liveness.\n* **Seamless Workspace Automation:** Mount Google Drive, authenticate Google Cloud Platform (GCP) credentials, and install dependencies with high-performance `uv` package management.\n* **State & Log Archival:** Inspect local session states or export interactive history logs to standard Jupyter Notebooks, Markdown, or structured JSONL.\n\n---\n\n## Installation\n\nInstall the package using `uv` (recommended) or standard `pip`:\n\n```bash\n# Using uv (recommended)\nuv tool install google-colab-cli\n\n# Using pip\npip install google-colab-cli\n```\n\n---\n\n## Quick Start\n\nRun a CPU-based VM runtime, execute some code, and clean up:\n\n```bash\n# 1. Provision a new session\ncolab new\n\n# 2. Execute code from stdin\necho 'print(\"Hello from Google Colab!\")' | colab exec\n\n# 3. Stop and release the VM resource\ncolab stop\n```\n\n> [!NOTE]\n> When only one session is active, you can omit the `-s, --session` option;\n> the CLI automatically knows it.\n\n\n---\n\n## Command Index\n\nRun `colab \u003Ccommand> --help` to view specific options, defaults, and detailed help.\n\n### Session Management\n| Command | Description |\n| --- | --- |\n| `colab new [-s NAME] [--gpu GPU] [--tpu TPU] [--high-mem]` | Allocate a new CPU, GPU, or TPU VM runtime (optionally high-RAM) |\n| `colab sessions` | List all active sessions currently active on the backend |\n| `colab status [-s NAME]` | Display hardware, machine shape, status, and local metadata for active sessions |\n| `colab restart-kernel [-s NAME]` | Restart the active session's Jupyter kernel |\n| `colab stop [-s NAME]` | Terminate a session VM and release its resources |\n| `colab url [-s NAME] [--open]` | Print or open a browser URL connecting to the active session |\n\n### Execution\n| Command | Description |\n| --- | --- |\n| `colab run [--gpu GPU] [--tpu TPU] [--high-mem] [--keep] SCRIPT [ARGS...]` | Run a local script on a fresh VM, forwarding arguments, then release it |\n| `colab exec [-s NAME] [-f FILE] [--output-image PATH]` | Execute Python code from stdin, a local `.py` file, or a `.ipynb` notebook |\n| `colab repl [-s NAME] [--output-image PATH]` | Start an interactive Python REPL on the VM (exits cleanly on piped EOF) |\n| `colab console [-s NAME]` | Connect to a raw interactive TTY shell (tmux) on the remote VM |\n| `colab ssh [-s NAME] [--proxy-mode] [-i KEY] [--gpu GPU] [--tpu TPU] [--high-mem]` | Open an SSH shell to the runtime over WebSocket, or act as an OpenSSH `ProxyCommand` bridge for IDE remote-dev |\n\n### File Operations\n| Command | Description |\n| --- | --- |\n| `colab ls [-s NAME] [PATH]` | List remote files on the VM |\n| `colab upload [-s NAME] LOCAL REMOTE` | Upload a local file to the VM filesystem |\n| `colab download [-s NAME] REMOTE LOCAL` | Download a remote file from the VM filesystem |\n| `colab rm [-s NAME] PATH` | Delete a remote file on the VM filesystem |\n| `colab edit [-s NAME] PATH` | Edit a remote file in-place using your local `$EDITOR` |\n\n### Automation & Utilities\n| Command | Description |\n| --- | --- |\n| `colab auth [-s NAME]` | Authenticate the VM for GCP services (BigQuery, GCS, etc.) |\n| `colab drivemount [-s NAME] [PATH]` | Mount Google Drive on the VM (default: `\u002Fcontent\u002Fdrive`) |\n| `colab install [-s NAME] [-r FILE \\| PKG...]` | Install packages on the VM using `uv` (falls back to `pip`) |\n| `colab log [-s NAME] [-n N] [-o FILE]` | View or export session history (`.ipynb`, `.md`, `.txt`, `.jsonl`) |\n| `colab usage` | Show account compute-unit usage rate and balance |\n| `colab pay` | Open the Colab subscription page to manage compute units |\n| `colab version` | Print the installed version of the CLI |\n| `colab update [--install]` | Check for a newer release (and optionally upgrade the CLI in place) |\n\n### Global Options\n* `--auth {oauth2,adc}` — Authentication strategy for the Colab API (default: `adc`).\n* `-c, --client-oauth-config PATH` — Path to public OAuth client credentials configuration (default: `~\u002F.colab-cli-oauth-config.json`).\n* `--config PATH` — Path to local session metadata storage (default: `~\u002F.config\u002Fcolab-cli\u002Fsessions.json`).\n* `--logtostderr` — Direct debug logging output to stderr.\n\n---\n\n## Practical Examples\n\n### Accelerator Training with Checkpoint Retrieval\n\nProvision an A100 GPU, install requirements, run a local training script, retrieve the resulting model weights, and terminate the VM:\n\n```bash\ncolab new -s trainer --gpu A100\ncolab install -s trainer torch transformers\ncolab exec -s trainer -f train.py\ncolab download -s trainer checkpoints\u002Fmodel.bin .\u002Fmodel.bin\ncolab stop -s trainer\n```\n\n### Workspace Notebook Execution with Drive Integration\n\nMount Google Drive, run a local notebook against the VM kernel (outputs are written back into `report_output.ipynb`), export a Markdown log of the execution, and clean up:\n\n```bash\ncolab new -s analysis\ncolab drivemount -s analysis\ncolab exec -s analysis -f report.ipynb\ncolab log -s analysis -o execution_log.md\ncolab stop -s analysis\n```\n\n---\n\n## Usage Notes\n\n* **Machine shape:** Use `--high-mem` with `colab new`, `colab run`, or `colab ssh` (when auto-creating a runtime) to request a high-RAM machine shape. Requires Colab Pro or Pro+ entitlement for supported accelerators (CPU, T4, A100, etc.). L4 and TPU runtimes ignore this flag because they only offer one shape. Machine shape is shown in `colab sessions` and `colab status`.\n* **TTY Requirements:** The interactive commands `repl` and `console` require a local TTY. When running inside automated scripts or pipelines, make sure to pipe stdin (e.g., `echo \"print(1)\" | colab repl`) to trigger non-interactive execution modes.\n* **Transparent Code Execution:** When calling `colab exec -f file.py`, the CLI reads the file locally and transmits its content to the remote kernel. You do not need to manually upload files before execution.\n* **Storage & State Paths:** Session tokens and metadata are stored at `~\u002F.config\u002Fcolab-cli\u002Fsessions.json`. Global CLI settings are located at `~\u002F.config\u002Fcolab-cli\u002Fsettings.json`. These can be customized or isolated via the global `--config` flag.\n\n### Ephemeral Accelerator Jobs\n\nUse `colab run` to run a local script on dedicated hardware without manual session lifecycle management. The CLI handles provisioning, script execution, and immediate VM teardown automatically:\n\n```bash\n# Run train.py on a T4 GPU and release the VM on completion\ncolab run --gpu T4 train.py\n```\n\n### Shebang Execution Support\n\nTo execute a local file directly on a remote accelerator, place the `colab run` interpreter in the shebang line:\n\n```python\n#!\u002Fusr\u002Fbin\u002Fenv -S colab run --gpu L4 --keep\nimport torch\n\nprint(\"L4 GPU Available:\", torch.cuda.is_available())\nprint(\"Device Name:\", torch.cuda.get_device_name(0))\n```\n\nMake the script executable (`chmod +x script.py`) and run it: `.\u002Fscript.py`. The `--keep` option tells the CLI to preserve the session VM on completion so you can re-execute or inspect logs.\n\n---\n\n## Deep Dive Documentation\n\nFor comprehensive architectural overviews and deep-dives into specific CLI sub-systems, refer to the detailed documentation:\n\n* [Session Management Architecture](docs\u002F01_session_management.md)\n* [Interactive & Non-Interactive Execution Design](docs\u002F02_execution_and_interactive.md)\n* [File Management & Jupyter Contents API](docs\u002F03_file_management.md)\n* [Authentication Providers & VM Automation](docs\u002F04_automation_and_utility.md)\n* [Ephemeral Job Runner Design](docs\u002F05_run_command.md)\n\nTo view interactive walkthroughs of eleven real-world automated scenarios, check out the [Demo Walkthroughs](docs\u002Fdemos.md).\n\n---\n\n## Contributing\n\nFeedback and contributions are welcome! Please read [`CONTRIBUTING.md`](.\u002FCONTRIBUTING.md) for details.\n\n---\n\n## Legal & Privacy\n\nSee Colab's [Terms of Service](https:\u002F\u002Fresearch.google.com\u002Fcolaboratory\u002Ftos_v6.html) and the [Google Privacy Policy](https:\u002F\u002Fpolicies.google.com\u002Fprivacy), which apply to usage of this CLI.\n","Google Colab CLI 是一个用于在终端中管理 Google Colab 运行时的命令行工具。它支持快速创建和销毁 CPU\u002FGPU\u002FTPU（含 H100、A100、v6e 等型号）运行时，执行本地 Python 脚本或 Jupyter Notebook，同步文件，挂载 Google Drive，并集成 GCP 认证与高效依赖管理（uv）。所有操作通过简洁命令完成，会话状态自动维持，输出可导出为 Notebook、Markdown 或 JSONL。适用于需要自动化 AI 实验、批量模型训练、CI\u002FCD 中云算力编排及无界面环境下的远程开发场景。",2,"2026-11-24 04:38:51","trending"]