Metadata-Version: 2.4
Name: take-me-cloud
Version: 0.2.2
Summary: Wrapper to manage lightning ai studios
Requires-Python: >=3.13
Description-Content-Type: text/markdown
Requires-Dist: lightning-sdk>=2026.11.20
Requires-Dist: pyyaml>=6.0
Requires-Dist: tqdm>=4.66.1

# take-me-cloud

`take-me-cloud` is a CLI for working with Lightning AI studios from your shell. It can list every studio you can access, sync Lightning SSH entries into `~/.ssh/config`, create or replace studios from a local config file, and bootstrap a fresh studio for repository work.

## Introduction

The CLI authenticates with Lightning AI through `LIGHTNING_API_KEY` and either `LIGHTNING_USER_ID` or `LIGHTNING_USERNAME`. It uses those credentials to discover your organizations, teamspaces, and studios.

## Installation

```bash
pip install take_me_cloud
```

```bash
uv tool install take_me_cloud
```

For development:

```bash
pip install -e .
```

## Configuration

Create `~/.config/take_me_cloud_config.yaml` with a `Lightning AI` section:

```yaml
Lightning AI:
  machine_default: T4
  cloud_provider: AWS
  teamspace:
    - name: rwth-gut/skillcomp
      owner_type: org
    - name: vaishnavahari/myml
      owner_type: user
      machine_default: CPU
```

`teamspace` entries are shown interactively when you create a studio. Each entry must use `owner/teamspace` naming.

## Usage

### List studios

```bash
take-me-cloud --list
take-me-cloud -ls
```

The output is grouped by teamspace and shows the studio name, owner, machine type, and current state.

### Sync SSH config

```bash
take-me-cloud --lock-ssh
```

This preserves non-Lightning SSH hosts, removes stale Lightning entries, and writes the current accessible studios into `~/.ssh/config`.

### Create or replace a studio

```bash
take-me-cloud --create-replace my-studio
```

The CLI prompts for a teamspace from the config file, deletes any existing studio with the same name, starts the replacement with the configured machine type, and appends common setup commands to `~/.bash_history`.

### Go studio

```bash
take-me-cloud --go-studio my-repo
```

This creates or replaces a studio, clones `svaichu/my-repo` into the studio home directory, writes `.vscode/settings.json`, and installs the requested VS Code extensions on the remote environment.

### Set up a Colab VM

Describe the setup under the `Colab` key in `~/.config/take_me_cloud_config.yaml`:

```yaml
Colab:
  host: colab
  env:
    - GH_TOKEN
    - HF_TOKEN
  commands:
    - curl -fsSL https://chatgpt.com/codex/install.sh | CODEX_NON_INTERACTIVE=1 sh
    - curl -fsSL https://pixi.sh/install.sh | sh
```

Start the Colab VM yourself and make sure `ssh colab` works, then run:

```bash
take-me-cloud --colab
take-me-cloud --colab other-host
```

| Key | Meaning |
| --- | --- |
| `host` | SSH host used when `--colab` has no `HOST` argument. |
| `env` | Names of variables in your local shell to export from the VM's `~/.bashrc` (stored there in plain text). Unset ones are skipped. |
| `commands` | Commands run on the VM in order, after the variables and bash history are set. The setup stops at the first failure. They get no input, so they must run non-interactively. |

The package ships no defaults: without a key, that step is skipped, and without a host you must pass one. The example above installs [Codex](https://chatgpt.com/codex) and [pixi](https://pixi.sh). It does not need Lightning credentials.

### Bash history commands

New Lightning studios and Colab VMs get your commands added to their bash history file (`HISTFILE`, normally `~/.bash_history`), so they show up in Ctrl+R search. List them under the top-level `bash_history` key in `~/.config/take_me_cloud_config.yaml`:

```yaml
bash_history:
  - uv sync --active
  - uv pip list

Lightning AI:
  machine_default: T4
```

Commands already in the history are not repeated. Quote a command that contains `: ` or ` #`. Without this key, no history is added.

### Version

```bash
take-me-cloud --version
take-me-cloud -v
```

## Development

Run the tests with:

```bash
uv run python -m unittest discover -s tests -v
```

## Project Layout

- `take_me_cloud/base.py`: Lightning helpers and SSH/config logic
- `take_me_cloud/cli.py`: Argument parsing and command dispatch
- `take_me_cloud/colab.py`: Colab VM setup over SSH
- `take_me_cloud/history.py`: Config file and bash history helpers
- `tests/`: Unit tests for the core flows
