Metadata-Version: 2.5
Name: lightbox-cull
Version: 0.1.2
Summary: Local-first photo culling app and MCP server with reversible quarantine
Project-URL: Homepage, https://github.com/olioDuan/LightBox
Project-URL: Repository, https://github.com/olioDuan/LightBox
Project-URL: Issues, https://github.com/olioDuan/LightBox/issues
License-Expression: Apache-2.0
License-File: LICENSE
License-File: NOTICE
Keywords: desktop,local-first,mcp,photo-culling,photography,raw
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: End Users/Desktop
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Multimedia :: Graphics
Requires-Python: >=3.12
Requires-Dist: anthropic>=2.14.0
Requires-Dist: exifread>=3.0.0
Requires-Dist: fastapi>=0.165.0
Requires-Dist: huggingface-hub>=2.4.0
Requires-Dist: keyring>=25.7.0
Requires-Dist: mcp>=1.9.0
Requires-Dist: numpy>=2.0.0
Requires-Dist: onnxruntime>=1.32.0
Requires-Dist: openai>=3.59.0
Requires-Dist: opencv-python-headless>=5.1.0.95
Requires-Dist: pillow>=11.0.0
Requires-Dist: platformdirs>=4.3.0
Requires-Dist: psutil>=6.1.0
Requires-Dist: pydantic>=2.10.0
Requires-Dist: rawpy>=0.23.0
Requires-Dist: sqlite-vec>=0.1.6
Requires-Dist: structlog>=24.4.0
Requires-Dist: tokenizers>=0.23.3
Requires-Dist: typer>=0.29.2
Requires-Dist: uvicorn>=0.54.0
Provides-Extra: desktop
Requires-Dist: pywebview>=5.3; extra == 'desktop'
Provides-Extra: heic
Requires-Dist: pillow-heif>=0.20.0; extra == 'heic'
Description-Content-Type: text/markdown

# LightBox

