Metadata-Version: 2.4
Name: colab-client
Version: 0.1.4
Summary: Python client for programmatically interacting with Google Colab
Project-URL: Homepage, https://github.com/sachnun/colab-client
Project-URL: Documentation, https://github.com/sachnun/colab-client#readme
Project-URL: Repository, https://github.com/sachnun/colab-client.git
Project-URL: Issues, https://github.com/sachnun/colab-client/issues
Author: sachnun
License: MIT
License-File: LICENSE
Keywords: google-colab,jupyter,notebook,python-client,remote-execution
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.10
Requires-Dist: google-auth-oauthlib>=1.0.0
Requires-Dist: google-auth>=2.20.0
Requires-Dist: httpx>=0.24.0
Requires-Dist: websockets>=11.0
Provides-Extra: dev
Requires-Dist: mypy>=1.0.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Description-Content-Type: text/markdown

# 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](https://docs.astral.sh/uv/getting-started/installation/):

```bash
curl -LsSf https://astral.sh/uv/install.sh | sh
```

Clone and run:

```bash
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]
                    {auth} ...

positional arguments:
  {auth}
    auth                Authentication commands

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

```bash
uv add colab-client
```

```python
from colab_client import ColabClient

client = ColabClient()
client.login()
client.connect()
client.open_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](LICENSE) for details.
