Metadata-Version: 2.5
Name: datahub-cli
Version: 0.2.0
Summary: Local data catalog and hardware-aware model discovery
Project-URL: Homepage, https://github.com/tyler-ungerman/data-hub
Project-URL: Repository, https://github.com/tyler-ungerman/data-hub
Project-URL: Issues, https://github.com/tyler-ungerman/data-hub/issues
Author: Tyler Ungerman
License-Expression: MIT
License-File: LICENSE
Keywords: catalog,datasets,hugging-face,models,ollama,tui
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Requires-Python: >=3.11
Requires-Dist: huggingface-hub>=0.25.0
Requires-Dist: rich>=13.3.3
Requires-Dist: textual>=0.80.0
Requires-Dist: tqdm>=4.42.1
Provides-Extra: all
Requires-Dist: kaggle>=1.6.0; extra == 'all'
Requires-Dist: onnxruntime>=1.18.0; extra == 'all'
Requires-Dist: pyarrow>=15.0.0; extra == 'all'
Provides-Extra: kaggle
Requires-Dist: kaggle>=1.6.0; extra == 'kaggle'
Provides-Extra: onnx
Requires-Dist: onnxruntime>=1.18.0; extra == 'onnx'
Provides-Extra: parquet
Requires-Dist: pyarrow>=15.0.0; extra == 'parquet'
Description-Content-Type: text/markdown

# DataHub CLI

DataHub is a terminal tool for finding models and datasets, estimating which models fit your hardware, and tracking local data. It indexes local files in SQLite, caches schemas, and can find project references to catalog items.

## Install

Once the package is published on PyPI, install it with either tool manager or try it without a persistent installation.

```sh
uv tool install datahub-cli
uvx datahub-cli
pip install datahub-cli
```

To install from a checkout before the first release, run `uv tool install .` in that directory. DataHub requires Python 3.11 or newer. The installed commands are `datahub` and `dhub`.

Optional extras add Parquet and ONNX inspection or the Kaggle CLI. For example, use `pip install 'datahub-cli[parquet,onnx]'` or `uv tool install 'datahub-cli[kaggle]'`.

## Quickstart

```sh
datahub init
datahub
datahub sm
datahub sm "qwen" --source ollama --fits -n 10
datahub sd --use-case finance -n 5
datahub scan
datahub ls
datahub info category/dataset-name --json
```

Use an ID from `datahub ls` with `datahub info` or `datahub path`. For model estimates on another memory budget, run `datahub --memory 16G --max-context 4096 sm --fits`. Estimates depend on the runtime and architecture. A quantization plan describes possible configurations. A pull downloads the provider's published artifact.

Ollama search uses the public model catalog without credentials. The selected size and pull tag appear in the TUI inspector and JSON results. DataHub estimates Ollama model sizes at Q4 and embeddings at FP16 when the catalog does not report weights or quantization. Ollama downloads need the `ollama` executable and its local service. Ollama manages the weights, and DataHub records a reference. Setting `OLLAMADB_API_KEY` enables an API fallback if the public search fails. Hugging Face can use `HF_TOKEN` or an existing login for gated downloads. Kaggle needs its CLI and credentials.

Use `--one-page` for a JSON page with a `next_cursor`, then pass it to `--cursor` with the same filters. `--sort newest` orders Ollama results by recency.

| Key | Action |
| --- | --- |
| `1`, `2`, `3` | Switch between Models, Datasets, and Local Catalog |
| `/` | Focus the active tab’s search or filter input |
| ↑ / ↓ | Move between results or options in an open dropdown |
| `Tab` / `Shift+Tab` | Move between controls |
| `Enter` in a search field | Search and focus results |
| `Esc` | Close a dialog or return focus to results |
| `m` | Load another page |
| `p` or Enter on a result | Open the pull dialog |
| `c`, `v` | Mark a model and compare marked models |
| `x` | Open the seven-tier quantization plan |
| `q` | Quit |

Press Enter on a result to open its pull dialog. Use the arrow keys in the category dropdown and Tab to edit the fields. Enter on a text field submits the pull.

Both the CLI pull commands and the TUI show download and indexing status. Size, speed, and ETA appear when the provider exposes transfer totals. Downloads with unknown totals show activity until the provider reports completion.

## Configuration

DataHub resolves each path from its CLI flag, environment variable, TOML setting, then default.

| Path | Flag | Environment | TOML | Default |
| --- | --- | --- | --- | --- |
| Data and catalog | `--data-root` | `DATA_ROOT` | `data_root` | `~/data` |
| Project scan root | `--projects-root` | `PROJECTS_ROOT` | `projects_root` | Disabled |

The config file lives at `~/.config/datahub/config.toml`, under `$XDG_CONFIG_HOME/datahub` if set, or under `%APPDATA%\datahub` on Windows. Values can use `~` for the home directory.

```sh
datahub init --data-root ~/data --projects-root ~/work --save-config
datahub scan --deps
```

`init` creates the standard directories and database and prints optional shell settings for `DATA_ROOT`, `HF_HOME`, `TORCH_HOME`, and `OLLAMA_MODELS`. Catalog commands also initialize a missing database on first use. Set a project root before running a dependency scan.

## Python API

```python
from datahub import detect_hardware, evaluate_model, get_dataset_dir, get_model_path

dataset = get_dataset_dir("category/dataset-name")
checkpoint = get_model_path("weights/my-model")
hardware = detect_hardware(memory="16G")
fit = evaluate_model("example-7B", hardware, max_context=4096)
print(fit.quant, fit.total_gb, fit.verdict)
```

The path helpers resolve indexed IDs or unique names and raise `KeyError` if the item is missing or ambiguous. Each accepts a `data_root` override.

## Development

```sh
uv run ruff check
uv run pytest
uv build
```
