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.5.tar.gz (192.8 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.5-py3-none-any.whl (61.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: google_colab_cli-0.5.5.tar.gz
  • Upload date:
  • Size: 192.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for google_colab_cli-0.5.5.tar.gz
Algorithm Hash digest
SHA256 dc571a855f0b3af1b24e8caf6ae9d68bead3198277d15646014bad4cbb14533f
MD5 7793c85fc926b28c2ded60d95a7e14c6
BLAKE2b-256 8db3938ae9d4246fade7d6aecec3f1863ee464f6c99ef680cf0f9ff3ce6dfafa

See more details on using hashes here.

Provenance

The following attestation bundles were made for google_colab_cli-0.5.5.tar.gz:

Publisher: google-colab-cli-py@oss-exit-gate-prod.iam.gserviceaccount.com

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.
  • Statement: Publication detail:
    • Token Issuer: https://accounts.google.com
    • Service Account: google-colab-cli-py@oss-exit-gate-prod.iam.gserviceaccount.com

File details

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

File metadata

File hashes

Hashes for google_colab_cli-0.5.5-py3-none-any.whl
Algorithm Hash digest
SHA256 234e278f016c53cb15c1748d7c76c9408555b2225039a9c6bfdcb203f2382c44
MD5 5505a5d8de03c6fdef41c902a4aa3d76
BLAKE2b-256 28acbc2a0460d0441b6f0dcab5942b3b74c9e864fb901a2e53c6f0ffc2fe9374

See more details on using hashes here.

Provenance

The following attestation bundles were made for google_colab_cli-0.5.5-py3-none-any.whl:

Publisher: google-colab-cli-py@oss-exit-gate-prod.iam.gserviceaccount.com

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.
  • Statement: Publication detail:
    • Token Issuer: https://accounts.google.com
    • Service Account: google-colab-cli-py@oss-exit-gate-prod.iam.gserviceaccount.com

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