fastcolab 0.0.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.
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2022, fastai
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,222 @@
1
+ Metadata-Version: 2.4
2
+ Name: fastcolab
3
+ Version: 0.0.1
4
+ Summary: Convenient access to the colab API
5
+ Author-email: Jeremy Howard <github@jhoward.fastmail.fm>
6
+ License-Expression: Apache-2.0
7
+ Project-URL: Repository, https://github.com/AnswerDotAI/fastcolab
8
+ Project-URL: Documentation, https://AnswerDotAI.github.io/fastcolab/
9
+ Keywords: nbdev
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3 :: Only
12
+ Requires-Python: >=3.10
13
+ Description-Content-Type: text/markdown
14
+ License-File: LICENSE
15
+ Requires-Dist: fastcore
16
+ Requires-Dist: fastgws
17
+ Requires-Dist: google-colab-cli
18
+ Requires-Dist: jupyasyncclient>=0.2.28
19
+ Dynamic: license-file
20
+
21
+ # fastcolab
22
+
23
+
24
+ <!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
25
+
26
+ Most developers know [Google Colab](https://colab.research.google.com) as a hosted browser notebook for quick experiments. Underneath that browser UI, Google runs an on-demand CPU, GPU, and TPU compute platform with an official [REST API](https://developers.google.com/colab/api/reference/rest) at `colaboratory.googleapis.com`. You can provision machines, run Python scripts or multi-hour training jobs, transfer files, SSH directly into running virtual machines, and tear down runtimes from code without opening a browser or writing a notebook.
27
+
28
+ The cost is hard to beat. Google bundles 1,000 monthly Colab compute units into [Google AI Ultra](https://one.google.com/) 5x (\$99.99/month) and 2,000 into Ultra 20x (\$199.99/month) alongside Gemini Ultra and cloud storage. Even at standalone Pay-As-You-Go prices (\$0.10 per unit), Colab’s accelerators cost a fraction of standard cloud GPU rates. A 96 GB RTX PRO 6000 runs around \$0.67 to \$0.89 an hour compared to \$3.03 on [Modal](https://modal.com/pricing), and a single-chip Trillium TPU runs around \$0.41 an hour compared to \$2.70 on [Google Cloud](https://cloud.google.com/tpu/pricing). If you already pay for a Google AI Ultra subscription, hundreds of GPU or TPU hours sit in your account every month.
29
+
30
+ `fastcolab` wraps Colab’s REST API (through [`fastgws`](https://github.com/answerdotai/fastgws)) and runtime Jupyter proxy (through [`jupyasyncclient`](https://github.com/AnswerDotAI/jupyasyncclient)) to make that compute practical from Python.
31
+
32
+ ## Plans and compute units
33
+
34
+ All [Colab plans](https://colab.research.google.com/signup) and [Google AI subscriptions](https://one.google.com/) credit the same account balance.
35
+
36
+ | Plan | Price | Monthly units | Included extras |
37
+ |----|----|----|----|
38
+ | Google AI Ultra 5x | \$99.99/month | 1,000 | Gemini Ultra (5x), 20 TB storage, background execution |
39
+ | Google AI Ultra 20x | \$199.99/month | 2,000 | Gemini Ultra (20x), 30 TB storage, background execution |
40
+ | Colab Pro+ | \$49.99/month | 500 to 600 | Standalone subscription, background execution |
41
+ | Colab Pro / Pay-As-You-Go | \$9.99 | 100 | Monthly subscription or one-time top-up |
42
+
43
+ Unused units roll over from month to month and expire 90 days after issue. Colab bills units for every minute a machine stays allocated, including idle periods. Delete each runtime as soon as work finishes.
44
+
45
+ ## Choosing a runtime
46
+
47
+ Turn on High-RAM (`HIGHMEM`) on CPU and T4 runtimes. It quadruples RAM from roughly 13 GB to 51 GB and raises CPU cores from 2 to 8-12 for about 0.1 to 0.3 extra units per hour. Every higher accelerator provisions a High-RAM host automatically.
48
+
49
+ Two paid options are omitted because newer Colab hardware beats them on price and speed. A G4 (RTX PRO 6000 Blackwell) beats an A100 on every metric: 96 GB VRAM instead of 40 or 80 GB, more RAM, roughly 1.6x higher bfloat16 throughput, and lower hourly cost (~6.7-8.9 vs ~10-13+ units/hr). On paid credits, the Trillium TPU (`v6e-1`, ~4.08 units/hr) delivers roughly 4.5x the throughput of a `v5e-1` (~2.92 units/hr). Use `v5e-1` only on the free tier.
50
+
51
+ | Accelerator | VRAM | RAM | Relative speed | Units/hr | Hours per 1,000 units | Rate vs cloud on-demand |
52
+ |----|----|----|----|----|----|----|
53
+ | CPU (High-RAM) | None | ~51 GB | \- | ~0.4 | ~2,500 | ~\$0.04/hr |
54
+ | T4 (High-RAM) | 16 GB | ~51 GB | ~0.5x L4 (FP16 only) | ~1.8-2.3 | ~450-550 | ~\$0.18-\$0.23/hr |
55
+ | L4 | 24 GB | ~51 GB | 1x (121 TFLOPS, 300 GB/s) | ~3.0 | ~330 | ~\$0.30/hr |
56
+ | G4 (RTX PRO 6000) | 96 GB | ~177 GB | ~4x L4 (500 TFLOPS, 1.6 TB/s) | ~6.7-8.9 | ~110-150 | ~\$0.67-\$0.89/hr vs \$3.03/hr (Modal) |
57
+ | H100 | 80 GB | ~167-200 GB | ~8x L4 (989 TFLOPS, 3.35 TB/s) | ~18.0 | ~55 | ~\$1.80/hr vs \$3.95/hr (Modal) |
58
+ | TPU v6e-1 (Trillium) | 32 GB | ~176+ GB | ~7.5x L4 (918 TFLOPS, 1.64 TB/s) | ~4.08 | ~245 | ~\$0.41/hr vs \$2.70/hr (GCP US) |
59
+
60
+ Pick the G4 as your default GPU. It has the largest VRAM on Colab, supports native FP8 and FP4, and costs roughly half as much per hour as an H100. Move up to the H100 when memory bandwidth or wall-clock speed dominates and the job fits in 80 GB. Pick the Trillium TPU (`v6e-1`) for the highest compute per credit when your code targets JAX, TensorFlow, or PyTorch XLA and fits in 32 GB.
61
+
62
+ Google does not publish fixed burn rates or guaranteed RAM allocations. Hourly rates vary slightly by region and load. Check live RAM inside any session with `free -h`.
63
+
64
+ Colab gives you single-accelerator virtual machines rather than elastic clusters. Each machine attaches one GPU or one TPU chip and caps out at 24 hours even with Ultra or Pro+ background execution. Google can also reclaim an instance when regional capacity tightens. Local disks (~70 to 100 GB) are wiped when a machine stops, so save checkpoints to [Google Cloud Storage](https://cloud.google.com/storage) or [Google Drive](https://drive.google.com) for long runs.
65
+
66
+ ## Getting started
67
+
68
+ `fastcolab` authenticates with standard Google OAuth 2.0 credentials carrying the `https://www.googleapis.com/auth/colaboratory` scope (plus `https://www.googleapis.com/auth/drive` for Drive transfers). [`gclientid`](https://github.com/AnswerDotAI/gclientid) automates Google Cloud setup and token refresh, though it is optional: `Colab.connect(creds=...)` accepts any `google-auth` credentials directly.
69
+
70
+ ### Setup with `gclientid`
71
+
72
+ Give each developer their own External Google Cloud project with [`gclientid`](https://github.com/AnswerDotAI/gclientid). Separate projects isolate API quotas per person and work with both personal `@gmail.com` Ultra accounts and Workspace accounts.
73
+
74
+ 1. Create or update your External project (`gclientid` enables `colaboratory.googleapis.com` and declares the `colaboratory` scope automatically because `COLAB` is in `MAX`):
75
+
76
+ ``` sh
77
+ gclientid
78
+ ```
79
+
80
+ 2. Authorize the Google account that holds your Colab or Google AI Ultra credits:
81
+
82
+ ``` sh
83
+ gclientid-auth you@gmail.com --preset colab
84
+ ```
85
+
86
+ `gclientid` stores one token per email at `~/.config/gclientid/oauth-token-<email>.json`. Authorizing a personal `@gmail.com` account leaves Workspace tokens untouched. Export `FASTCOLAB_ACCOUNT=you@gmail.com` in your shell so the examples below pick it up.
87
+
88
+ ### Setup without `gclientid`
89
+
90
+ You can set up credentials directly through Google Cloud and pass them to [`Colab.connect`](https://AnswerDotAI.github.io/fastcolab/core.html#colab.connect). See the [Colab API documentation](https://developers.google.com/colab/api) and Google’s authentication guides for full details:
91
+
92
+ 1. Create or select a project in [Google Cloud Console](https://console.cloud.google.com/) and [enable](https://cloud.google.com/service-usage/docs/enable-disable) `colaboratory.googleapis.com` (and `drive.googleapis.com` if you plan to use `from_drive` and `to_drive`).
93
+ 2. [Configure the OAuth consent screen](https://developers.google.com/workspace/guides/configure-oauth-consent) as External (published to production so refresh tokens do not expire after seven days) and add `https://www.googleapis.com/auth/colaboratory` (plus `https://www.googleapis.com/auth/drive` if needed).
94
+ 3. [Create an OAuth 2.0 client ID](https://developers.google.com/workspace/guides/create-credentials) and save an authorized-user token JSON, or mint [Application Default Credentials](https://cloud.google.com/docs/authentication/provide-credentials-adc) with your project as the quota project:
95
+
96
+ ``` sh
97
+ gcloud auth application-default login \
98
+ --scopes=openid,https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/userinfo.email,https://www.googleapis.com/auth/colaboratory
99
+ gcloud auth application-default set-quota-project YOUR_PROJECT_ID
100
+ ```
101
+
102
+ 4. Pass those credentials directly into [`Colab.connect`](https://AnswerDotAI.github.io/fastcolab/core.html#colab.connect):
103
+
104
+ ``` python
105
+ import google.auth
106
+ from fastcolab import Colab
107
+
108
+ creds, _ = google.auth.default()
109
+ c = await Colab.connect(creds=creds, drive=False)
110
+ # Or load a saved OAuth authorized-user JSON file directly:
111
+ # c = await Colab.connect(token_path='path/to/token.json')
112
+ ```
113
+
114
+ ### Starting a runtime and running code
115
+
116
+ `fastcolab` wraps both Colab discovery documents, waits on long-running runtime creation, refreshes expired proxy tokens automatically, and transfers files over HTTP or Google Drive.
117
+
118
+ ``` python
119
+ from fastcore.utils import *
120
+ from fastcolab import Colab, outs_text
121
+
122
+ c = await Colab.connect(account=os.environ['FASTCOLAB_ACCOUNT'])
123
+ await c.specs()
124
+
125
+ async with await c.start('g4') as rt:
126
+ outs = await rt.exec("import torch; torch.cuda.get_device_name(0)")
127
+ print(outs_text(outs))
128
+ await rt.upload(Path('train.py'), 'content/train.py')
129
+ await rt.from_drive('my-dataset', 'content/data')
130
+ await rt.to_drive('content/out.json', 'my-results')
131
+ ```
132
+
133
+ `start` accepts short hardware aliases (`'cpu'`, `'t4'`, `'l4'`, `'g4'`, `'h100'`, `'v6e1'`) and enables `SHAPE_HIGHMEM` automatically where available. Entering the runtime with `async with` deletes the machine on exit so idle credits do not burn. `rt.exec` reuses a persistent remote kernel across calls. `rt.upload` creates missing parent directories and chunks files larger than 32 MB automatically. `from_drive` and `to_drive` move files between Google Drive and the runtime using your OAuth credentials, with no interactive browser mount.
134
+
135
+ ### Long-running detached jobs
136
+
137
+ Colab reclaims a runtime after roughly 90 minutes with an idle Jupyter kernel. Spawning a `nohup` background process and letting its cell exit leaves the kernel idle and risks teardown. `rt.launch` runs your script inside a dedicated busy kernel cell, logs output to disk, and closes the local WebSocket once execution begins.
138
+
139
+ ``` python
140
+ rt = await c.start('g4')
141
+ job = await rt.launch(Path('train.py').read_text(), log='content/train.log')
142
+ rc = await job.wait(poll=5.0, on_log=lambda s: print(s, end=''))
143
+ await rt.stop()
144
+ ```
145
+
146
+ [`ColabJob`](https://AnswerDotAI.github.io/fastcolab/core.html#colabjob) polls `/api/kernels/{id}` and tails new log bytes over HTTP `Range` requests, refreshing the roughly 1-hour proxy token automatically. You can also call `await job.status()` and `await job.tail()` directly from another process or after waking a laptop. Save checkpoints periodically to Google Drive or Google Cloud Storage in case the machine hits the 24-hour cap or gets reclaimed.
147
+
148
+ ### Fast repeatable environments
149
+
150
+ Consumer Colab boots Google’s fixed base image (PyTorch, CUDA, JAX, and [`uv`](https://docs.astral.sh/uv/) preinstalled) rather than custom Docker containers. Importing `fastcolab.envs` patches environment helpers onto [`ColabRuntime`](https://AnswerDotAI.github.io/fastcolab/core.html#colabruntime) for lockfile installs, portable virtual environments, and warm runtime reuse.
151
+
152
+ ``` python
153
+ from fastcolab.envs import compile_reqs
154
+
155
+ lock = compile_reqs(['timm', 'datasets'])
156
+ await rt.install(reqs=lock, no_deps=True)
157
+
158
+ await rt.create_venv('/content/env', ['einops'])
159
+ await rt.save_venv('colab-envs', '/content/env', 'env.tar.gz')
160
+ await rt.load_venv('colab-envs', 'env.tar.gz', '/content/env')
161
+ await rt.restart()
162
+ ```
163
+
164
+ [`compile_reqs`](https://AnswerDotAI.github.io/fastcolab/envs.html#compile_reqs) resolves versions locally with `uv pip compile` so `rt.install` skips remote resolution and installs through `uv pip install --system`. For stacks that clash with Colab’s system packages, `create_venv` and `save_venv` build and archive an isolated virtual environment once on Colab. `load_venv` restores that archive from Google Drive on later runs. Run inside the restored environment with `rt.venv_exec` or add it to the live kernel with `rt.activate_venv`. During rapid iteration, `rt.restart()` or `rt.fresh_kernel()` resets memory while keeping `/content` and installed packages intact.
165
+
166
+ ### SSH, `scp`, and `rsync`
167
+
168
+ Colab runtimes expose native SSH through the runtime proxy (`wss://{host}/colab/ssh`) with no ngrok or external tunnel. The proxy accepts an `ed25519` or `ecdsa` public key (Colab rejects RSA keys) and opens a `root` shell over binary WebSocket frames.
169
+
170
+ `rt.ssh()` (or [`colab_ssh`](https://AnswerDotAI.github.io/fastcolab/extras.html#colab_ssh), from `fastcolab.extras`) bridges that endpoint through [`google-colab-cli`](https://github.com/googlecolab/google-colab-cli)’s `colab ssh --proxy-mode`. Calling `rt.ssh()` saves the runtime’s credentials in `colab-cli`’s local session store and appends a `Host colab` block to `~/.ssh/config` when missing. It uses `~/.ssh/id_ed25519` or `~/.ssh/id_ecdsa` by default, or you can pass `identity=`.
171
+
172
+ ``` python
173
+ import fastcolab.extras
174
+
175
+ rt.ssh()
176
+ ```
177
+
178
+ ``` sh
179
+ ssh colab
180
+ rsync -av ./data/ colab:/content/data/
181
+ ssh -L 8888:localhost:8888 colab
182
+ ```
183
+
184
+ Plain `ssh`, `scp`, `rsync`, port forwarding, and Remote-SSH editors then connect straight to the running machine. No separate `colab-cli` login is needed while the runtime token stays valid (roughly one hour). Running `colab --auth=oauth2 whoami` once lets `colab-cli` refresh tokens automatically past the first hour.
185
+
186
+ ### Usage, shell commands, directory sync, and one-shot scripts
187
+
188
+ `fastcolab.extras` also patches operational helpers onto [`Colab`](https://AnswerDotAI.github.io/fastcolab/core.html#colab) and [`ColabRuntime`](https://AnswerDotAI.github.io/fastcolab/core.html#colabruntime) for live credit balance, browser links, shell commands, directory sync, remote script or notebook runners, and bulk cleanup.
189
+
190
+ ``` python
191
+ import fastcolab.extras
192
+
193
+ await c.usage()
194
+ rt.browser_url(open_browser=True)
195
+ await rt.sh('nvidia-smi')
196
+ await rt.sys_info()
197
+ await rt.upload_dir('src', '/content/src')
198
+
199
+ res = await c.run_script('train.py', hw='g4', download={'content/out.pt': 'out.pt'})
200
+ await c.stop_all()
201
+ ```
202
+
203
+ `c.usage()` reads your live balance and hourly burn rate from `/tun/m/ccu-info` using your existing OAuth credentials. `rt.browser_url()` opens a live runtime in your browser without allocating a second machine. `rt.upload_dir` and `rt.download_dir` sync folders as a single tarball (skipping `.git`, `__pycache__`, `.venv`, and `node_modules`). `c.run_script` provisions a machine, runs a local Python file with optional uploads and downloads, and deletes the runtime in a `finally` block. `rt.run_nb` executes a local `.ipynb` remotely and writes outputs back.
204
+
205
+ ## The REST API is all we need
206
+
207
+ Google exposes two official interfaces under `colaboratory.googleapis.com`. The [REST API](https://developers.google.com/colab/api/reference/rest) handles `runtimes`, `runtimespecs`, and `getSubscription` in `v1beta`, plus long-running `operations` in `v1`. The hosted [Model Context Protocol (MCP) server](https://developers.google.com/colab/api/reference/mcp) runs at `https://colaboratory.googleapis.com/mcp`.
208
+
209
+ `runtimes.create`, `runtimes.get`, and `runtimes.list` all return a `connectionInfo` object containing `url`, `token`, and `expireTime`. Sending `X-Colab-Runtime-Proxy-Token: {token}` to `connectionInfo.url` connects directly to the runtime’s Jupyter server. Pairing REST with a Jupyter client such as `jupyasyncclient` gives you live streaming output, rich display objects such as plots, and plain HTTP file transfers.
210
+
211
+ The hosted MCP server adds four kernel tools (`create_session`, `list_sessions`, `delete_session`, `execute_code`) with stateless `executionId` reattachment across 600-second HTTP cutoffs. In exchange, MCP buffers output as text only and truncates large logs. It omits images and requires repeated 600-second requests for multi-hour runs. Driving REST plus the Jupyter proxy avoids those constraints.
212
+
213
+ Neither REST nor MCP exposes your live credit balance (`get_subscription` returns only the tier, such as `SUBSCRIPTION_TIER_PRO_PLUS`). `fastcolab.extras` adds [`Colab.usage()`](https://AnswerDotAI.github.io/fastcolab/extras.html#colab.usage) against Colab’s `/tun/m/ccu-info` endpoint to read live balance and hourly burn rate directly from Python.
214
+
215
+ ## Technical notes
216
+
217
+ Some other notes:
218
+
219
+ - `v1beta` and `v1` also accept the read-only scope `https://www.googleapis.com/auth/colaboratory.readonly` when a caller only needs `get_subscription`, `runtimespecs.list`, or `runtimes.list`.
220
+ - Passing `X-Colab-Runtime-Proxy-Token` alone authenticates both HTTP and verified `wss://` WebSocket calls to `connectionInfo.url` (no `colab-runtime-proxy-token` query parameter or `X-Colab-Client-Agent` header is needed on the proxy). Colab exposes kernelspecs `['julia', 'python3', 'ir']` (`name="py"` returns HTTP 500, while omitting `name` selects Python 3), speaks legacy JSON WebSocket frames rather than `v1.kernel.websocket.jupyter.org`, and emits custom `colab_request` frames that clients can ignore.
221
+ - `JupyAsyncTerminalClient` is incompatible with Colab because it uses jupygate’s `/api/terminals/{name}/channel` binary protocol instead of Jupyter’s `/terminals/websocket/{name}`.
222
+ - For quick terminal checks without a Google Cloud project, `google-colab-cli` (`uv tool install google-colab-cli`) provides `colab --auth=oauth2 whoami` and `colab --auth=oauth2 usage`. Its bundled OAuth client (`projects/764086051850`) cannot call `colaboratory.googleapis.com` without a separate quota project.
@@ -0,0 +1,202 @@
1
+ # fastcolab
2
+
3
+
4
+ <!-- WARNING: THIS FILE WAS AUTOGENERATED! DO NOT EDIT! -->
5
+
6
+ Most developers know [Google Colab](https://colab.research.google.com) as a hosted browser notebook for quick experiments. Underneath that browser UI, Google runs an on-demand CPU, GPU, and TPU compute platform with an official [REST API](https://developers.google.com/colab/api/reference/rest) at `colaboratory.googleapis.com`. You can provision machines, run Python scripts or multi-hour training jobs, transfer files, SSH directly into running virtual machines, and tear down runtimes from code without opening a browser or writing a notebook.
7
+
8
+ The cost is hard to beat. Google bundles 1,000 monthly Colab compute units into [Google AI Ultra](https://one.google.com/) 5x (\$99.99/month) and 2,000 into Ultra 20x (\$199.99/month) alongside Gemini Ultra and cloud storage. Even at standalone Pay-As-You-Go prices (\$0.10 per unit), Colab’s accelerators cost a fraction of standard cloud GPU rates. A 96 GB RTX PRO 6000 runs around \$0.67 to \$0.89 an hour compared to \$3.03 on [Modal](https://modal.com/pricing), and a single-chip Trillium TPU runs around \$0.41 an hour compared to \$2.70 on [Google Cloud](https://cloud.google.com/tpu/pricing). If you already pay for a Google AI Ultra subscription, hundreds of GPU or TPU hours sit in your account every month.
9
+
10
+ `fastcolab` wraps Colab’s REST API (through [`fastgws`](https://github.com/answerdotai/fastgws)) and runtime Jupyter proxy (through [`jupyasyncclient`](https://github.com/AnswerDotAI/jupyasyncclient)) to make that compute practical from Python.
11
+
12
+ ## Plans and compute units
13
+
14
+ All [Colab plans](https://colab.research.google.com/signup) and [Google AI subscriptions](https://one.google.com/) credit the same account balance.
15
+
16
+ | Plan | Price | Monthly units | Included extras |
17
+ |----|----|----|----|
18
+ | Google AI Ultra 5x | \$99.99/month | 1,000 | Gemini Ultra (5x), 20 TB storage, background execution |
19
+ | Google AI Ultra 20x | \$199.99/month | 2,000 | Gemini Ultra (20x), 30 TB storage, background execution |
20
+ | Colab Pro+ | \$49.99/month | 500 to 600 | Standalone subscription, background execution |
21
+ | Colab Pro / Pay-As-You-Go | \$9.99 | 100 | Monthly subscription or one-time top-up |
22
+
23
+ Unused units roll over from month to month and expire 90 days after issue. Colab bills units for every minute a machine stays allocated, including idle periods. Delete each runtime as soon as work finishes.
24
+
25
+ ## Choosing a runtime
26
+
27
+ Turn on High-RAM (`HIGHMEM`) on CPU and T4 runtimes. It quadruples RAM from roughly 13 GB to 51 GB and raises CPU cores from 2 to 8-12 for about 0.1 to 0.3 extra units per hour. Every higher accelerator provisions a High-RAM host automatically.
28
+
29
+ Two paid options are omitted because newer Colab hardware beats them on price and speed. A G4 (RTX PRO 6000 Blackwell) beats an A100 on every metric: 96 GB VRAM instead of 40 or 80 GB, more RAM, roughly 1.6x higher bfloat16 throughput, and lower hourly cost (~6.7-8.9 vs ~10-13+ units/hr). On paid credits, the Trillium TPU (`v6e-1`, ~4.08 units/hr) delivers roughly 4.5x the throughput of a `v5e-1` (~2.92 units/hr). Use `v5e-1` only on the free tier.
30
+
31
+ | Accelerator | VRAM | RAM | Relative speed | Units/hr | Hours per 1,000 units | Rate vs cloud on-demand |
32
+ |----|----|----|----|----|----|----|
33
+ | CPU (High-RAM) | None | ~51 GB | \- | ~0.4 | ~2,500 | ~\$0.04/hr |
34
+ | T4 (High-RAM) | 16 GB | ~51 GB | ~0.5x L4 (FP16 only) | ~1.8-2.3 | ~450-550 | ~\$0.18-\$0.23/hr |
35
+ | L4 | 24 GB | ~51 GB | 1x (121 TFLOPS, 300 GB/s) | ~3.0 | ~330 | ~\$0.30/hr |
36
+ | G4 (RTX PRO 6000) | 96 GB | ~177 GB | ~4x L4 (500 TFLOPS, 1.6 TB/s) | ~6.7-8.9 | ~110-150 | ~\$0.67-\$0.89/hr vs \$3.03/hr (Modal) |
37
+ | H100 | 80 GB | ~167-200 GB | ~8x L4 (989 TFLOPS, 3.35 TB/s) | ~18.0 | ~55 | ~\$1.80/hr vs \$3.95/hr (Modal) |
38
+ | TPU v6e-1 (Trillium) | 32 GB | ~176+ GB | ~7.5x L4 (918 TFLOPS, 1.64 TB/s) | ~4.08 | ~245 | ~\$0.41/hr vs \$2.70/hr (GCP US) |
39
+
40
+ Pick the G4 as your default GPU. It has the largest VRAM on Colab, supports native FP8 and FP4, and costs roughly half as much per hour as an H100. Move up to the H100 when memory bandwidth or wall-clock speed dominates and the job fits in 80 GB. Pick the Trillium TPU (`v6e-1`) for the highest compute per credit when your code targets JAX, TensorFlow, or PyTorch XLA and fits in 32 GB.
41
+
42
+ Google does not publish fixed burn rates or guaranteed RAM allocations. Hourly rates vary slightly by region and load. Check live RAM inside any session with `free -h`.
43
+
44
+ Colab gives you single-accelerator virtual machines rather than elastic clusters. Each machine attaches one GPU or one TPU chip and caps out at 24 hours even with Ultra or Pro+ background execution. Google can also reclaim an instance when regional capacity tightens. Local disks (~70 to 100 GB) are wiped when a machine stops, so save checkpoints to [Google Cloud Storage](https://cloud.google.com/storage) or [Google Drive](https://drive.google.com) for long runs.
45
+
46
+ ## Getting started
47
+
48
+ `fastcolab` authenticates with standard Google OAuth 2.0 credentials carrying the `https://www.googleapis.com/auth/colaboratory` scope (plus `https://www.googleapis.com/auth/drive` for Drive transfers). [`gclientid`](https://github.com/AnswerDotAI/gclientid) automates Google Cloud setup and token refresh, though it is optional: `Colab.connect(creds=...)` accepts any `google-auth` credentials directly.
49
+
50
+ ### Setup with `gclientid`
51
+
52
+ Give each developer their own External Google Cloud project with [`gclientid`](https://github.com/AnswerDotAI/gclientid). Separate projects isolate API quotas per person and work with both personal `@gmail.com` Ultra accounts and Workspace accounts.
53
+
54
+ 1. Create or update your External project (`gclientid` enables `colaboratory.googleapis.com` and declares the `colaboratory` scope automatically because `COLAB` is in `MAX`):
55
+
56
+ ``` sh
57
+ gclientid
58
+ ```
59
+
60
+ 2. Authorize the Google account that holds your Colab or Google AI Ultra credits:
61
+
62
+ ``` sh
63
+ gclientid-auth you@gmail.com --preset colab
64
+ ```
65
+
66
+ `gclientid` stores one token per email at `~/.config/gclientid/oauth-token-<email>.json`. Authorizing a personal `@gmail.com` account leaves Workspace tokens untouched. Export `FASTCOLAB_ACCOUNT=you@gmail.com` in your shell so the examples below pick it up.
67
+
68
+ ### Setup without `gclientid`
69
+
70
+ You can set up credentials directly through Google Cloud and pass them to [`Colab.connect`](https://AnswerDotAI.github.io/fastcolab/core.html#colab.connect). See the [Colab API documentation](https://developers.google.com/colab/api) and Google’s authentication guides for full details:
71
+
72
+ 1. Create or select a project in [Google Cloud Console](https://console.cloud.google.com/) and [enable](https://cloud.google.com/service-usage/docs/enable-disable) `colaboratory.googleapis.com` (and `drive.googleapis.com` if you plan to use `from_drive` and `to_drive`).
73
+ 2. [Configure the OAuth consent screen](https://developers.google.com/workspace/guides/configure-oauth-consent) as External (published to production so refresh tokens do not expire after seven days) and add `https://www.googleapis.com/auth/colaboratory` (plus `https://www.googleapis.com/auth/drive` if needed).
74
+ 3. [Create an OAuth 2.0 client ID](https://developers.google.com/workspace/guides/create-credentials) and save an authorized-user token JSON, or mint [Application Default Credentials](https://cloud.google.com/docs/authentication/provide-credentials-adc) with your project as the quota project:
75
+
76
+ ``` sh
77
+ gcloud auth application-default login \
78
+ --scopes=openid,https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/userinfo.email,https://www.googleapis.com/auth/colaboratory
79
+ gcloud auth application-default set-quota-project YOUR_PROJECT_ID
80
+ ```
81
+
82
+ 4. Pass those credentials directly into [`Colab.connect`](https://AnswerDotAI.github.io/fastcolab/core.html#colab.connect):
83
+
84
+ ``` python
85
+ import google.auth
86
+ from fastcolab import Colab
87
+
88
+ creds, _ = google.auth.default()
89
+ c = await Colab.connect(creds=creds, drive=False)
90
+ # Or load a saved OAuth authorized-user JSON file directly:
91
+ # c = await Colab.connect(token_path='path/to/token.json')
92
+ ```
93
+
94
+ ### Starting a runtime and running code
95
+
96
+ `fastcolab` wraps both Colab discovery documents, waits on long-running runtime creation, refreshes expired proxy tokens automatically, and transfers files over HTTP or Google Drive.
97
+
98
+ ``` python
99
+ from fastcore.utils import *
100
+ from fastcolab import Colab, outs_text
101
+
102
+ c = await Colab.connect(account=os.environ['FASTCOLAB_ACCOUNT'])
103
+ await c.specs()
104
+
105
+ async with await c.start('g4') as rt:
106
+ outs = await rt.exec("import torch; torch.cuda.get_device_name(0)")
107
+ print(outs_text(outs))
108
+ await rt.upload(Path('train.py'), 'content/train.py')
109
+ await rt.from_drive('my-dataset', 'content/data')
110
+ await rt.to_drive('content/out.json', 'my-results')
111
+ ```
112
+
113
+ `start` accepts short hardware aliases (`'cpu'`, `'t4'`, `'l4'`, `'g4'`, `'h100'`, `'v6e1'`) and enables `SHAPE_HIGHMEM` automatically where available. Entering the runtime with `async with` deletes the machine on exit so idle credits do not burn. `rt.exec` reuses a persistent remote kernel across calls. `rt.upload` creates missing parent directories and chunks files larger than 32 MB automatically. `from_drive` and `to_drive` move files between Google Drive and the runtime using your OAuth credentials, with no interactive browser mount.
114
+
115
+ ### Long-running detached jobs
116
+
117
+ Colab reclaims a runtime after roughly 90 minutes with an idle Jupyter kernel. Spawning a `nohup` background process and letting its cell exit leaves the kernel idle and risks teardown. `rt.launch` runs your script inside a dedicated busy kernel cell, logs output to disk, and closes the local WebSocket once execution begins.
118
+
119
+ ``` python
120
+ rt = await c.start('g4')
121
+ job = await rt.launch(Path('train.py').read_text(), log='content/train.log')
122
+ rc = await job.wait(poll=5.0, on_log=lambda s: print(s, end=''))
123
+ await rt.stop()
124
+ ```
125
+
126
+ [`ColabJob`](https://AnswerDotAI.github.io/fastcolab/core.html#colabjob) polls `/api/kernels/{id}` and tails new log bytes over HTTP `Range` requests, refreshing the roughly 1-hour proxy token automatically. You can also call `await job.status()` and `await job.tail()` directly from another process or after waking a laptop. Save checkpoints periodically to Google Drive or Google Cloud Storage in case the machine hits the 24-hour cap or gets reclaimed.
127
+
128
+ ### Fast repeatable environments
129
+
130
+ Consumer Colab boots Google’s fixed base image (PyTorch, CUDA, JAX, and [`uv`](https://docs.astral.sh/uv/) preinstalled) rather than custom Docker containers. Importing `fastcolab.envs` patches environment helpers onto [`ColabRuntime`](https://AnswerDotAI.github.io/fastcolab/core.html#colabruntime) for lockfile installs, portable virtual environments, and warm runtime reuse.
131
+
132
+ ``` python
133
+ from fastcolab.envs import compile_reqs
134
+
135
+ lock = compile_reqs(['timm', 'datasets'])
136
+ await rt.install(reqs=lock, no_deps=True)
137
+
138
+ await rt.create_venv('/content/env', ['einops'])
139
+ await rt.save_venv('colab-envs', '/content/env', 'env.tar.gz')
140
+ await rt.load_venv('colab-envs', 'env.tar.gz', '/content/env')
141
+ await rt.restart()
142
+ ```
143
+
144
+ [`compile_reqs`](https://AnswerDotAI.github.io/fastcolab/envs.html#compile_reqs) resolves versions locally with `uv pip compile` so `rt.install` skips remote resolution and installs through `uv pip install --system`. For stacks that clash with Colab’s system packages, `create_venv` and `save_venv` build and archive an isolated virtual environment once on Colab. `load_venv` restores that archive from Google Drive on later runs. Run inside the restored environment with `rt.venv_exec` or add it to the live kernel with `rt.activate_venv`. During rapid iteration, `rt.restart()` or `rt.fresh_kernel()` resets memory while keeping `/content` and installed packages intact.
145
+
146
+ ### SSH, `scp`, and `rsync`
147
+
148
+ Colab runtimes expose native SSH through the runtime proxy (`wss://{host}/colab/ssh`) with no ngrok or external tunnel. The proxy accepts an `ed25519` or `ecdsa` public key (Colab rejects RSA keys) and opens a `root` shell over binary WebSocket frames.
149
+
150
+ `rt.ssh()` (or [`colab_ssh`](https://AnswerDotAI.github.io/fastcolab/extras.html#colab_ssh), from `fastcolab.extras`) bridges that endpoint through [`google-colab-cli`](https://github.com/googlecolab/google-colab-cli)’s `colab ssh --proxy-mode`. Calling `rt.ssh()` saves the runtime’s credentials in `colab-cli`’s local session store and appends a `Host colab` block to `~/.ssh/config` when missing. It uses `~/.ssh/id_ed25519` or `~/.ssh/id_ecdsa` by default, or you can pass `identity=`.
151
+
152
+ ``` python
153
+ import fastcolab.extras
154
+
155
+ rt.ssh()
156
+ ```
157
+
158
+ ``` sh
159
+ ssh colab
160
+ rsync -av ./data/ colab:/content/data/
161
+ ssh -L 8888:localhost:8888 colab
162
+ ```
163
+
164
+ Plain `ssh`, `scp`, `rsync`, port forwarding, and Remote-SSH editors then connect straight to the running machine. No separate `colab-cli` login is needed while the runtime token stays valid (roughly one hour). Running `colab --auth=oauth2 whoami` once lets `colab-cli` refresh tokens automatically past the first hour.
165
+
166
+ ### Usage, shell commands, directory sync, and one-shot scripts
167
+
168
+ `fastcolab.extras` also patches operational helpers onto [`Colab`](https://AnswerDotAI.github.io/fastcolab/core.html#colab) and [`ColabRuntime`](https://AnswerDotAI.github.io/fastcolab/core.html#colabruntime) for live credit balance, browser links, shell commands, directory sync, remote script or notebook runners, and bulk cleanup.
169
+
170
+ ``` python
171
+ import fastcolab.extras
172
+
173
+ await c.usage()
174
+ rt.browser_url(open_browser=True)
175
+ await rt.sh('nvidia-smi')
176
+ await rt.sys_info()
177
+ await rt.upload_dir('src', '/content/src')
178
+
179
+ res = await c.run_script('train.py', hw='g4', download={'content/out.pt': 'out.pt'})
180
+ await c.stop_all()
181
+ ```
182
+
183
+ `c.usage()` reads your live balance and hourly burn rate from `/tun/m/ccu-info` using your existing OAuth credentials. `rt.browser_url()` opens a live runtime in your browser without allocating a second machine. `rt.upload_dir` and `rt.download_dir` sync folders as a single tarball (skipping `.git`, `__pycache__`, `.venv`, and `node_modules`). `c.run_script` provisions a machine, runs a local Python file with optional uploads and downloads, and deletes the runtime in a `finally` block. `rt.run_nb` executes a local `.ipynb` remotely and writes outputs back.
184
+
185
+ ## The REST API is all we need
186
+
187
+ Google exposes two official interfaces under `colaboratory.googleapis.com`. The [REST API](https://developers.google.com/colab/api/reference/rest) handles `runtimes`, `runtimespecs`, and `getSubscription` in `v1beta`, plus long-running `operations` in `v1`. The hosted [Model Context Protocol (MCP) server](https://developers.google.com/colab/api/reference/mcp) runs at `https://colaboratory.googleapis.com/mcp`.
188
+
189
+ `runtimes.create`, `runtimes.get`, and `runtimes.list` all return a `connectionInfo` object containing `url`, `token`, and `expireTime`. Sending `X-Colab-Runtime-Proxy-Token: {token}` to `connectionInfo.url` connects directly to the runtime’s Jupyter server. Pairing REST with a Jupyter client such as `jupyasyncclient` gives you live streaming output, rich display objects such as plots, and plain HTTP file transfers.
190
+
191
+ The hosted MCP server adds four kernel tools (`create_session`, `list_sessions`, `delete_session`, `execute_code`) with stateless `executionId` reattachment across 600-second HTTP cutoffs. In exchange, MCP buffers output as text only and truncates large logs. It omits images and requires repeated 600-second requests for multi-hour runs. Driving REST plus the Jupyter proxy avoids those constraints.
192
+
193
+ Neither REST nor MCP exposes your live credit balance (`get_subscription` returns only the tier, such as `SUBSCRIPTION_TIER_PRO_PLUS`). `fastcolab.extras` adds [`Colab.usage()`](https://AnswerDotAI.github.io/fastcolab/extras.html#colab.usage) against Colab’s `/tun/m/ccu-info` endpoint to read live balance and hourly burn rate directly from Python.
194
+
195
+ ## Technical notes
196
+
197
+ Some other notes:
198
+
199
+ - `v1beta` and `v1` also accept the read-only scope `https://www.googleapis.com/auth/colaboratory.readonly` when a caller only needs `get_subscription`, `runtimespecs.list`, or `runtimes.list`.
200
+ - Passing `X-Colab-Runtime-Proxy-Token` alone authenticates both HTTP and verified `wss://` WebSocket calls to `connectionInfo.url` (no `colab-runtime-proxy-token` query parameter or `X-Colab-Client-Agent` header is needed on the proxy). Colab exposes kernelspecs `['julia', 'python3', 'ir']` (`name="py"` returns HTTP 500, while omitting `name` selects Python 3), speaks legacy JSON WebSocket frames rather than `v1.kernel.websocket.jupyter.org`, and emits custom `colab_request` frames that clients can ignore.
201
+ - `JupyAsyncTerminalClient` is incompatible with Colab because it uses jupygate’s `/api/terminals/{name}/channel` binary protocol instead of Jupyter’s `/terminals/websocket/{name}`.
202
+ - For quick terminal checks without a Google Cloud project, `google-colab-cli` (`uv tool install google-colab-cli`) provides `colab --auth=oauth2 whoami` and `colab --auth=oauth2 usage`. Its bundled OAuth client (`projects/764086051850`) cannot call `colaboratory.googleapis.com` without a separate quota project.
@@ -0,0 +1,3 @@
1
+ __version__ = "0.0.1"
2
+
3
+ from .core import *