Skip to main content

CLI for interacting with Colab.

Reason this release was yanked:

broken deps

Project description

Colab CLI

A command-line interface for Google Colab. Create sessions, run code, manage files, and capture work — all without leaving your terminal.

Why? The agents are coming.

Install

uv tool install git+https://github.com/googlecolab/google-colab-cli

Note: If you have a non-standard default package index (Googlers), you may also need to add --index https://pypi.org/simple.

Quick start

colab new                              # provision a CPU session
echo "print('hello')" | colab exec     # run code
colab stop                             # release the VM

When only one session is active you can omit -s <session>; the CLI selects it automatically.

Commands

Sessions

Command Description
colab new [-s NAME] [--gpu T4|L4|A100|H100] [--tpu v5e1|v6e1] Provision a new session (CPU by default)
colab sessions List all active sessions on the backend
colab status [-s NAME] Show one session, or all locally-known sessions
colab stop -s NAME Terminate a session
colab url [-s NAME] [--open] Print a browser URL that opens the session in Colab

Execution

Command Description
colab exec [-s NAME] [-f FILE] [--output-image PATH] Run Python from stdin, a .py file, or a .ipynb notebook
colab repl [-s NAME] [--output-image PATH] Interactive Python REPL (or one-shot if stdin is piped)
colab console [-s NAME] Raw TTY shell on the VM (or one-shot if stdin is piped)

Files

Command Description
colab ls [-s NAME] [PATH] List remote files
colab upload -s NAME LOCAL REMOTE Upload a file
colab download -s NAME REMOTE LOCAL Download a file
colab rm -s NAME PATH Delete a remote file
colab edit -s NAME PATH Edit a remote file in $EDITOR

Automation & utility

Command Description
colab auth -s NAME Authenticate the VM for GCP services
colab drivemount -s NAME [PATH] Mount Google Drive (default /content/drive)
colab install -s NAME [-r requirements.txt | pkg ...] Install packages with uv (falls back to pip)
colab log [-s NAME] [-n N] [-o FILE] View or export session history (.ipynb/.md/.txt/.jsonl)
colab pay Open the Colab signup page
colab version Print the installed version
colab update [--install] Check for a newer release (and optionally install it)
colab help Show usage

Global options

  • --auth {oauth2,adc} — authentication strategy (default oauth2)
  • -c, --client-oauth-config PATH — OAuth client config (default ~/.colab-cli-oauth-config.json)
  • --config PATH — session state file (default ~/.config/colab-cli/sessions.json)
  • --logtostderr — send all output to stderr

Examples

# Train a model on an A100, save the checkpoint locally
colab new -s trainer --gpu A100
colab install -s trainer torch transformers
colab exec -s trainer -f train.py
colab download -s trainer checkpoints/model.bin ./model.bin
colab stop -s trainer

# Mount Drive and analyze a notebook
colab new -s analysis
colab drivemount -s analysis
colab exec -s analysis -f analysis.ipynb       # writes analysis_output.ipynb
colab log -s analysis -o report.ipynb
colab stop -s analysis

Notes

  • repl and console require a TTY when run interactively. Pipe stdin to use them in scripts.
  • exec reads files locally and ships their contents to the VM — local edits don't require uploading.
  • Session metadata is stored at ~/.config/colab-cli/sessions.json. Settings (auto-update etc.) live at ~/.config/colab-cli/settings.json.

See CONTRIBUTING.md for how to file feedback.

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

google_colab_cli-0.5.4.tar.gz (192.2 kB view details)

Uploaded Source

Built Distribution

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

google_colab_cli-0.5.4-py3-none-any.whl (61.4 kB view details)

Uploaded Python 3

File details

Details for the file google_colab_cli-0.5.4.tar.gz.

File metadata

  • Download URL: google_colab_cli-0.5.4.tar.gz
  • Upload date:
  • Size: 192.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux rodete","version":null,"id":"rodete","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for google_colab_cli-0.5.4.tar.gz
Algorithm Hash digest
SHA256 8f0a78217d9f8317dd92380b8d2285be1ce3823b0ed23ebe76a11fe59d4fd049
MD5 f481edc00fcd62ed2acd7023b30cb448
BLAKE2b-256 30a716f0447a946175f4557bbc24c96c78d429c5b11e0293a27706bd727e8d7e

See more details on using hashes here.

File details

Details for the file google_colab_cli-0.5.4-py3-none-any.whl.

File metadata

  • Download URL: google_colab_cli-0.5.4-py3-none-any.whl
  • Upload date:
  • Size: 61.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Debian GNU/Linux rodete","version":null,"id":"rodete","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for google_colab_cli-0.5.4-py3-none-any.whl
Algorithm Hash digest
SHA256 2d083c007bab9c7ee6a1c5abe77607ad11819f5e20865ed9c0b44ac75dc192b5
MD5 320c2e3dfefb35b7e89707c0e4d2ee85
BLAKE2b-256 14c2bf18b1946866e0abb6252653d33cd73e121cb7f04c3e255cb37a84eecbe8

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