[![PyPI](https://img.shields.io/pypi/v/lightbox-cull?style=flat-square&logo=pypi&logoColor=white&color=18181b)](https://pypi.org/project/lightbox-cull/)
[![CI](https://img.shields.io/github/actions/workflow/status/olioDuan/LightBox/ci.yml?branch=main&style=flat-square&logo=githubactions&logoColor=white&label=CI)](https://github.com/olioDuan/LightBox/actions/workflows/ci.yml)
[![Python 3.12+](https://img.shields.io/badge/Python-3.12%2B-18181b?style=flat-square&logo=python&logoColor=white)](pyproject.toml)
[![License: Apache-2.0](https://img.shields.io/badge/License-Apache--2.0-52525b?style=flat-square)](LICENSE)

English | [简体中文](README.zh-CN.md)

**LightBox** is a local-first photo culling tool built for photographers who want to clear out obvious misses quickly without handing their library to the cloud — or risking an accidental delete.

It runs offline by default with zero API keys, pairs RAW+JPEG and Live Photos automatically, and works either as a standalone desktop/web app or inside Claude, Cursor, and Codex through a Skill and MCP server.

## Why LightBox

Most photo culling workflows force an awkward trade-off: either scrub through hundreds of burst frames by hand, or upload full shoots to a subscription cloud tool. LightBox keeps everything on your machine and follows three strict rules:

- **Offline first**: Sharpness, exposure, closed-eye checks, burst grouping, semantic search, and face clustering all run locally. No account, no cloud upload, no API key required.
- **No hard deletes**: LightBox never calls `rm` or `unlink` on your photo folders. Moving rejects always requires an explicit approval step, happens as a same-volume move into a `Lightbox_Quarantine/` folder, and can be undone in one click.
- **Respect creative intent**: Shallow depth of field, panning shots, long exposures, silhouettes, and intentional low/high-key frames are guarded so they are not misflagged as technical mistakes. Borderline shots stay in an uncertain bucket for your own eyes.

## Highlights

- **Deterministic culling**: Flags camera shake, missed focus, extreme exposure misfires, and closed eyes; groups bursts and recommends the sharpest pick; keeps RAW+JPEG and Live Photo pairs moving together.
- **Reversible quarantine**: Drafts a reviewable move plan with safety verification before touching a single file. Restore an entire batch or individual shots whenever you change your mind.
- **Local search, people & shoot insights**: Natural-language search and find-similar powered by local SigLIP 2, face clustering and per-person export, plus a shoot digest summarizing technical misses vs. burst duplicates.
- **Optional AI review (`Cmd+K` / `Ctrl+K`)**: When you want a second opinion on borderline frames or want to talk through a shoot, connect OpenAI, Anthropic, Gemini, any OpenAI-compatible endpoint, or local Ollama in the built-in drawer.

## Quick Start

Requires Python 3.12+ and [uv](https://docs.astral.sh/uv/).

### Option 1: Standalone Desktop or Web App

Launch in your browser without cloning the repo:

```bash
uvx --from lightbox-cull lightbox ui
```

Or open the native desktop window:

```bash
uvx --from 'lightbox-cull[desktop]' lightbox app
```

Install permanently and create a system app launcher (macOS `~/Applications/LightBox.app`, Windows `.lnk`, Linux `.desktop`):

```bash
uv tool install 'lightbox-cull[desktop]'
lightbox install-app
```

Want to try the interface without scanning your own photos? Generate a synthetic shoot and open it directly:

```bash
uvx --from lightbox-cull lightbox demo
```

> **Optional extras**: Add `heic` (for example, `lightbox-cull[desktop,heic]`) if you shoot HEIC. On Linux, desktop window mode requires system GTK bindings (`python3-gi gir1.2-webkit2-4.1`) or `PySide6`.

### Option 2: Use in Claude, Cursor, or Codex

LightBox supports two workflows inside AI clients:

1. **Direct chat culling (zero install)** — Load `skills/lightbox-cull/SKILL.md` in Claude Code, Cursor, or Codex. Drop a handful of photos directly into chat and ask it to spot blurry frames, compare a burst, or pick the best 3 shots. No local LightBox install or MCP setup is needed.
2. **Whole-folder culling (MCP)** — Connect the local MCP server to scan full shoot folders, inspect RAW/HEIC/Live Photo pairs, search locally, and draft reversible quarantine plans.

**Claude Desktop / Cursor** (you can also copy a ready-made snippet from **Settings → Use in Claude / Cursor** inside the app):

```json
{
  "mcpServers": {
    "lightbox": {
      "command": "uvx",
      "args": ["--from", "lightbox-cull", "lightbox", "mcp"]
    }
  }
}
```

**Claude Code**:

```bash
claude mcp add lightbox -- uvx --from lightbox-cull lightbox mcp
```

**Codex** (`~/.codex/config.toml`):

```toml
[mcp_servers.lightbox]
command = "uvx"
args = ["--from", "lightbox-cull", "lightbox", "mcp", "--transport", "stdio"]
```

If a GUI client on macOS or Windows cannot find `uvx` on its `PATH`, replace `"uvx"` with the full path printed by `which uvx`.

## Project Layout

```text
LightBox/
├── src/lightbox/          # Core culling engine, SafeFS quarantine, SQLite store, API, CLI & MCP server
├── web/                   # React + TypeScript frontend (built into src/lightbox/web_dist/)
├── skills/lightbox-cull/  # Dual-mode photo culling skill for Claude, Cursor, and Codex
├── benchmarks/            # Synthetic dataset generator and detection accuracy benchmark
├── scripts/               # Static safety checks and scene vocabulary builder
└── tests/                 # Offline unit, API, CLI, and MCP contract tests
```

## FAQ

**Does LightBox upload my photos anywhere?**
No. Scanning, sharpness/exposure scoring, burst grouping, semantic search, and face clustering all run locally. External network calls only happen if you explicitly download an optional local model (SigLIP 2 / InsightFace) or configure an external AI provider in Settings.

**Can LightBox permanently delete my originals?**
No. File deletion APIs are banned across the codebase and checked automatically in CI via `ruff` (`TID251`) and `scripts/check_no_delete.py`. Every quarantine action moves files safely on the same volume after explicit confirmation and keeps a restore manifest.

**What formats are supported?**
Standard JPEG/PNG/WebP, camera RAW formats supported by LibRaw/`rawpy` (paired automatically with matching JPEGs), Live Photos, and optional HEIC via `lightbox-cull[heic]`.

## Development

```bash
git clone https://github.com/olioDuan/LightBox.git
cd LightBox
uv sync

# Lint, safety gates, architecture boundaries, type check, and offline tests
uv run ruff check .
uv run python scripts/check_no_delete.py
uv run lint-imports
uv run mypy src
uv run pytest
```

To rebuild the frontend bundle after editing files under `web/`:

```bash
cd web
npm install
npm run build
```

## License

Apache-2.0. See [LICENSE](LICENSE) and [NOTICE](NOTICE) for third-party component and optional model notices.
