colabapi 0.2.0__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {colabapi-0.2.0 → colabapi-0.2.2}/PKG-INFO +76 -66
- {colabapi-0.2.0 → colabapi-0.2.2}/README.md +73 -65
- {colabapi-0.2.0 → colabapi-0.2.2}/colabapi/__init__.py +1 -1
- colabapi-0.2.2/colabapi/__main__.py +14 -0
- colabapi-0.2.2/colabapi/assets/colabapi.ico +0 -0
- colabapi-0.2.2/colabapi/assets/colabapi.png +0 -0
- {colabapi-0.2.0 → colabapi-0.2.2}/colabapi/cli.py +132 -1
- {colabapi-0.2.0 → colabapi-0.2.2}/colabapi/colabcli.py +30 -0
- colabapi-0.2.2/colabapi/gauges.py +306 -0
- colabapi-0.2.2/colabapi/gui.py +642 -0
- colabapi-0.2.2/colabapi/localpty.py +190 -0
- {colabapi-0.2.0 → colabapi-0.2.2}/colabapi/monitor.py +81 -2
- {colabapi-0.2.0 → colabapi-0.2.2}/colabapi/terminal.py +72 -4
- colabapi-0.2.2/colabapi/termview.py +304 -0
- {colabapi-0.2.0 → colabapi-0.2.2}/colabapi/winreg_install.py +97 -2
- {colabapi-0.2.0 → colabapi-0.2.2}/colabapi.egg-info/PKG-INFO +76 -66
- {colabapi-0.2.0 → colabapi-0.2.2}/colabapi.egg-info/SOURCES.txt +9 -1
- {colabapi-0.2.0 → colabapi-0.2.2}/colabapi.egg-info/requires.txt +1 -0
- {colabapi-0.2.0 → colabapi-0.2.2}/pyproject.toml +14 -1
- colabapi-0.2.2/tests/test_windows_encoding.py +66 -0
- {colabapi-0.2.0 → colabapi-0.2.2}/LICENSE +0 -0
- {colabapi-0.2.0 → colabapi-0.2.2}/colabapi/_colab_shim.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.2}/colabapi/_winshim.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.2}/colabapi/config.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.2}/colabapi/keepalive.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.2}/colabapi/persist.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.2}/colabapi/platform.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.2}/colabapi/procutil.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.2}/colabapi/runtime.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.2}/colabapi/service.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.2}/colabapi/shellview.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.2}/colabapi/timing.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.2}/colabapi/ui.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.2}/colabapi.egg-info/dependency_links.txt +0 -0
- {colabapi-0.2.0 → colabapi-0.2.2}/colabapi.egg-info/entry_points.txt +0 -0
- {colabapi-0.2.0 → colabapi-0.2.2}/colabapi.egg-info/top_level.txt +0 -0
- {colabapi-0.2.0 → colabapi-0.2.2}/setup.cfg +0 -0
- {colabapi-0.2.0 → colabapi-0.2.2}/tests/test_close_semantics.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.2}/tests/test_e2e_console.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.2}/tests/test_reconnect.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.2}/tests/test_windows_compat.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.2}/tests/test_windows_console.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: colabapi
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Run and keep a Google Colab runtime alive, then reach its terminal from your own server, laptop, or Windows PC. A CLI for headless, persistent Colab sessions -- with Windows support the official CLI does not have.
|
|
5
5
|
Author: lil-limbo
|
|
6
6
|
License: MIT
|
|
@@ -18,6 +18,7 @@ Classifier: Operating System :: Microsoft :: Windows
|
|
|
18
18
|
Classifier: Programming Language :: Python :: 3
|
|
19
19
|
Classifier: Programming Language :: Python :: 3.12
|
|
20
20
|
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
21
22
|
Classifier: Topic :: System :: Distributed Computing
|
|
22
23
|
Classifier: Topic :: Utilities
|
|
23
24
|
Requires-Python: >=3.12
|
|
@@ -26,21 +27,22 @@ License-File: LICENSE
|
|
|
26
27
|
Requires-Dist: click>=8.1
|
|
27
28
|
Requires-Dist: rich>=13.0
|
|
28
29
|
Requires-Dist: websocket-client>=1.8
|
|
30
|
+
Requires-Dist: pyte>=0.8
|
|
29
31
|
Requires-Dist: google-colab-cli>=0.6.0
|
|
30
32
|
Dynamic: license-file
|
|
31
33
|
|
|
32
34
|
# colabapi: a terminal for a persistent Google Colab runtime
|
|
33
35
|
|
|
34
|
-
**Run Google Colab from your own terminal
|
|
36
|
+
**Run Google Colab from your own terminal on Linux, macOS, *and Windows*. Keep the runtime alive after you close the browser, and reach its shell from any VPS or laptop.** `colabapi` is a small, open source command line tool (with an optional desktop window) that turns a Google Colab GPU/TPU session into something you can drive headlessly. Perfect for demos, MVPs, and long running jobs that must survive after the Colab web tab is gone.
|
|
35
37
|
|
|
36
38
|
> **In one line:** `colabapi` gives you a persistent Colab terminal on your own machine, using Google's official, ban safe sign in and tunnel, and it never sees your Google password.
|
|
37
39
|
|
|
38
40
|
**Two things you only get here:**
|
|
39
41
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
* 🪟 **It works on Windows.** Google's official Colab CLI is [Linux and macOS only](#windows). It fails on Windows before it can even parse a command. colabapi ships the compatibility layer that makes it run in PowerShell and CMD, and it registers as a real Windows app with its own icon and Start menu entry.
|
|
43
|
+
* 🔌 **It survives a dropped connection.** Google's terminal sets no WebSocket keepalive and has no reconnect, so one blip ends your session. colabapi pings, reconnects with backoff, and keeps your running job alive on the VM.
|
|
42
44
|
|
|
43
|
-
<!-- Keywords: google colab terminal, colab cli, colab ssh, colab windows, colab powershell, persistent colab, keep colab alive, headless colab, run colab from terminal, colab gpu terminal, colab from vps, colab session keep alive -->
|
|
45
|
+
<!-- Keywords: google colab terminal, colab cli, colab ssh, colab windows, colab powershell, persistent colab, keep colab alive, headless colab, run colab from terminal, colab gpu terminal, colab from vps, colab session keep alive, colab gui -->
|
|
44
46
|
|
|
45
47
|
---
|
|
46
48
|
|
|
@@ -48,37 +50,38 @@ Dynamic: license-file
|
|
|
48
50
|
|
|
49
51
|
Google Colab is fantastic free (and paid) GPU/TPU compute, but it only lives inside a browser tab. Close the tab or lose your connection and the session can go with it. That makes it awkward to:
|
|
50
52
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
* **demo an MVP** that needs a GPU without renting a server,
|
|
54
|
+
* **reach the runtime from a VPS** or a headless box,
|
|
55
|
+
* **register it as a background service** that stays up, or
|
|
56
|
+
* **watch CPU / GPU / RAM** from a normal terminal.
|
|
55
57
|
|
|
56
|
-
`colabapi` solves this by wrapping **Google's official [`google-colab-cli`](https://github.com/googlecolab/google-colab-cli)** with a friendly single command, a systemd service, a runtime picker, a live resource monitor, and a session time display. You sign in through Google's own browser flow; `colabapi` connects over Google's sanctioned tunnel.
|
|
58
|
+
`colabapi` solves this by wrapping **Google's official [`google-colab-cli`](https://github.com/googlecolab/google-colab-cli)** with a friendly single command, a graphical window, a systemd service, a runtime picker, a live resource monitor, and a session time display. You sign in through Google's own browser flow; `colabapi` connects over Google's sanctioned tunnel.
|
|
57
59
|
|
|
58
60
|
## Features
|
|
59
61
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
62
|
+
* 🖥 **A desktop app, not just a CLI.** `colabapi ui` opens a clean graphical window (white, minimal, works on Linux and Windows) with live CPU / RAM / GPU / VRAM graphs, a session list, and a **real terminal built into the window** — the shell, sign-in, runtime allocation and everything else run *inside it*, not in a terminal it throws you out to. On Windows it opens straight from the Start menu and the app list.
|
|
63
|
+
* 🪟 **Works on Windows** (PowerShell + CMD), which Google's own CLI does not. Registers as real installed software with its own logo.
|
|
64
|
+
* 🔌 **Reconnects instead of dying.** WebSocket keepalive pings, exponential backoff, and your work keeps running on the VM across the drop.
|
|
65
|
+
* 🔐 **Browser sign in, no password handling.** Authentication happens in Google's own login flow (including 2FA / device checks). `colabapi` never asks for, stores, or transmits your Google credentials. `colabapi logout` signs you out again in one command.
|
|
66
|
+
* 💻 **Real terminal into the runtime.** `colabapi shell` drops you into a live shell on the Colab VM. `colabapi repl` gives you a Python REPL.
|
|
67
|
+
* 🎛 **Runtime picker.** List CPU / T4 / L4 / G4 / A100 / H100 / TPU options; paid tier runtimes are clearly flagged as unavailable on a free account.
|
|
68
|
+
* 📈 **Live CPU / GPU / RAM monitor.** `colabapi monitor` streams runtime stats to your terminal (psutil + `nvidia-smi`).
|
|
69
|
+
* ⏱ **Session time display.** See uptime and an estimate of how long before Colab's max lifetime cap.
|
|
70
|
+
* ♻️ **Keepalive that stays up.** Runs Google's own keepalive daemon and restarts it when it dies, which it otherwise does silently.
|
|
71
|
+
* 🧩 **Runs as a background service.** systemd on Linux, a Scheduled Task on Windows, so your session survives logout and reboot.
|
|
72
|
+
* 🔎 **Inspectable & MIT licensed.** Read every line. Nothing phones home.
|
|
70
73
|
|
|
71
74
|
## How it works
|
|
72
75
|
|
|
73
76
|
```
|
|
74
77
|
you > colabapi (this tool) > colab_cli (Google's official CLI) > Google's tunnel > your Colab runtime (GPU/TPU VM)
|
|
75
78
|
|
|
76
|
-
colabapi adds: Windows support, auto-reconnect, keepalive supervision,
|
|
77
|
-
runtime picker, monitor, session timer, background service
|
|
79
|
+
colabapi adds: Windows support, auto-reconnect, keepalive supervision, a desktop
|
|
80
|
+
window, runtime picker, monitor, session timer, background service
|
|
78
81
|
colabapi never handles your Google password
|
|
79
82
|
```
|
|
80
83
|
|
|
81
|
-
`colabapi` is an **orchestration and reliability layer**. The heavy lifting
|
|
84
|
+
`colabapi` is an **orchestration and reliability layer**. The heavy lifting (OAuth sign in, allocating the runtime, and the encrypted tunnel) is delegated to Google's first party CLI, which is the safe, supported way to do this. We do not reimplement any of it; we make it run where it otherwise cannot, and keep it running when it otherwise would not.
|
|
82
85
|
|
|
83
86
|
## Install
|
|
84
87
|
|
|
@@ -93,17 +96,17 @@ pipx install colabapi
|
|
|
93
96
|
<a name="windows"></a>
|
|
94
97
|
### Windows (PowerShell or CMD)
|
|
95
98
|
|
|
96
|
-
> **Google's official Colab CLI does not support Windows at all
|
|
99
|
+
> **Google's official Colab CLI does not support Windows at all.** The docs say Linux and macOS only, and on Windows it raises `ImportError: No module named 'termios'` before it can parse a single command. **colabapi fixes that.** It ships a compatibility layer that supplies the POSIX pieces Windows lacks, so Google's CLI runs here unmodified. We patch nothing inside it, so their updates keep working.
|
|
97
100
|
|
|
98
101
|
**One line, in PowerShell:**
|
|
99
102
|
|
|
100
103
|
```powershell
|
|
101
|
-
irm https://raw.githubusercontent.com/lil-limbo/colabapi/
|
|
104
|
+
irm https://raw.githubusercontent.com/lil-limbo/colabapi/v0.2.1/scripts/install.ps1 | iex
|
|
102
105
|
```
|
|
103
106
|
|
|
104
|
-
That installs Python's `pipx` if needed, installs colabapi, fixes your `PATH`, and registers it with Windows. No administrator rights required.
|
|
107
|
+
That finds Python 3.12+ (and offers to install it with winget if you have none), installs Python's `pipx` if needed, installs colabapi, fixes your `PATH`, and registers it with Windows. No administrator rights required. The URL is pinned to the released tag, so you can [read exactly what will run](https://github.com/lil-limbo/colabapi/blob/v0.2.1/scripts/install.ps1) before you run it.
|
|
105
108
|
|
|
106
|
-
**Or by hand** (PowerShell or CMD
|
|
109
|
+
**Or by hand** (PowerShell or CMD, identical):
|
|
107
110
|
|
|
108
111
|
```powershell
|
|
109
112
|
python -m pip install --user pipx
|
|
@@ -120,10 +123,10 @@ colabapi doctor
|
|
|
120
123
|
|
|
121
124
|
**`colabapi register`** makes it a real Windows program rather than a loose `.exe`:
|
|
122
125
|
|
|
123
|
-
|
|
124
|
-
|
|
126
|
+
* it appears in **Settings, Installed apps** (and Add/Remove Programs) with the colabapi logo and a working uninstall entry;
|
|
127
|
+
* a **Start menu** entry opens the colabapi window (`colabapi ui`), and typing **`colabapi`** works from **Win+R**, without touching `PATH`.
|
|
125
128
|
|
|
126
|
-
It writes
|
|
129
|
+
It writes per-user keys under `HKEY_CURRENT_USER` (so no admin prompt), and `colabapi unregister` removes them, the shortcut, and the icon cleanly.
|
|
127
130
|
|
|
128
131
|
**Requires Python 3.12+** ([`winget install Python.Python.3.13`](https://learn.microsoft.com/en-us/windows/package-manager/winget/)). Works in Windows Terminal, PowerShell 5.1 and 7, and classic `cmd.exe`; ANSI colours are switched on automatically even on legacy consoles.
|
|
129
132
|
|
|
@@ -161,6 +164,8 @@ curl -fsSL https://raw.githubusercontent.com/lil-limbo/colabapi/main/scripts/ins
|
|
|
161
164
|
|
|
162
165
|
### From source
|
|
163
166
|
|
|
167
|
+
No git? Download the ZIP from GitHub ("Code", then "Download ZIP"), unpack it, and run `pip install -e .` inside. With git:
|
|
168
|
+
|
|
164
169
|
```bash
|
|
165
170
|
git clone https://github.com/lil-limbo/colabapi.git
|
|
166
171
|
cd colabapi
|
|
@@ -207,13 +212,36 @@ colabapi service install
|
|
|
207
212
|
systemctl --user start colabapi
|
|
208
213
|
```
|
|
209
214
|
|
|
215
|
+
Prefer clicking? `colabapi ui` opens the same actions in a window.
|
|
216
|
+
|
|
210
217
|
Press **Ctrl+C** to leave the monitor; type **`exit`** or press **Ctrl+D** to leave the shell. The Colab runtime keeps running until you stop it or Colab's timers end it.
|
|
211
218
|
|
|
219
|
+
## The desktop window
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
colabapi ui
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
**Everything happens in the window. Nothing opens a second terminal.**
|
|
226
|
+
|
|
227
|
+
* **Live graphs** across the top: CPU, RAM, GPU and VRAM, read from inside the selected runtime and plotted as they move.
|
|
228
|
+
* **A real terminal** in the window — a full VT emulator, not a log box. `Shell` drops you into the selected runtime (auto-reconnecting, and your work keeps running in tmux across a drop). `New runtime`, `Sign in`, `Monitor` and the rest run *in that same terminal*, on a pty, so their prompts prompt and you answer them right there.
|
|
229
|
+
* **Select a session, then act on it.** The list on the left is the selection `Shell`, `Stop` and `Monitor` operate on, and it is what the graphs follow. With nothing selected, those buttons are disabled rather than guessing.
|
|
230
|
+
* **Stop** releases the runtime, with a confirmation first.
|
|
231
|
+
* **Keyboard throughout:** Ctrl+N new runtime, Ctrl+S shell, Ctrl+K stop, Ctrl+M monitor, Ctrl+L sign in, F5 refresh. Enter on a session opens its shell. Every action is also a real, focusable button, and the menu bar carries the rest (REPL, status, runtimes, doctor, keep-alive service).
|
|
232
|
+
|
|
233
|
+
Sign-in is Google's own browser flow, exactly as on the command line — colabapi never sees your password.
|
|
234
|
+
|
|
235
|
+
* **Windows:** after `colabapi register`, "colabapi" in the Start menu and the app list opens this window directly. Windows has no pty, so there the interactive commands still open a console window; the shell, the graphs and everything else run in the window as normal.
|
|
236
|
+
* **Linux:** the window uses Tkinter, which some distros package separately. If `colabapi ui` says Tkinter is missing, install it with `sudo apt install python3-tk` (Debian / Ubuntu / Kali) or `sudo dnf install python3-tkinter` (Fedora).
|
|
237
|
+
|
|
212
238
|
## Command reference
|
|
213
239
|
|
|
214
240
|
| Command | What it does |
|
|
215
241
|
|---|---|
|
|
242
|
+
| `colabapi ui` | Open the colabapi window: live graphs, session list, and a built-in terminal that runs all of the below. |
|
|
216
243
|
| `colabapi login` | Sign in via Google's browser flow (no password handled). |
|
|
244
|
+
| `colabapi logout` | Sign out of Google and forget all sessions, for a clean start. |
|
|
217
245
|
| `colabapi runtimes` | List runtime types and which need a paid plan. |
|
|
218
246
|
| `colabapi run [--runtime KEY]` | Allocate a runtime and name the session (delegates to `colab new -s NAME`). |
|
|
219
247
|
| `colabapi sessions` | List the sessions colabapi manages. |
|
|
@@ -230,9 +258,9 @@ Press **Ctrl+C** to leave the monitor; type **`exit`** or press **Ctrl+D** to le
|
|
|
230
258
|
|
|
231
259
|
## Running as a background service
|
|
232
260
|
|
|
233
|
-
The service exists to fix a specific hole: Google's keepalive daemon is a child of *your terminal*. Close the laptop, log out of the VPS, or reboot, and it dies
|
|
261
|
+
The service exists to fix a specific hole: Google's keepalive daemon is a child of *your terminal*. Close the laptop, log out of the VPS, or reboot, and it dies, so your runtime idles out even though nothing was actually wrong with it. Registering colabapi with the OS means the keepalive comes back on its own.
|
|
234
262
|
|
|
235
|
-
**Linux
|
|
263
|
+
**Linux**, a systemd **user** service (no root required):
|
|
236
264
|
|
|
237
265
|
```bash
|
|
238
266
|
colabapi service install # writes ~/.config/systemd/user/colabapi.service and enables lingering
|
|
@@ -242,7 +270,7 @@ systemctl --user status colabapi
|
|
|
242
270
|
|
|
243
271
|
Lingering (`loginctl enable-linger`) is what lets the service keep running after you disconnect from the VPS, which is exactly what you want for an always-on demo.
|
|
244
272
|
|
|
245
|
-
**Windows
|
|
273
|
+
**Windows**, a **Scheduled Task** that runs at logon (no administrator rights, unlike a true Windows Service):
|
|
246
274
|
|
|
247
275
|
```powershell
|
|
248
276
|
colabapi service install
|
|
@@ -256,45 +284,24 @@ It appears in Task Scheduler as **colabapi**, and `colabapi service uninstall` r
|
|
|
256
284
|
|
|
257
285
|
**We do not capture your login data. We do not collect anything.**
|
|
258
286
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
<a name="staying-alive-what-actually-kills-a-colab-session"></a>
|
|
265
|
-
## Staying alive: what actually kills a Colab session
|
|
266
|
-
|
|
267
|
-
"Colab killed my session for no reason" is usually several different failures wearing the same coat. They have different causes and different fixes, and lumping them together is why they never get fixed. Here is the honest breakdown.
|
|
268
|
-
|
|
269
|
-
**Two of them are our bugs to fix, and v0.2.0 fixes them:**
|
|
270
|
-
|
|
271
|
-
| What goes wrong | Why | What colabapi does |
|
|
272
|
-
|---|---|---|
|
|
273
|
-
| **The connection silently dies** and the terminal just hangs | Google's client calls `run_forever()` with **no WebSocket keepalive ping**. A connection carrying no traffic gets quietly reaped by NAT tables, proxies and load balancers — neither end is told. The socket is now "half-open": you think you're connected, you're not. | We ping every 20s and expect a pong within 10s, so a dead connection is **detected in seconds instead of hanging forever**. |
|
|
274
|
-
| **One blip ends the session for good** | Google's client has **no reconnect logic at all**. Wi-Fi handover, VPN reconnect, closing your laptop lid — the socket closes, you get `Connection closed.`, and that's it. | We **reconnect automatically** with exponential backoff and jitter, re-reading your token each attempt. |
|
|
275
|
-
| **Your running job dies with the connection** | If a training run is in the foreground of the remote shell, losing the shell can take the job with it. | Your shell runs inside a **tmux session on the VM that we name and own**, so the job keeps running and reconnecting **puts you back in front of it**. |
|
|
276
|
-
| **The keepalive quietly stops** | Google's keepalive daemon is a child of *your terminal*, and it deliberately exits after 24h. Laptop sleeps → daemon dies → runtime idles out. | We **supervise it and restart it**, and `colabapi service install` keeps that running across logout and reboot. |
|
|
277
|
-
|
|
278
|
-
**And these are hard caps that nobody can bypass — colabapi doesn't pretend to:**
|
|
279
|
-
|
|
280
|
-
- **Absolute max lifetime (~12 h free, up to 24 h paid).** Enforced server-side. We show an *estimate* of time left and stop cleanly when it's reached, rather than hammering a dead endpoint.
|
|
281
|
-
- **GPU quota / "cannot currently connect to a GPU backend".** Google deliberately doesn't publish the numbers, and they vary. Waiting or upgrading are the only levers.
|
|
282
|
-
- **Out-of-memory or a full disk inside the VM.** That's a workload problem, not a connectivity problem, and we report it as one instead of calling it a disconnect.
|
|
283
|
-
|
|
284
|
-
The distinction that matters: **your connection dying is not your runtime dying.** Most "session died" reports are the former, which is recoverable — so colabapi recovers from it, and only tells you the session has genuinely ended when Colab actually says so (a 401/404 from the runtime), instead of guessing.
|
|
287
|
+
* `colabapi` has **no code path that asks for, reads, stores, or transmits your Google password.** Sign in is delegated entirely to Google's official CLI and happens in your own browser under Google's real login flow.
|
|
288
|
+
* `colabapi` operates **no servers**. There is nothing for your data to be sent to. The only network connections are between *your* machine, Google, and (via the official CLI) *your* Colab runtime.
|
|
289
|
+
* The only things written to disk are **plain preferences and session bookkeeping** (which runtime you picked and when), under `~/.config/colabapi` and `~/.local/state/colabapi`.
|
|
290
|
+
* Signing out is one command: `colabapi logout` removes the Google token that Google's CLI cached and forgets every session.
|
|
291
|
+
* The project is **MIT licensed and fully open source.** [Read the code](https://github.com/lil-limbo/colabapi/tree/main/colabapi). If you don't trust a claim here, verify it in the source. That's the point.
|
|
285
292
|
|
|
286
293
|
## Safety (please read)
|
|
287
294
|
|
|
288
|
-
`colabapi` deliberately uses **Google's official CLI** instead of the older "SSH into Colab via ngrok/cloudflared" trick, because Colab's own FAQ lists *remote control such as SSH shells* as an activity that can get a runtime
|
|
295
|
+
`colabapi` deliberately uses **Google's official CLI** instead of the older "SSH into Colab via ngrok/cloudflared" trick, because Colab's own FAQ lists *remote control such as SSH shells* as an activity that can get a runtime or an account terminated. Using the sanctioned path is far safer for your Google account.
|
|
289
296
|
|
|
290
|
-
**The keepalive is Google's own.** colabapi doesn't invent a scheme to defeat the idle timeout: it runs the keepalive daemon that ships inside Google's CLI, which pings Colab's own tunnel endpoint once a minute. Our reconnect pings are ordinary WebSocket keepalives on our own socket
|
|
297
|
+
**The keepalive is Google's own.** colabapi doesn't invent a scheme to defeat the idle timeout: it runs the keepalive daemon that ships inside Google's CLI, which pings Colab's own tunnel endpoint once a minute. Our reconnect pings are ordinary WebSocket keepalives on our own socket, standard practice for any long-lived connection, and *not* synthetic activity designed to look like a user who isn't there.
|
|
291
298
|
|
|
292
299
|
Be a good citizen: **don't hold GPU runtimes idle just to reserve them.** Colab's abuse heuristics are real and they do flag paying users. Nothing in colabapi tries to hide what you're doing, and you shouldn't either.
|
|
293
300
|
|
|
294
301
|
## FAQ
|
|
295
302
|
|
|
296
303
|
**Does colabapi see or store my Google password?**
|
|
297
|
-
No. Sign in is handled by Google's official CLI in your browser. `colabapi` has no password code path at all.
|
|
304
|
+
No. Sign in is handled by Google's official CLI in your browser. `colabapi` has no password code path at all. `colabapi logout` signs you out again whenever you want.
|
|
298
305
|
|
|
299
306
|
**How do I keep a Google Colab session alive after closing the browser?**
|
|
300
307
|
Allocate a runtime with `colabapi run`, then install the service (`colabapi service install`). Google's keepalive holds off the idle timeout; the systemd service keeps `colabapi` supervising it after you log out.
|
|
@@ -302,17 +309,20 @@ Allocate a runtime with `colabapi run`, then install the service (`colabapi serv
|
|
|
302
309
|
**Can I get a terminal / shell into Google Colab?**
|
|
303
310
|
Yes. `colabapi shell` opens a live PTY on the runtime via Google's `colab console`. `colabapi repl` gives a Python REPL.
|
|
304
311
|
|
|
312
|
+
**Is there a graphical interface?**
|
|
313
|
+
Yes. `colabapi ui` opens a desktop window with buttons for every common action, on Linux and Windows. On Windows, `colabapi register` also puts it in the Start menu and the app list, so you can open it like any other program.
|
|
314
|
+
|
|
305
315
|
**Can I use a free Colab account?**
|
|
306
316
|
Yes. CPU and T4 GPU runtimes are available on the free tier. Paid runtimes (L4, A100, H100, TPU) are shown but flagged; Colab itself refuses them on free accounts.
|
|
307
317
|
|
|
308
318
|
**How is this different from Google's official `colab` CLI?**
|
|
309
|
-
`colabapi` *uses* the official CLI under the hood, and adds the things it doesn't do: **it runs on Windows** (the official one cannot), **it reconnects when the network drops** (the official one has no keepalive and no retry), and it keeps the keepalive daemon alive across logout and reboot. On top of that: one `colabapi` command, a runtime picker with paid
|
|
319
|
+
`colabapi` *uses* the official CLI under the hood, and adds the things it doesn't do: **it runs on Windows** (the official one cannot), **it reconnects when the network drops** (the official one has no keepalive and no retry), and it keeps the keepalive daemon alive across logout and reboot. On top of that: one `colabapi` command, a desktop window, a runtime picker with paid tier flags, a live resource monitor, a session timer, and a ready-made background service. If you only need raw commands on Linux, use `colab` directly.
|
|
310
320
|
|
|
311
321
|
**Does colabapi work on Windows? Google says its CLI doesn't.**
|
|
312
|
-
Yes
|
|
322
|
+
Yes, that's one of the two reasons this project exists. Google's CLI imports `termios`, a POSIX-only module, at startup, so on Windows it dies before running any command at all. colabapi supplies the missing pieces through the Win32 console API, so Google's CLI runs unmodified in PowerShell and CMD. We don't patch their code, so their updates keep working. See [Windows](#windows).
|
|
313
323
|
|
|
314
324
|
**My session keeps dying. Is that Colab or colabapi?**
|
|
315
|
-
Usually neither
|
|
325
|
+
Usually neither: it's the *connection*, not the runtime. colabapi's reconnect and keepalive supervision exist exactly for that, and the hard limits that remain (Colab's idle timeout and max lifetime cap) are enforced server-side and shown by `colabapi status`.
|
|
316
326
|
|
|
317
327
|
**What happens to my running job if my Wi-Fi drops?**
|
|
318
328
|
It keeps running. Your shell lives inside a tmux session on the Colab VM, so the job is not attached to your connection; colabapi reconnects and puts you back in front of it. You can also detach on purpose with **Ctrl+]**.
|
|
@@ -325,7 +335,7 @@ No. `colabapi` is an independent, open source wrapper. "Google Colab" is a trade
|
|
|
325
335
|
|
|
326
336
|
## Contributing
|
|
327
337
|
|
|
328
|
-
Issues and pull requests welcome. If Google changes the official CLI's flags, the runtime
|
|
338
|
+
Issues and pull requests welcome. If Google changes the official CLI's flags, the mapping from runtime to flag lives in a single file (`colabapi/runtime.py`) and `colabapi doctor` will flag drift.
|
|
329
339
|
|
|
330
340
|
## License
|
|
331
341
|
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
# colabapi: a terminal for a persistent Google Colab runtime
|
|
2
2
|
|
|
3
|
-
**Run Google Colab from your own terminal
|
|
3
|
+
**Run Google Colab from your own terminal on Linux, macOS, *and Windows*. Keep the runtime alive after you close the browser, and reach its shell from any VPS or laptop.** `colabapi` is a small, open source command line tool (with an optional desktop window) that turns a Google Colab GPU/TPU session into something you can drive headlessly. Perfect for demos, MVPs, and long running jobs that must survive after the Colab web tab is gone.
|
|
4
4
|
|
|
5
5
|
> **In one line:** `colabapi` gives you a persistent Colab terminal on your own machine, using Google's official, ban safe sign in and tunnel, and it never sees your Google password.
|
|
6
6
|
|
|
7
7
|
**Two things you only get here:**
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
* 🪟 **It works on Windows.** Google's official Colab CLI is [Linux and macOS only](#windows). It fails on Windows before it can even parse a command. colabapi ships the compatibility layer that makes it run in PowerShell and CMD, and it registers as a real Windows app with its own icon and Start menu entry.
|
|
10
|
+
* 🔌 **It survives a dropped connection.** Google's terminal sets no WebSocket keepalive and has no reconnect, so one blip ends your session. colabapi pings, reconnects with backoff, and keeps your running job alive on the VM.
|
|
11
11
|
|
|
12
|
-
<!-- Keywords: google colab terminal, colab cli, colab ssh, colab windows, colab powershell, persistent colab, keep colab alive, headless colab, run colab from terminal, colab gpu terminal, colab from vps, colab session keep alive -->
|
|
12
|
+
<!-- Keywords: google colab terminal, colab cli, colab ssh, colab windows, colab powershell, persistent colab, keep colab alive, headless colab, run colab from terminal, colab gpu terminal, colab from vps, colab session keep alive, colab gui -->
|
|
13
13
|
|
|
14
14
|
---
|
|
15
15
|
|
|
@@ -17,37 +17,38 @@
|
|
|
17
17
|
|
|
18
18
|
Google Colab is fantastic free (and paid) GPU/TPU compute, but it only lives inside a browser tab. Close the tab or lose your connection and the session can go with it. That makes it awkward to:
|
|
19
19
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
* **demo an MVP** that needs a GPU without renting a server,
|
|
21
|
+
* **reach the runtime from a VPS** or a headless box,
|
|
22
|
+
* **register it as a background service** that stays up, or
|
|
23
|
+
* **watch CPU / GPU / RAM** from a normal terminal.
|
|
24
24
|
|
|
25
|
-
`colabapi` solves this by wrapping **Google's official [`google-colab-cli`](https://github.com/googlecolab/google-colab-cli)** with a friendly single command, a systemd service, a runtime picker, a live resource monitor, and a session time display. You sign in through Google's own browser flow; `colabapi` connects over Google's sanctioned tunnel.
|
|
25
|
+
`colabapi` solves this by wrapping **Google's official [`google-colab-cli`](https://github.com/googlecolab/google-colab-cli)** with a friendly single command, a graphical window, a systemd service, a runtime picker, a live resource monitor, and a session time display. You sign in through Google's own browser flow; `colabapi` connects over Google's sanctioned tunnel.
|
|
26
26
|
|
|
27
27
|
## Features
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
* 🖥 **A desktop app, not just a CLI.** `colabapi ui` opens a clean graphical window (white, minimal, works on Linux and Windows) with live CPU / RAM / GPU / VRAM graphs, a session list, and a **real terminal built into the window** — the shell, sign-in, runtime allocation and everything else run *inside it*, not in a terminal it throws you out to. On Windows it opens straight from the Start menu and the app list.
|
|
30
|
+
* 🪟 **Works on Windows** (PowerShell + CMD), which Google's own CLI does not. Registers as real installed software with its own logo.
|
|
31
|
+
* 🔌 **Reconnects instead of dying.** WebSocket keepalive pings, exponential backoff, and your work keeps running on the VM across the drop.
|
|
32
|
+
* 🔐 **Browser sign in, no password handling.** Authentication happens in Google's own login flow (including 2FA / device checks). `colabapi` never asks for, stores, or transmits your Google credentials. `colabapi logout` signs you out again in one command.
|
|
33
|
+
* 💻 **Real terminal into the runtime.** `colabapi shell` drops you into a live shell on the Colab VM. `colabapi repl` gives you a Python REPL.
|
|
34
|
+
* 🎛 **Runtime picker.** List CPU / T4 / L4 / G4 / A100 / H100 / TPU options; paid tier runtimes are clearly flagged as unavailable on a free account.
|
|
35
|
+
* 📈 **Live CPU / GPU / RAM monitor.** `colabapi monitor` streams runtime stats to your terminal (psutil + `nvidia-smi`).
|
|
36
|
+
* ⏱ **Session time display.** See uptime and an estimate of how long before Colab's max lifetime cap.
|
|
37
|
+
* ♻️ **Keepalive that stays up.** Runs Google's own keepalive daemon and restarts it when it dies, which it otherwise does silently.
|
|
38
|
+
* 🧩 **Runs as a background service.** systemd on Linux, a Scheduled Task on Windows, so your session survives logout and reboot.
|
|
39
|
+
* 🔎 **Inspectable & MIT licensed.** Read every line. Nothing phones home.
|
|
39
40
|
|
|
40
41
|
## How it works
|
|
41
42
|
|
|
42
43
|
```
|
|
43
44
|
you > colabapi (this tool) > colab_cli (Google's official CLI) > Google's tunnel > your Colab runtime (GPU/TPU VM)
|
|
44
45
|
|
|
45
|
-
colabapi adds: Windows support, auto-reconnect, keepalive supervision,
|
|
46
|
-
runtime picker, monitor, session timer, background service
|
|
46
|
+
colabapi adds: Windows support, auto-reconnect, keepalive supervision, a desktop
|
|
47
|
+
window, runtime picker, monitor, session timer, background service
|
|
47
48
|
colabapi never handles your Google password
|
|
48
49
|
```
|
|
49
50
|
|
|
50
|
-
`colabapi` is an **orchestration and reliability layer**. The heavy lifting
|
|
51
|
+
`colabapi` is an **orchestration and reliability layer**. The heavy lifting (OAuth sign in, allocating the runtime, and the encrypted tunnel) is delegated to Google's first party CLI, which is the safe, supported way to do this. We do not reimplement any of it; we make it run where it otherwise cannot, and keep it running when it otherwise would not.
|
|
51
52
|
|
|
52
53
|
## Install
|
|
53
54
|
|
|
@@ -62,17 +63,17 @@ pipx install colabapi
|
|
|
62
63
|
<a name="windows"></a>
|
|
63
64
|
### Windows (PowerShell or CMD)
|
|
64
65
|
|
|
65
|
-
> **Google's official Colab CLI does not support Windows at all
|
|
66
|
+
> **Google's official Colab CLI does not support Windows at all.** The docs say Linux and macOS only, and on Windows it raises `ImportError: No module named 'termios'` before it can parse a single command. **colabapi fixes that.** It ships a compatibility layer that supplies the POSIX pieces Windows lacks, so Google's CLI runs here unmodified. We patch nothing inside it, so their updates keep working.
|
|
66
67
|
|
|
67
68
|
**One line, in PowerShell:**
|
|
68
69
|
|
|
69
70
|
```powershell
|
|
70
|
-
irm https://raw.githubusercontent.com/lil-limbo/colabapi/
|
|
71
|
+
irm https://raw.githubusercontent.com/lil-limbo/colabapi/v0.2.1/scripts/install.ps1 | iex
|
|
71
72
|
```
|
|
72
73
|
|
|
73
|
-
That installs Python's `pipx` if needed, installs colabapi, fixes your `PATH`, and registers it with Windows. No administrator rights required.
|
|
74
|
+
That finds Python 3.12+ (and offers to install it with winget if you have none), installs Python's `pipx` if needed, installs colabapi, fixes your `PATH`, and registers it with Windows. No administrator rights required. The URL is pinned to the released tag, so you can [read exactly what will run](https://github.com/lil-limbo/colabapi/blob/v0.2.1/scripts/install.ps1) before you run it.
|
|
74
75
|
|
|
75
|
-
**Or by hand** (PowerShell or CMD
|
|
76
|
+
**Or by hand** (PowerShell or CMD, identical):
|
|
76
77
|
|
|
77
78
|
```powershell
|
|
78
79
|
python -m pip install --user pipx
|
|
@@ -89,10 +90,10 @@ colabapi doctor
|
|
|
89
90
|
|
|
90
91
|
**`colabapi register`** makes it a real Windows program rather than a loose `.exe`:
|
|
91
92
|
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
* it appears in **Settings, Installed apps** (and Add/Remove Programs) with the colabapi logo and a working uninstall entry;
|
|
94
|
+
* a **Start menu** entry opens the colabapi window (`colabapi ui`), and typing **`colabapi`** works from **Win+R**, without touching `PATH`.
|
|
94
95
|
|
|
95
|
-
It writes
|
|
96
|
+
It writes per-user keys under `HKEY_CURRENT_USER` (so no admin prompt), and `colabapi unregister` removes them, the shortcut, and the icon cleanly.
|
|
96
97
|
|
|
97
98
|
**Requires Python 3.12+** ([`winget install Python.Python.3.13`](https://learn.microsoft.com/en-us/windows/package-manager/winget/)). Works in Windows Terminal, PowerShell 5.1 and 7, and classic `cmd.exe`; ANSI colours are switched on automatically even on legacy consoles.
|
|
98
99
|
|
|
@@ -130,6 +131,8 @@ curl -fsSL https://raw.githubusercontent.com/lil-limbo/colabapi/main/scripts/ins
|
|
|
130
131
|
|
|
131
132
|
### From source
|
|
132
133
|
|
|
134
|
+
No git? Download the ZIP from GitHub ("Code", then "Download ZIP"), unpack it, and run `pip install -e .` inside. With git:
|
|
135
|
+
|
|
133
136
|
```bash
|
|
134
137
|
git clone https://github.com/lil-limbo/colabapi.git
|
|
135
138
|
cd colabapi
|
|
@@ -176,13 +179,36 @@ colabapi service install
|
|
|
176
179
|
systemctl --user start colabapi
|
|
177
180
|
```
|
|
178
181
|
|
|
182
|
+
Prefer clicking? `colabapi ui` opens the same actions in a window.
|
|
183
|
+
|
|
179
184
|
Press **Ctrl+C** to leave the monitor; type **`exit`** or press **Ctrl+D** to leave the shell. The Colab runtime keeps running until you stop it or Colab's timers end it.
|
|
180
185
|
|
|
186
|
+
## The desktop window
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
colabapi ui
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
**Everything happens in the window. Nothing opens a second terminal.**
|
|
193
|
+
|
|
194
|
+
* **Live graphs** across the top: CPU, RAM, GPU and VRAM, read from inside the selected runtime and plotted as they move.
|
|
195
|
+
* **A real terminal** in the window — a full VT emulator, not a log box. `Shell` drops you into the selected runtime (auto-reconnecting, and your work keeps running in tmux across a drop). `New runtime`, `Sign in`, `Monitor` and the rest run *in that same terminal*, on a pty, so their prompts prompt and you answer them right there.
|
|
196
|
+
* **Select a session, then act on it.** The list on the left is the selection `Shell`, `Stop` and `Monitor` operate on, and it is what the graphs follow. With nothing selected, those buttons are disabled rather than guessing.
|
|
197
|
+
* **Stop** releases the runtime, with a confirmation first.
|
|
198
|
+
* **Keyboard throughout:** Ctrl+N new runtime, Ctrl+S shell, Ctrl+K stop, Ctrl+M monitor, Ctrl+L sign in, F5 refresh. Enter on a session opens its shell. Every action is also a real, focusable button, and the menu bar carries the rest (REPL, status, runtimes, doctor, keep-alive service).
|
|
199
|
+
|
|
200
|
+
Sign-in is Google's own browser flow, exactly as on the command line — colabapi never sees your password.
|
|
201
|
+
|
|
202
|
+
* **Windows:** after `colabapi register`, "colabapi" in the Start menu and the app list opens this window directly. Windows has no pty, so there the interactive commands still open a console window; the shell, the graphs and everything else run in the window as normal.
|
|
203
|
+
* **Linux:** the window uses Tkinter, which some distros package separately. If `colabapi ui` says Tkinter is missing, install it with `sudo apt install python3-tk` (Debian / Ubuntu / Kali) or `sudo dnf install python3-tkinter` (Fedora).
|
|
204
|
+
|
|
181
205
|
## Command reference
|
|
182
206
|
|
|
183
207
|
| Command | What it does |
|
|
184
208
|
|---|---|
|
|
209
|
+
| `colabapi ui` | Open the colabapi window: live graphs, session list, and a built-in terminal that runs all of the below. |
|
|
185
210
|
| `colabapi login` | Sign in via Google's browser flow (no password handled). |
|
|
211
|
+
| `colabapi logout` | Sign out of Google and forget all sessions, for a clean start. |
|
|
186
212
|
| `colabapi runtimes` | List runtime types and which need a paid plan. |
|
|
187
213
|
| `colabapi run [--runtime KEY]` | Allocate a runtime and name the session (delegates to `colab new -s NAME`). |
|
|
188
214
|
| `colabapi sessions` | List the sessions colabapi manages. |
|
|
@@ -199,9 +225,9 @@ Press **Ctrl+C** to leave the monitor; type **`exit`** or press **Ctrl+D** to le
|
|
|
199
225
|
|
|
200
226
|
## Running as a background service
|
|
201
227
|
|
|
202
|
-
The service exists to fix a specific hole: Google's keepalive daemon is a child of *your terminal*. Close the laptop, log out of the VPS, or reboot, and it dies
|
|
228
|
+
The service exists to fix a specific hole: Google's keepalive daemon is a child of *your terminal*. Close the laptop, log out of the VPS, or reboot, and it dies, so your runtime idles out even though nothing was actually wrong with it. Registering colabapi with the OS means the keepalive comes back on its own.
|
|
203
229
|
|
|
204
|
-
**Linux
|
|
230
|
+
**Linux**, a systemd **user** service (no root required):
|
|
205
231
|
|
|
206
232
|
```bash
|
|
207
233
|
colabapi service install # writes ~/.config/systemd/user/colabapi.service and enables lingering
|
|
@@ -211,7 +237,7 @@ systemctl --user status colabapi
|
|
|
211
237
|
|
|
212
238
|
Lingering (`loginctl enable-linger`) is what lets the service keep running after you disconnect from the VPS, which is exactly what you want for an always-on demo.
|
|
213
239
|
|
|
214
|
-
**Windows
|
|
240
|
+
**Windows**, a **Scheduled Task** that runs at logon (no administrator rights, unlike a true Windows Service):
|
|
215
241
|
|
|
216
242
|
```powershell
|
|
217
243
|
colabapi service install
|
|
@@ -225,45 +251,24 @@ It appears in Task Scheduler as **colabapi**, and `colabapi service uninstall` r
|
|
|
225
251
|
|
|
226
252
|
**We do not capture your login data. We do not collect anything.**
|
|
227
253
|
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
<a name="staying-alive-what-actually-kills-a-colab-session"></a>
|
|
234
|
-
## Staying alive: what actually kills a Colab session
|
|
235
|
-
|
|
236
|
-
"Colab killed my session for no reason" is usually several different failures wearing the same coat. They have different causes and different fixes, and lumping them together is why they never get fixed. Here is the honest breakdown.
|
|
237
|
-
|
|
238
|
-
**Two of them are our bugs to fix, and v0.2.0 fixes them:**
|
|
239
|
-
|
|
240
|
-
| What goes wrong | Why | What colabapi does |
|
|
241
|
-
|---|---|---|
|
|
242
|
-
| **The connection silently dies** and the terminal just hangs | Google's client calls `run_forever()` with **no WebSocket keepalive ping**. A connection carrying no traffic gets quietly reaped by NAT tables, proxies and load balancers — neither end is told. The socket is now "half-open": you think you're connected, you're not. | We ping every 20s and expect a pong within 10s, so a dead connection is **detected in seconds instead of hanging forever**. |
|
|
243
|
-
| **One blip ends the session for good** | Google's client has **no reconnect logic at all**. Wi-Fi handover, VPN reconnect, closing your laptop lid — the socket closes, you get `Connection closed.`, and that's it. | We **reconnect automatically** with exponential backoff and jitter, re-reading your token each attempt. |
|
|
244
|
-
| **Your running job dies with the connection** | If a training run is in the foreground of the remote shell, losing the shell can take the job with it. | Your shell runs inside a **tmux session on the VM that we name and own**, so the job keeps running and reconnecting **puts you back in front of it**. |
|
|
245
|
-
| **The keepalive quietly stops** | Google's keepalive daemon is a child of *your terminal*, and it deliberately exits after 24h. Laptop sleeps → daemon dies → runtime idles out. | We **supervise it and restart it**, and `colabapi service install` keeps that running across logout and reboot. |
|
|
246
|
-
|
|
247
|
-
**And these are hard caps that nobody can bypass — colabapi doesn't pretend to:**
|
|
248
|
-
|
|
249
|
-
- **Absolute max lifetime (~12 h free, up to 24 h paid).** Enforced server-side. We show an *estimate* of time left and stop cleanly when it's reached, rather than hammering a dead endpoint.
|
|
250
|
-
- **GPU quota / "cannot currently connect to a GPU backend".** Google deliberately doesn't publish the numbers, and they vary. Waiting or upgrading are the only levers.
|
|
251
|
-
- **Out-of-memory or a full disk inside the VM.** That's a workload problem, not a connectivity problem, and we report it as one instead of calling it a disconnect.
|
|
252
|
-
|
|
253
|
-
The distinction that matters: **your connection dying is not your runtime dying.** Most "session died" reports are the former, which is recoverable — so colabapi recovers from it, and only tells you the session has genuinely ended when Colab actually says so (a 401/404 from the runtime), instead of guessing.
|
|
254
|
+
* `colabapi` has **no code path that asks for, reads, stores, or transmits your Google password.** Sign in is delegated entirely to Google's official CLI and happens in your own browser under Google's real login flow.
|
|
255
|
+
* `colabapi` operates **no servers**. There is nothing for your data to be sent to. The only network connections are between *your* machine, Google, and (via the official CLI) *your* Colab runtime.
|
|
256
|
+
* The only things written to disk are **plain preferences and session bookkeeping** (which runtime you picked and when), under `~/.config/colabapi` and `~/.local/state/colabapi`.
|
|
257
|
+
* Signing out is one command: `colabapi logout` removes the Google token that Google's CLI cached and forgets every session.
|
|
258
|
+
* The project is **MIT licensed and fully open source.** [Read the code](https://github.com/lil-limbo/colabapi/tree/main/colabapi). If you don't trust a claim here, verify it in the source. That's the point.
|
|
254
259
|
|
|
255
260
|
## Safety (please read)
|
|
256
261
|
|
|
257
|
-
`colabapi` deliberately uses **Google's official CLI** instead of the older "SSH into Colab via ngrok/cloudflared" trick, because Colab's own FAQ lists *remote control such as SSH shells* as an activity that can get a runtime
|
|
262
|
+
`colabapi` deliberately uses **Google's official CLI** instead of the older "SSH into Colab via ngrok/cloudflared" trick, because Colab's own FAQ lists *remote control such as SSH shells* as an activity that can get a runtime or an account terminated. Using the sanctioned path is far safer for your Google account.
|
|
258
263
|
|
|
259
|
-
**The keepalive is Google's own.** colabapi doesn't invent a scheme to defeat the idle timeout: it runs the keepalive daemon that ships inside Google's CLI, which pings Colab's own tunnel endpoint once a minute. Our reconnect pings are ordinary WebSocket keepalives on our own socket
|
|
264
|
+
**The keepalive is Google's own.** colabapi doesn't invent a scheme to defeat the idle timeout: it runs the keepalive daemon that ships inside Google's CLI, which pings Colab's own tunnel endpoint once a minute. Our reconnect pings are ordinary WebSocket keepalives on our own socket, standard practice for any long-lived connection, and *not* synthetic activity designed to look like a user who isn't there.
|
|
260
265
|
|
|
261
266
|
Be a good citizen: **don't hold GPU runtimes idle just to reserve them.** Colab's abuse heuristics are real and they do flag paying users. Nothing in colabapi tries to hide what you're doing, and you shouldn't either.
|
|
262
267
|
|
|
263
268
|
## FAQ
|
|
264
269
|
|
|
265
270
|
**Does colabapi see or store my Google password?**
|
|
266
|
-
No. Sign in is handled by Google's official CLI in your browser. `colabapi` has no password code path at all.
|
|
271
|
+
No. Sign in is handled by Google's official CLI in your browser. `colabapi` has no password code path at all. `colabapi logout` signs you out again whenever you want.
|
|
267
272
|
|
|
268
273
|
**How do I keep a Google Colab session alive after closing the browser?**
|
|
269
274
|
Allocate a runtime with `colabapi run`, then install the service (`colabapi service install`). Google's keepalive holds off the idle timeout; the systemd service keeps `colabapi` supervising it after you log out.
|
|
@@ -271,17 +276,20 @@ Allocate a runtime with `colabapi run`, then install the service (`colabapi serv
|
|
|
271
276
|
**Can I get a terminal / shell into Google Colab?**
|
|
272
277
|
Yes. `colabapi shell` opens a live PTY on the runtime via Google's `colab console`. `colabapi repl` gives a Python REPL.
|
|
273
278
|
|
|
279
|
+
**Is there a graphical interface?**
|
|
280
|
+
Yes. `colabapi ui` opens a desktop window with buttons for every common action, on Linux and Windows. On Windows, `colabapi register` also puts it in the Start menu and the app list, so you can open it like any other program.
|
|
281
|
+
|
|
274
282
|
**Can I use a free Colab account?**
|
|
275
283
|
Yes. CPU and T4 GPU runtimes are available on the free tier. Paid runtimes (L4, A100, H100, TPU) are shown but flagged; Colab itself refuses them on free accounts.
|
|
276
284
|
|
|
277
285
|
**How is this different from Google's official `colab` CLI?**
|
|
278
|
-
`colabapi` *uses* the official CLI under the hood, and adds the things it doesn't do: **it runs on Windows** (the official one cannot), **it reconnects when the network drops** (the official one has no keepalive and no retry), and it keeps the keepalive daemon alive across logout and reboot. On top of that: one `colabapi` command, a runtime picker with paid
|
|
286
|
+
`colabapi` *uses* the official CLI under the hood, and adds the things it doesn't do: **it runs on Windows** (the official one cannot), **it reconnects when the network drops** (the official one has no keepalive and no retry), and it keeps the keepalive daemon alive across logout and reboot. On top of that: one `colabapi` command, a desktop window, a runtime picker with paid tier flags, a live resource monitor, a session timer, and a ready-made background service. If you only need raw commands on Linux, use `colab` directly.
|
|
279
287
|
|
|
280
288
|
**Does colabapi work on Windows? Google says its CLI doesn't.**
|
|
281
|
-
Yes
|
|
289
|
+
Yes, that's one of the two reasons this project exists. Google's CLI imports `termios`, a POSIX-only module, at startup, so on Windows it dies before running any command at all. colabapi supplies the missing pieces through the Win32 console API, so Google's CLI runs unmodified in PowerShell and CMD. We don't patch their code, so their updates keep working. See [Windows](#windows).
|
|
282
290
|
|
|
283
291
|
**My session keeps dying. Is that Colab or colabapi?**
|
|
284
|
-
Usually neither
|
|
292
|
+
Usually neither: it's the *connection*, not the runtime. colabapi's reconnect and keepalive supervision exist exactly for that, and the hard limits that remain (Colab's idle timeout and max lifetime cap) are enforced server-side and shown by `colabapi status`.
|
|
285
293
|
|
|
286
294
|
**What happens to my running job if my Wi-Fi drops?**
|
|
287
295
|
It keeps running. Your shell lives inside a tmux session on the Colab VM, so the job is not attached to your connection; colabapi reconnects and puts you back in front of it. You can also detach on purpose with **Ctrl+]**.
|
|
@@ -294,7 +302,7 @@ No. `colabapi` is an independent, open source wrapper. "Google Colab" is a trade
|
|
|
294
302
|
|
|
295
303
|
## Contributing
|
|
296
304
|
|
|
297
|
-
Issues and pull requests welcome. If Google changes the official CLI's flags, the runtime
|
|
305
|
+
Issues and pull requests welcome. If Google changes the official CLI's flags, the mapping from runtime to flag lives in a single file (`colabapi/runtime.py`) and `colabapi doctor` will flag drift.
|
|
298
306
|
|
|
299
307
|
## License
|
|
300
308
|
|