Metadata-Version: 2.4
Name: patholens
Version: 2.0.3
Summary: A command-line tool to manage, deploy, and launch PathoLens with Google Colab or local backends.
Requires-Python: >=3.13
Requires-Dist: click>=8.0.0
Requires-Dist: fastapi>=0.110.0
Requires-Dist: google-colab-cli>=0.1.0
Requires-Dist: httpx>=0.24.0
Requires-Dist: numpy>=1.24.0
Requires-Dist: openslide-bin>=4.0.1.1
Requires-Dist: openslide-python>=1.3.0
Requires-Dist: pillow>=10.0.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: pyjwt[crypto]>=2.8.0
Requires-Dist: python-multipart>=0.0.9
Requires-Dist: sqlalchemy>=2.0.0
Requires-Dist: uvicorn[standard]>=0.20.0
Requires-Dist: websockets>=12.0
Description-Content-Type: text/markdown

# 🔬 PathoLens Digital Pathology Workstation

PathoLens is a digital pathology workstation & AI workspace with a command-line launcher supporting **Local Machine** and **Google Colab Cloud VM** execution backends.

---

## 🚀 Key Features

*   **Dual Deployment Target:** Run completely locally on your hardware, or spin up a free Google Colab GPU-accelerated cloud VM with one command.
*   **Zero-friction Colab Deploy (Zero Code Uploads):** The CLI uses PyPI directly. Instead of slow zip uploads of the codebase, it initiates a PyPI installation (`uv pip install`) over Google's datacenter backbone (under 5 seconds) and only uploads the locally compiled static Next.js frontend (~6MB `static.zip`).
*   **Dynamic Slide Directory Configuration:** Switch slide folders dynamically inside the browser UI Settings modal without having to restart the backend. Point it to local directories (e.g. `/home/prime/slides`) or Google Drive paths (`/content/drive/MyDrive/...`).
*   **Edge AI Diagnostics:** Supports local execution of the `gemma-4-E2B-it-litert-lm` LiteRT model for local digital pathology clinical questions and diagnostics.

---

## 📦 Installation

To install the CLI globally using `uv`:

```bash
uv tool install patholens
```

---

## 🛠️ Usage

Simply run:

```bash
patholens launch
```

This launches the onboarding wizard in your terminal:

```
 █▀█ █▀█ ▀█▀ █▄█ █▀█ █   █▀▀ █▄ █ █▀
 █▀▀ █▀█  █  █ █ █▄█ █▄▄ ██▄ █ ▀█ ▄█ cli v2.0.2
 🔬 Digital Pathology Workstation & AI Workspace

 }  Environment: Cloud-Scalable / Multi-Tenant Ready
 }  Local Fallback: SQLite + Local Slide Storage

? Where would you like to run the PathoLens backend?
  1) Local Machine (Your computer's CPU/GPU)
  2) Google Colab VM (Free cloud CPU/GPU accelerators)
```

### Option 1: Local Machine
Runs a local FastAPI backend and serves the Next.js frontend statically.
*   **Local AI option:** You can choose to download the `litert_lm` package and cache the `gemma-4-E2B-it-litert-lm` model for local inference.
*   **Launch link:** The CLI automatically opens your default browser at `http://localhost:8000`.

### Option 2: Google Colab VM
*   **Drive Integration:** Prompts you to mount your Google Drive on the VM.
*   **Fast Setup:** Installs `patholens` from PyPI, uploads and extracts the frontend `static.zip`, installs slide bindings (`libopenslide0`), and opens a Cloudflare secure tunnel.
*   **Direct Browser Launch:** The CLI automatically grabs the public `*.trycloudflare.com` tunnel URL and opens it in your web browser.

---

## ⚙️ Slide Directory Configuration

You can configure the active slide folder inside the browser UI dashboard.
1.  Click the **Settings** gear icon in the header.
2.  Input the absolute path to your slide directory (e.g. `/content/drive/MyDrive/Slides` on Colab, or a local directory).
3.  Click **Save Settings**. The backend updates its active path on the fly and immediately lists the `.svs` files found in the folder.

