Skip to main content

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

colab_client-0.1.2.tar.gz (58.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

colab_client-0.1.2-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file colab_client-0.1.2.tar.gz.

File metadata

  • Download URL: colab_client-0.1.2.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

Hashes for colab_client-0.1.2.tar.gz
Algorithm Hash digest
SHA256 16460271903018446d3df3b7f2b53c4e591919a5d87536d666b4ff1da9b1d233
MD5 b2990006e83431a2819e796f878f48a7
BLAKE2b-256 5bbb36e0c8d4dcb61a8e6b8aad8ba6932a0165262c248e55cf635181b8a8b757

See more details on using hashes here.

File details

Details for the file colab_client-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: colab_client-0.1.2-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

Hashes for colab_client-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 60808afd1e18ca8e9265dc97a45a9efa7e65f0e77edaf278fff4ef53bd4a102a
MD5 26855b0f522575ef7933909d6843374c
BLAKE2b-256 496b071725a82dc1b1e4608503e52a07ce1775d139274927b6a9ddfb1129d2bb

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page