Python client for programmatically interacting with Google Colab
Project description
Colab Client
Note: This is an unofficial client and is not affiliated with Google. Use at your own risk.
Python client for Google Colab. Execute code on Colab runtimes from your terminal or Python scripts.
Installation
Install uv:
curl -LsSf https://astral.sh/uv/install.sh | sh
Clone and run:
git clone https://github.com/sachnun/colab-client.git
cd colab-client
uv sync
uv run colab-client
Usage
Command Line
$ uv run colab-client --help
usage: colab-client [-h] [-v] [-c CODE]
[--variant {DEFAULT,STANDARD_GPU,PREMIUM_GPU,TPU,CASCADE_LAKE,SKYLAKE}]
[--unassign] [--list]
options:
-h, --help show this help message and exit
-v, --verbose Enable verbose logging
-c CODE, --code CODE Execute code and exit
--variant Runtime variant (default: DEFAULT)
--unassign Unassign current server and exit
--list List current assignments and exit
As a Library
uv add colab-client
from colab_client import ColabClient
client = ColabClient()
client.login()
client.get_or_create_server()
client.get_or_create_session()
result = client.execute("print('Hello from Colab!')")
print(result.stdout)
client.close()
Configuration
Environment variables:
| Variable | Description | Default |
|---|---|---|
COLAB_TOKEN_PATH |
Path to token cache | ~/.colab_token.json |
License
MIT License - see LICENSE for details.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file colab_client-0.1.1.tar.gz.
File metadata
- Download URL: colab_client-0.1.1.tar.gz
- Upload date:
- Size: 58.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e7b5ff7860d0ae02c64c97d07ea505059ce9eec230f4443b79f1eeb601c0c1cf
|
|
| MD5 |
f760a9444b0567bef598dd881d62fb91
|
|
| BLAKE2b-256 |
0239127b9fda8b20b0a25641d514569b512294930b4b0a777d174a7d501d698c
|
File details
Details for the file colab_client-0.1.1-py3-none-any.whl.
File metadata
- Download URL: colab_client-0.1.1-py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b7c4558ffaf6ed89a00a76eb73d1ab2f0ff3c21a21c9a565297ac314d543ab7
|
|
| MD5 |
e5a5fcd9970c3aeb002dcad80bb0fa10
|
|
| BLAKE2b-256 |
9e1c0e2a68703b8a2d59b2acee6edc8e68762d49c1350411f080826e88706e88
|