Metadata-Version: 2.4
Name: query-video
Version: 0.1.1
Summary: Agent-native YouTube/video tool — index, search, inspect frames for coding tutorials (import qv, CLI qv)
Project-URL: Homepage, https://github.com/jkvc/qv
Project-URL: Repository, https://github.com/jkvc/qv
Project-URL: Documentation, https://github.com/jkvc/qv#readme
Author: jkvc
License: MIT License
        
        Copyright (c) 2026 jkvc
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Requires-Python: >=3.12
Requires-Dist: pydantic>=2
Requires-Dist: rank-bm25>=0.2
Requires-Dist: typer>=0.15
Requires-Dist: yt-dlp>=2025.1
Provides-Extra: all
Requires-Dist: faster-whisper>=1.1; extra == 'all'
Requires-Dist: mcp>=1.6; extra == 'all'
Provides-Extra: mcp
Requires-Dist: mcp>=1.6; extra == 'mcp'
Provides-Extra: stt
Requires-Dist: faster-whisper>=1.1; extra == 'stt'
Description-Content-Type: text/markdown

# qv

**Quick video** / **query video** — a minimal agent tool for coding tutorials. Three MCP tools (`index`, `search`, `inspect_frame`), one CLI (`qv`), one Python package.

Agents navigate screencasts by searching speech, then pulling precise frames for vision — without transcript dumps or 40-tool menus.

**PyPI:** install as [`query-video`](https://pypi.org/project/query-video/) (`qv` is blocked as a PyPI project name). The Python import and CLI remain **`qv`**.

## Install

```bash
uv tool install 'query-video[stt]'
# or
pip install 'query-video[stt]'
```

Provides the **`qv`** command. Optional extras: `[mcp]`, `[stt]`, `[all]`.

**System deps:** `ffmpeg` on PATH. `yt-dlp` is bundled via pip. Indexing requires the `[stt]` extra (`faster-whisper`).

## Development setup

**Prerequisites:** Python 3.12+, [uv](https://docs.astral.sh/uv/), `ffmpeg` and `ffprobe` on PATH.

```bash
git clone https://github.com/jkvc/qv.git
cd qv
uv sync --group dev
uv sync --extra stt
git config core.hooksPath .githooks   # optional; runs lint/format/unit tests on push
```

**Run from the repo** (editable install via `uv sync`):

```bash
uv run qv --help
uv run pytest
uv run pytest -m integration
uv run ruff check . && uv run ruff format --check .
```

**GPU Whisper (optional):** default `device=auto` uses CUDA when a GPU is visible. ctranslate2 4.x needs CUDA 12 user-space libs (e.g. on Ubuntu/Pop: `sudo apt install libcublas12 libcudart12`). If GPU libs are missing, indexing fails — set `QV_DEVICE=cpu` or `device="cpu"` in code. See [`notes/20260614-v0-config-and-tooling.md`](notes/20260614-v0-config-and-tooling.md).

**Lib usage:**

```python
from qv.lib.api import index_video, search_video, inspect_frame
```

## CLI

```bash
qv index URL --json
qv search VIDEO_ID "useState setup" --json
qv inspect-frame VIDEO_ID --at 754 --json
qv mcp   # stdio MCP server (requires [mcp] extra)
```

CLI commands are stubs; use `qv.lib.api` directly until wired.

## MCP (Cursor, Claude Code, etc.)

```json
{
  "mcpServers": {
    "qv": {
      "command": "uvx",
      "args": ["--from", "query-video[mcp]", "qv", "mcp"],
      "env": {
        "QV_CACHE": "~/.cache/qv",
        "QV_DEVICE": "cpu"
      }
    }
  }
}
```

## Layout

| | |
|--|--|
| **PyPI package** | `query-video` |
| **Python import** | `qv` (`src/qv/`) |
| **CLI** | `qv` only |
| **Lib API** | `from qv.lib.api import index_video, search_video, inspect_frame` |
| **GitHub repo** | [jkvc/qv](https://github.com/jkvc/qv) |

Cache default: `~/.cache/qv` (override with `QV_CACHE`).

### Configuration

Precedence: **call-site args → env → `~/.config/qv/config.toml` → defaults**.

| Setting | Default | Env | Config key |
|---------|---------|-----|------------|
| STT model | `whisper_base` | `QV_MODEL_NAME` (legacy: `QV_WHISPER_MODEL` = bare size) | `model_name` |
| Device | `auto` | `QV_DEVICE` | `device` |
| Frame quality | `p720` | `QV_FRAME_QUALITY` | `frame_quality` |
| Frame window (s) | `15` | `QV_FRAME_WINDOW` | `frame_window_s` |
| Cache dir | `~/.cache/qv` | `QV_CACHE` | `cache_dir` |

`model_name` is backend-qualified: `whisper_base`, `whisper_small`, `soniox`, etc. `device` (`auto` / `cpu` / `cuda`) applies to whisper only.

Example `~/.config/qv/config.toml`:

```toml
model_name = "whisper_base"
device = "auto"
```

Override config file path with `QV_CONFIG`. Interactive `qv configure` is planned.

## Publishing (PyPI)

Single PyPI project **`query-video`** ships the `qv` Python package and `qv` CLI entrypoint. The name `qv` is prohibited on PyPI.

**Version bump:**

1. `pyproject.toml` → `[project].version`
2. `src/qv/__init__.py` → `__version__`

```bash
uv lock
uv build
uv publish dist/query_video-*
```

Smoke test:

```bash
uv tool install 'query-video[stt]==X.Y.Z'
qv --version
```

## Status

**Core lib** implements `index_video`, `search_video`, `inspect_frame` via `qv.lib.api`. CLI and MCP entrypoints exist but are not fully wired.

**Docs:** [`notes/20260614-qv-implementation-spec.md`](notes/20260614-qv-implementation-spec.md) (v0 spec) · [`notes/20260614-v0-config-and-tooling.md`](notes/20260614-v0-config-and-tooling.md) (config session log) · [`notes/20260614-pypi-query-video.md`](notes/20260614-pypi-query-video.md) (PyPI naming)
