colabapi 0.2.0__tar.gz → 0.2.1__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.1}/PKG-INFO +67 -66
- {colabapi-0.2.0 → colabapi-0.2.1}/README.md +65 -65
- {colabapi-0.2.0 → colabapi-0.2.1}/colabapi/__init__.py +1 -1
- colabapi-0.2.1/colabapi/__main__.py +14 -0
- colabapi-0.2.1/colabapi/assets/colabapi.ico +0 -0
- colabapi-0.2.1/colabapi/assets/colabapi.png +0 -0
- {colabapi-0.2.0 → colabapi-0.2.1}/colabapi/cli.py +121 -1
- colabapi-0.2.1/colabapi/gui.py +299 -0
- {colabapi-0.2.0 → colabapi-0.2.1}/colabapi/winreg_install.py +97 -2
- {colabapi-0.2.0 → colabapi-0.2.1}/colabapi.egg-info/PKG-INFO +67 -66
- {colabapi-0.2.0 → colabapi-0.2.1}/colabapi.egg-info/SOURCES.txt +6 -1
- {colabapi-0.2.0 → colabapi-0.2.1}/pyproject.toml +10 -1
- colabapi-0.2.1/tests/test_windows_encoding.py +66 -0
- {colabapi-0.2.0 → colabapi-0.2.1}/LICENSE +0 -0
- {colabapi-0.2.0 → colabapi-0.2.1}/colabapi/_colab_shim.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.1}/colabapi/_winshim.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.1}/colabapi/colabcli.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.1}/colabapi/config.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.1}/colabapi/keepalive.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.1}/colabapi/monitor.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.1}/colabapi/persist.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.1}/colabapi/platform.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.1}/colabapi/procutil.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.1}/colabapi/runtime.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.1}/colabapi/service.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.1}/colabapi/shellview.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.1}/colabapi/terminal.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.1}/colabapi/timing.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.1}/colabapi/ui.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.1}/colabapi.egg-info/dependency_links.txt +0 -0
- {colabapi-0.2.0 → colabapi-0.2.1}/colabapi.egg-info/entry_points.txt +0 -0
- {colabapi-0.2.0 → colabapi-0.2.1}/colabapi.egg-info/requires.txt +0 -0
- {colabapi-0.2.0 → colabapi-0.2.1}/colabapi.egg-info/top_level.txt +0 -0
- {colabapi-0.2.0 → colabapi-0.2.1}/setup.cfg +0 -0
- {colabapi-0.2.0 → colabapi-0.2.1}/tests/test_close_semantics.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.1}/tests/test_e2e_console.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.1}/tests/test_reconnect.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.1}/tests/test_windows_compat.py +0 -0
- {colabapi-0.2.0 → colabapi-0.2.1}/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.1
|
|
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
|
|
@@ -31,16 +32,16 @@ Dynamic: license-file
|
|
|
31
32
|
|
|
32
33
|
# colabapi: a terminal for a persistent Google Colab runtime
|
|
33
34
|
|
|
34
|
-
**Run Google Colab from your own terminal
|
|
35
|
+
**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
36
|
|
|
36
37
|
> **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
38
|
|
|
38
39
|
**Two things you only get here:**
|
|
39
40
|
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
* 🪟 **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.
|
|
42
|
+
* 🔌 **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
43
|
|
|
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 -->
|
|
44
|
+
<!-- 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
45
|
|
|
45
46
|
---
|
|
46
47
|
|
|
@@ -48,37 +49,38 @@ Dynamic: license-file
|
|
|
48
49
|
|
|
49
50
|
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
51
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
* **demo an MVP** that needs a GPU without renting a server,
|
|
53
|
+
* **reach the runtime from a VPS** or a headless box,
|
|
54
|
+
* **register it as a background service** that stays up, or
|
|
55
|
+
* **watch CPU / GPU / RAM** from a normal terminal.
|
|
55
56
|
|
|
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.
|
|
57
|
+
`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
58
|
|
|
58
59
|
## Features
|
|
59
60
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
61
|
+
* 🖥 **A desktop app, not just a CLI.** `colabapi ui` opens a clean graphical window (white, minimal, works on Linux and Windows) with one click access to Login, Run, Shell, Monitor, Sessions, Status, Doctor, and Logout. On Windows it opens straight from the Start menu and the app list.
|
|
62
|
+
* 🪟 **Works on Windows** (PowerShell + CMD), which Google's own CLI does not. Registers as real installed software with its own logo.
|
|
63
|
+
* 🔌 **Reconnects instead of dying.** WebSocket keepalive pings, exponential backoff, and your work keeps running on the VM across the drop.
|
|
64
|
+
* 🔐 **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.
|
|
65
|
+
* 💻 **Real terminal into the runtime.** `colabapi shell` drops you into a live shell on the Colab VM. `colabapi repl` gives you a Python REPL.
|
|
66
|
+
* 🎛 **Runtime picker.** List CPU / T4 / L4 / G4 / A100 / H100 / TPU options; paid tier runtimes are clearly flagged as unavailable on a free account.
|
|
67
|
+
* 📈 **Live CPU / GPU / RAM monitor.** `colabapi monitor` streams runtime stats to your terminal (psutil + `nvidia-smi`).
|
|
68
|
+
* ⏱ **Session time display.** See uptime and an estimate of how long before Colab's max lifetime cap.
|
|
69
|
+
* ♻️ **Keepalive that stays up.** Runs Google's own keepalive daemon and restarts it when it dies, which it otherwise does silently.
|
|
70
|
+
* 🧩 **Runs as a background service.** systemd on Linux, a Scheduled Task on Windows, so your session survives logout and reboot.
|
|
71
|
+
* 🔎 **Inspectable & MIT licensed.** Read every line. Nothing phones home.
|
|
70
72
|
|
|
71
73
|
## How it works
|
|
72
74
|
|
|
73
75
|
```
|
|
74
76
|
you > colabapi (this tool) > colab_cli (Google's official CLI) > Google's tunnel > your Colab runtime (GPU/TPU VM)
|
|
75
77
|
|
|
76
|
-
colabapi adds: Windows support, auto-reconnect, keepalive supervision,
|
|
77
|
-
runtime picker, monitor, session timer, background service
|
|
78
|
+
colabapi adds: Windows support, auto-reconnect, keepalive supervision, a desktop
|
|
79
|
+
window, runtime picker, monitor, session timer, background service
|
|
78
80
|
colabapi never handles your Google password
|
|
79
81
|
```
|
|
80
82
|
|
|
81
|
-
`colabapi` is an **orchestration and reliability layer**. The heavy lifting
|
|
83
|
+
`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
84
|
|
|
83
85
|
## Install
|
|
84
86
|
|
|
@@ -93,17 +95,17 @@ pipx install colabapi
|
|
|
93
95
|
<a name="windows"></a>
|
|
94
96
|
### Windows (PowerShell or CMD)
|
|
95
97
|
|
|
96
|
-
> **Google's official Colab CLI does not support Windows at all
|
|
98
|
+
> **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
99
|
|
|
98
100
|
**One line, in PowerShell:**
|
|
99
101
|
|
|
100
102
|
```powershell
|
|
101
|
-
irm https://raw.githubusercontent.com/lil-limbo/colabapi/
|
|
103
|
+
irm https://raw.githubusercontent.com/lil-limbo/colabapi/v0.2.1/scripts/install.ps1 | iex
|
|
102
104
|
```
|
|
103
105
|
|
|
104
|
-
That installs Python's `pipx` if needed, installs colabapi, fixes your `PATH`, and registers it with Windows. No administrator rights required.
|
|
106
|
+
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
107
|
|
|
106
|
-
**Or by hand** (PowerShell or CMD
|
|
108
|
+
**Or by hand** (PowerShell or CMD, identical):
|
|
107
109
|
|
|
108
110
|
```powershell
|
|
109
111
|
python -m pip install --user pipx
|
|
@@ -120,10 +122,10 @@ colabapi doctor
|
|
|
120
122
|
|
|
121
123
|
**`colabapi register`** makes it a real Windows program rather than a loose `.exe`:
|
|
122
124
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
+
* it appears in **Settings, Installed apps** (and Add/Remove Programs) with the colabapi logo and a working uninstall entry;
|
|
126
|
+
* a **Start menu** entry opens the colabapi window (`colabapi ui`), and typing **`colabapi`** works from **Win+R**, without touching `PATH`.
|
|
125
127
|
|
|
126
|
-
It writes
|
|
128
|
+
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
129
|
|
|
128
130
|
**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
131
|
|
|
@@ -161,6 +163,8 @@ curl -fsSL https://raw.githubusercontent.com/lil-limbo/colabapi/main/scripts/ins
|
|
|
161
163
|
|
|
162
164
|
### From source
|
|
163
165
|
|
|
166
|
+
No git? Download the ZIP from GitHub ("Code", then "Download ZIP"), unpack it, and run `pip install -e .` inside. With git:
|
|
167
|
+
|
|
164
168
|
```bash
|
|
165
169
|
git clone https://github.com/lil-limbo/colabapi.git
|
|
166
170
|
cd colabapi
|
|
@@ -207,13 +211,28 @@ colabapi service install
|
|
|
207
211
|
systemctl --user start colabapi
|
|
208
212
|
```
|
|
209
213
|
|
|
214
|
+
Prefer clicking? `colabapi ui` opens the same actions in a window.
|
|
215
|
+
|
|
210
216
|
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
217
|
|
|
218
|
+
## The desktop window
|
|
219
|
+
|
|
220
|
+
```bash
|
|
221
|
+
colabapi ui
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
A minimal white window with the same actions as the CLI: sign in, allocate a runtime, open the shell or the live monitor (each in its own terminal window), and check sessions, status, or doctor output right inside the window. The header shows whether you are signed in and how many sessions are active.
|
|
225
|
+
|
|
226
|
+
* **Windows:** after `colabapi register`, "colabapi" in the Start menu and the app list opens this window directly.
|
|
227
|
+
* **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).
|
|
228
|
+
|
|
212
229
|
## Command reference
|
|
213
230
|
|
|
214
231
|
| Command | What it does |
|
|
215
232
|
|---|---|
|
|
233
|
+
| `colabapi ui` | Open the colabapi desktop window (all of the below, with buttons). |
|
|
216
234
|
| `colabapi login` | Sign in via Google's browser flow (no password handled). |
|
|
235
|
+
| `colabapi logout` | Sign out of Google and forget all sessions, for a clean start. |
|
|
217
236
|
| `colabapi runtimes` | List runtime types and which need a paid plan. |
|
|
218
237
|
| `colabapi run [--runtime KEY]` | Allocate a runtime and name the session (delegates to `colab new -s NAME`). |
|
|
219
238
|
| `colabapi sessions` | List the sessions colabapi manages. |
|
|
@@ -230,9 +249,9 @@ Press **Ctrl+C** to leave the monitor; type **`exit`** or press **Ctrl+D** to le
|
|
|
230
249
|
|
|
231
250
|
## Running as a background service
|
|
232
251
|
|
|
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
|
|
252
|
+
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
253
|
|
|
235
|
-
**Linux
|
|
254
|
+
**Linux**, a systemd **user** service (no root required):
|
|
236
255
|
|
|
237
256
|
```bash
|
|
238
257
|
colabapi service install # writes ~/.config/systemd/user/colabapi.service and enables lingering
|
|
@@ -242,7 +261,7 @@ systemctl --user status colabapi
|
|
|
242
261
|
|
|
243
262
|
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
263
|
|
|
245
|
-
**Windows
|
|
264
|
+
**Windows**, a **Scheduled Task** that runs at logon (no administrator rights, unlike a true Windows Service):
|
|
246
265
|
|
|
247
266
|
```powershell
|
|
248
267
|
colabapi service install
|
|
@@ -256,45 +275,24 @@ It appears in Task Scheduler as **colabapi**, and `colabapi service uninstall` r
|
|
|
256
275
|
|
|
257
276
|
**We do not capture your login data. We do not collect anything.**
|
|
258
277
|
|
|
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.
|
|
278
|
+
* `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.
|
|
279
|
+
* `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.
|
|
280
|
+
* 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`.
|
|
281
|
+
* Signing out is one command: `colabapi logout` removes the Google token that Google's CLI cached and forgets every session.
|
|
282
|
+
* 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
283
|
|
|
286
284
|
## Safety (please read)
|
|
287
285
|
|
|
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
|
|
286
|
+
`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
287
|
|
|
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
|
|
288
|
+
**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
289
|
|
|
292
290
|
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
291
|
|
|
294
292
|
## FAQ
|
|
295
293
|
|
|
296
294
|
**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.
|
|
295
|
+
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
296
|
|
|
299
297
|
**How do I keep a Google Colab session alive after closing the browser?**
|
|
300
298
|
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 +300,20 @@ Allocate a runtime with `colabapi run`, then install the service (`colabapi serv
|
|
|
302
300
|
**Can I get a terminal / shell into Google Colab?**
|
|
303
301
|
Yes. `colabapi shell` opens a live PTY on the runtime via Google's `colab console`. `colabapi repl` gives a Python REPL.
|
|
304
302
|
|
|
303
|
+
**Is there a graphical interface?**
|
|
304
|
+
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.
|
|
305
|
+
|
|
305
306
|
**Can I use a free Colab account?**
|
|
306
307
|
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
308
|
|
|
308
309
|
**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
|
|
310
|
+
`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
311
|
|
|
311
312
|
**Does colabapi work on Windows? Google says its CLI doesn't.**
|
|
312
|
-
Yes
|
|
313
|
+
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
314
|
|
|
314
315
|
**My session keeps dying. Is that Colab or colabapi?**
|
|
315
|
-
Usually neither
|
|
316
|
+
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
317
|
|
|
317
318
|
**What happens to my running job if my Wi-Fi drops?**
|
|
318
319
|
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 +326,7 @@ No. `colabapi` is an independent, open source wrapper. "Google Colab" is a trade
|
|
|
325
326
|
|
|
326
327
|
## Contributing
|
|
327
328
|
|
|
328
|
-
Issues and pull requests welcome. If Google changes the official CLI's flags, the runtime
|
|
329
|
+
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
330
|
|
|
330
331
|
## License
|
|
331
332
|
|
|
@@ -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 one click access to Login, Run, Shell, Monitor, Sessions, Status, Doctor, and Logout. 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,28 @@ 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
|
+
A minimal white window with the same actions as the CLI: sign in, allocate a runtime, open the shell or the live monitor (each in its own terminal window), and check sessions, status, or doctor output right inside the window. The header shows whether you are signed in and how many sessions are active.
|
|
193
|
+
|
|
194
|
+
* **Windows:** after `colabapi register`, "colabapi" in the Start menu and the app list opens this window directly.
|
|
195
|
+
* **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).
|
|
196
|
+
|
|
181
197
|
## Command reference
|
|
182
198
|
|
|
183
199
|
| Command | What it does |
|
|
184
200
|
|---|---|
|
|
201
|
+
| `colabapi ui` | Open the colabapi desktop window (all of the below, with buttons). |
|
|
185
202
|
| `colabapi login` | Sign in via Google's browser flow (no password handled). |
|
|
203
|
+
| `colabapi logout` | Sign out of Google and forget all sessions, for a clean start. |
|
|
186
204
|
| `colabapi runtimes` | List runtime types and which need a paid plan. |
|
|
187
205
|
| `colabapi run [--runtime KEY]` | Allocate a runtime and name the session (delegates to `colab new -s NAME`). |
|
|
188
206
|
| `colabapi sessions` | List the sessions colabapi manages. |
|
|
@@ -199,9 +217,9 @@ Press **Ctrl+C** to leave the monitor; type **`exit`** or press **Ctrl+D** to le
|
|
|
199
217
|
|
|
200
218
|
## Running as a background service
|
|
201
219
|
|
|
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
|
|
220
|
+
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
221
|
|
|
204
|
-
**Linux
|
|
222
|
+
**Linux**, a systemd **user** service (no root required):
|
|
205
223
|
|
|
206
224
|
```bash
|
|
207
225
|
colabapi service install # writes ~/.config/systemd/user/colabapi.service and enables lingering
|
|
@@ -211,7 +229,7 @@ systemctl --user status colabapi
|
|
|
211
229
|
|
|
212
230
|
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
231
|
|
|
214
|
-
**Windows
|
|
232
|
+
**Windows**, a **Scheduled Task** that runs at logon (no administrator rights, unlike a true Windows Service):
|
|
215
233
|
|
|
216
234
|
```powershell
|
|
217
235
|
colabapi service install
|
|
@@ -225,45 +243,24 @@ It appears in Task Scheduler as **colabapi**, and `colabapi service uninstall` r
|
|
|
225
243
|
|
|
226
244
|
**We do not capture your login data. We do not collect anything.**
|
|
227
245
|
|
|
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.
|
|
246
|
+
* `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.
|
|
247
|
+
* `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.
|
|
248
|
+
* 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`.
|
|
249
|
+
* Signing out is one command: `colabapi logout` removes the Google token that Google's CLI cached and forgets every session.
|
|
250
|
+
* 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
251
|
|
|
255
252
|
## Safety (please read)
|
|
256
253
|
|
|
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
|
|
254
|
+
`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
255
|
|
|
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
|
|
256
|
+
**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
257
|
|
|
261
258
|
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
259
|
|
|
263
260
|
## FAQ
|
|
264
261
|
|
|
265
262
|
**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.
|
|
263
|
+
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
264
|
|
|
268
265
|
**How do I keep a Google Colab session alive after closing the browser?**
|
|
269
266
|
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 +268,20 @@ Allocate a runtime with `colabapi run`, then install the service (`colabapi serv
|
|
|
271
268
|
**Can I get a terminal / shell into Google Colab?**
|
|
272
269
|
Yes. `colabapi shell` opens a live PTY on the runtime via Google's `colab console`. `colabapi repl` gives a Python REPL.
|
|
273
270
|
|
|
271
|
+
**Is there a graphical interface?**
|
|
272
|
+
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.
|
|
273
|
+
|
|
274
274
|
**Can I use a free Colab account?**
|
|
275
275
|
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
276
|
|
|
277
277
|
**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
|
|
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 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
279
|
|
|
280
280
|
**Does colabapi work on Windows? Google says its CLI doesn't.**
|
|
281
|
-
Yes
|
|
281
|
+
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
282
|
|
|
283
283
|
**My session keeps dying. Is that Colab or colabapi?**
|
|
284
|
-
Usually neither
|
|
284
|
+
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
285
|
|
|
286
286
|
**What happens to my running job if my Wi-Fi drops?**
|
|
287
287
|
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 +294,7 @@ No. `colabapi` is an independent, open source wrapper. "Google Colab" is a trade
|
|
|
294
294
|
|
|
295
295
|
## Contributing
|
|
296
296
|
|
|
297
|
-
Issues and pull requests welcome. If Google changes the official CLI's flags, the runtime
|
|
297
|
+
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
298
|
|
|
299
299
|
## License
|
|
300
300
|
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"""Make `python -m colabapi` equivalent to the `colabapi` command.
|
|
2
|
+
|
|
3
|
+
The console script is the normal entry point, but `python -m colabapi` is what
|
|
4
|
+
works when the scripts directory is not on PATH (a fresh install before the
|
|
5
|
+
shell restarts, a venv driven by absolute path, a subprocess that only knows
|
|
6
|
+
the interpreter). Same main(), same behaviour.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
|
|
11
|
+
from .cli import main
|
|
12
|
+
|
|
13
|
+
if __name__ == "__main__":
|
|
14
|
+
main()
|
|
Binary file
|
|
Binary file
|