datahub-cli 0.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- datahub_cli-0.2.0/.github/workflows/ci.yml +24 -0
- datahub_cli-0.2.0/.github/workflows/publish.yml +44 -0
- datahub_cli-0.2.0/.gitignore +8 -0
- datahub_cli-0.2.0/CHANGELOG.md +16 -0
- datahub_cli-0.2.0/LICENSE +21 -0
- datahub_cli-0.2.0/PKG-INFO +130 -0
- datahub_cli-0.2.0/README.md +94 -0
- datahub_cli-0.2.0/pyproject.toml +61 -0
- datahub_cli-0.2.0/src/datahub/__init__.py +46 -0
- datahub_cli-0.2.0/src/datahub/catalog.py +1152 -0
- datahub_cli-0.2.0/src/datahub/cli.py +251 -0
- datahub_cli-0.2.0/src/datahub/config.py +101 -0
- datahub_cli-0.2.0/src/datahub/hardware.py +148 -0
- datahub_cli-0.2.0/src/datahub/ollama_search.py +97 -0
- datahub_cli-0.2.0/src/datahub/progress.py +44 -0
- datahub_cli-0.2.0/src/datahub/providers.py +702 -0
- datahub_cli-0.2.0/src/datahub/py.typed +0 -0
- datahub_cli-0.2.0/src/datahub/scoring.py +172 -0
- datahub_cli-0.2.0/src/datahub/tui.py +846 -0
- datahub_cli-0.2.0/tests/test_config.py +91 -0
- datahub_cli-0.2.0/tests/test_ollama.py +110 -0
- datahub_cli-0.2.0/tests/test_progress.py +58 -0
- datahub_cli-0.2.0/tests/test_scoring.py +67 -0
- datahub_cli-0.2.0/tests/test_tui.py +131 -0
- datahub_cli-0.2.0/uv.lock +1291 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
tests:
|
|
12
|
+
runs-on: ${{ matrix.os }}
|
|
13
|
+
strategy:
|
|
14
|
+
fail-fast: false
|
|
15
|
+
matrix:
|
|
16
|
+
os: [ubuntu-latest, macos-latest, windows-latest]
|
|
17
|
+
python: ["3.11", "3.12", "3.13"]
|
|
18
|
+
steps:
|
|
19
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
20
|
+
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
|
|
21
|
+
with:
|
|
22
|
+
python-version: ${{ matrix.python }}
|
|
23
|
+
- run: uv run --locked ruff check
|
|
24
|
+
- run: uv run --locked pytest
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
jobs:
|
|
11
|
+
build:
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
15
|
+
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
|
|
16
|
+
with:
|
|
17
|
+
python-version: "3.13"
|
|
18
|
+
- run: uv build
|
|
19
|
+
- name: Smoke-test the wheel and source distribution
|
|
20
|
+
shell: bash
|
|
21
|
+
run: |
|
|
22
|
+
cd "$RUNNER_TEMP"
|
|
23
|
+
uv run --isolated --no-project --with "$GITHUB_WORKSPACE"/dist/*.whl datahub --version
|
|
24
|
+
uv run --isolated --no-project --with "$GITHUB_WORKSPACE"/dist/*.whl datahub hw
|
|
25
|
+
uv run --isolated --no-project --with "$GITHUB_WORKSPACE"/dist/*.tar.gz datahub --help
|
|
26
|
+
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
27
|
+
with:
|
|
28
|
+
name: pypi-dist
|
|
29
|
+
path: dist/
|
|
30
|
+
if-no-files-found: error
|
|
31
|
+
|
|
32
|
+
publish:
|
|
33
|
+
needs: build
|
|
34
|
+
runs-on: ubuntu-latest
|
|
35
|
+
environment: pypi
|
|
36
|
+
permissions:
|
|
37
|
+
id-token: write
|
|
38
|
+
steps:
|
|
39
|
+
- uses: astral-sh/setup-uv@37802adc94f370d6bfd71619e3f0bf239e1f3b78 # v7
|
|
40
|
+
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
41
|
+
with:
|
|
42
|
+
name: pypi-dist
|
|
43
|
+
path: dist/
|
|
44
|
+
- run: uv publish --trusted-publishing always
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 0.2.0
|
|
4
|
+
|
|
5
|
+
- Show pull progress, transfer speed, ETA, and indexing status in the CLI and TUI when the provider supplies progress details.
|
|
6
|
+
- Support a complete keyboard workflow for searching, selecting results, and confirming pulls.
|
|
7
|
+
|
|
8
|
+
- Search Ollama without an account or API key, with capability filters, pagination, and hardware-aware size selection.
|
|
9
|
+
- Initialize a data directory automatically or with `datahub init`. Configure both roots through flags, environment variables, or TOML.
|
|
10
|
+
- Add typed Python helpers for catalog paths, hardware detection, and model fit.
|
|
11
|
+
- Add continuous integration and PyPI Trusted Publishing.
|
|
12
|
+
|
|
13
|
+
## 0.1.0
|
|
14
|
+
|
|
15
|
+
- Added a SQLite dataset and model catalog, schema and dependency scanning, a CLI, and a Textual interface.
|
|
16
|
+
- Added registry search and downloads, model comparison, and seven-tier quantization planning.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Tyler Ungerman
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: datahub-cli
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Local data catalog and hardware-aware model discovery
|
|
5
|
+
Project-URL: Homepage, https://github.com/tyler-ungerman/data-hub
|
|
6
|
+
Project-URL: Repository, https://github.com/tyler-ungerman/data-hub
|
|
7
|
+
Project-URL: Issues, https://github.com/tyler-ungerman/data-hub/issues
|
|
8
|
+
Author: Tyler Ungerman
|
|
9
|
+
License-Expression: MIT
|
|
10
|
+
License-File: LICENSE
|
|
11
|
+
Keywords: catalog,datasets,hugging-face,models,ollama,tui
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Operating System :: OS Independent
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
20
|
+
Requires-Python: >=3.11
|
|
21
|
+
Requires-Dist: huggingface-hub>=0.25.0
|
|
22
|
+
Requires-Dist: rich>=13.3.3
|
|
23
|
+
Requires-Dist: textual>=0.80.0
|
|
24
|
+
Requires-Dist: tqdm>=4.42.1
|
|
25
|
+
Provides-Extra: all
|
|
26
|
+
Requires-Dist: kaggle>=1.6.0; extra == 'all'
|
|
27
|
+
Requires-Dist: onnxruntime>=1.18.0; extra == 'all'
|
|
28
|
+
Requires-Dist: pyarrow>=15.0.0; extra == 'all'
|
|
29
|
+
Provides-Extra: kaggle
|
|
30
|
+
Requires-Dist: kaggle>=1.6.0; extra == 'kaggle'
|
|
31
|
+
Provides-Extra: onnx
|
|
32
|
+
Requires-Dist: onnxruntime>=1.18.0; extra == 'onnx'
|
|
33
|
+
Provides-Extra: parquet
|
|
34
|
+
Requires-Dist: pyarrow>=15.0.0; extra == 'parquet'
|
|
35
|
+
Description-Content-Type: text/markdown
|
|
36
|
+
|
|
37
|
+
# DataHub CLI
|
|
38
|
+
|
|
39
|
+
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.
|
|
40
|
+
|
|
41
|
+
## Install
|
|
42
|
+
|
|
43
|
+
Once the package is published on PyPI, install it with either tool manager or try it without a persistent installation.
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
uv tool install datahub-cli
|
|
47
|
+
uvx datahub-cli
|
|
48
|
+
pip install datahub-cli
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
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`.
|
|
52
|
+
|
|
53
|
+
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]'`.
|
|
54
|
+
|
|
55
|
+
## Quickstart
|
|
56
|
+
|
|
57
|
+
```sh
|
|
58
|
+
datahub init
|
|
59
|
+
datahub
|
|
60
|
+
datahub sm
|
|
61
|
+
datahub sm "qwen" --source ollama --fits -n 10
|
|
62
|
+
datahub sd --use-case finance -n 5
|
|
63
|
+
datahub scan
|
|
64
|
+
datahub ls
|
|
65
|
+
datahub info category/dataset-name --json
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
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.
|
|
69
|
+
|
|
70
|
+
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.
|
|
71
|
+
|
|
72
|
+
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.
|
|
73
|
+
|
|
74
|
+
| Key | Action |
|
|
75
|
+
| --- | --- |
|
|
76
|
+
| `1`, `2`, `3` | Switch between Models, Datasets, and Local Catalog |
|
|
77
|
+
| `/` | Focus the active tab’s search or filter input |
|
|
78
|
+
| ↑ / ↓ | Move between results or options in an open dropdown |
|
|
79
|
+
| `Tab` / `Shift+Tab` | Move between controls |
|
|
80
|
+
| `Enter` in a search field | Search and focus results |
|
|
81
|
+
| `Esc` | Close a dialog or return focus to results |
|
|
82
|
+
| `m` | Load another page |
|
|
83
|
+
| `p` or Enter on a result | Open the pull dialog |
|
|
84
|
+
| `c`, `v` | Mark a model and compare marked models |
|
|
85
|
+
| `x` | Open the seven-tier quantization plan |
|
|
86
|
+
| `q` | Quit |
|
|
87
|
+
|
|
88
|
+
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.
|
|
89
|
+
|
|
90
|
+
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.
|
|
91
|
+
|
|
92
|
+
## Configuration
|
|
93
|
+
|
|
94
|
+
DataHub resolves each path from its CLI flag, environment variable, TOML setting, then default.
|
|
95
|
+
|
|
96
|
+
| Path | Flag | Environment | TOML | Default |
|
|
97
|
+
| --- | --- | --- | --- | --- |
|
|
98
|
+
| Data and catalog | `--data-root` | `DATA_ROOT` | `data_root` | `~/data` |
|
|
99
|
+
| Project scan root | `--projects-root` | `PROJECTS_ROOT` | `projects_root` | Disabled |
|
|
100
|
+
|
|
101
|
+
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.
|
|
102
|
+
|
|
103
|
+
```sh
|
|
104
|
+
datahub init --data-root ~/data --projects-root ~/work --save-config
|
|
105
|
+
datahub scan --deps
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
`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.
|
|
109
|
+
|
|
110
|
+
## Python API
|
|
111
|
+
|
|
112
|
+
```python
|
|
113
|
+
from datahub import detect_hardware, evaluate_model, get_dataset_dir, get_model_path
|
|
114
|
+
|
|
115
|
+
dataset = get_dataset_dir("category/dataset-name")
|
|
116
|
+
checkpoint = get_model_path("weights/my-model")
|
|
117
|
+
hardware = detect_hardware(memory="16G")
|
|
118
|
+
fit = evaluate_model("example-7B", hardware, max_context=4096)
|
|
119
|
+
print(fit.quant, fit.total_gb, fit.verdict)
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
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.
|
|
123
|
+
|
|
124
|
+
## Development
|
|
125
|
+
|
|
126
|
+
```sh
|
|
127
|
+
uv run ruff check
|
|
128
|
+
uv run pytest
|
|
129
|
+
uv build
|
|
130
|
+
```
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# DataHub CLI
|
|
2
|
+
|
|
3
|
+
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.
|
|
4
|
+
|
|
5
|
+
## Install
|
|
6
|
+
|
|
7
|
+
Once the package is published on PyPI, install it with either tool manager or try it without a persistent installation.
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
uv tool install datahub-cli
|
|
11
|
+
uvx datahub-cli
|
|
12
|
+
pip install datahub-cli
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
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`.
|
|
16
|
+
|
|
17
|
+
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]'`.
|
|
18
|
+
|
|
19
|
+
## Quickstart
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
datahub init
|
|
23
|
+
datahub
|
|
24
|
+
datahub sm
|
|
25
|
+
datahub sm "qwen" --source ollama --fits -n 10
|
|
26
|
+
datahub sd --use-case finance -n 5
|
|
27
|
+
datahub scan
|
|
28
|
+
datahub ls
|
|
29
|
+
datahub info category/dataset-name --json
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
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.
|
|
33
|
+
|
|
34
|
+
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.
|
|
35
|
+
|
|
36
|
+
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.
|
|
37
|
+
|
|
38
|
+
| Key | Action |
|
|
39
|
+
| --- | --- |
|
|
40
|
+
| `1`, `2`, `3` | Switch between Models, Datasets, and Local Catalog |
|
|
41
|
+
| `/` | Focus the active tab’s search or filter input |
|
|
42
|
+
| ↑ / ↓ | Move between results or options in an open dropdown |
|
|
43
|
+
| `Tab` / `Shift+Tab` | Move between controls |
|
|
44
|
+
| `Enter` in a search field | Search and focus results |
|
|
45
|
+
| `Esc` | Close a dialog or return focus to results |
|
|
46
|
+
| `m` | Load another page |
|
|
47
|
+
| `p` or Enter on a result | Open the pull dialog |
|
|
48
|
+
| `c`, `v` | Mark a model and compare marked models |
|
|
49
|
+
| `x` | Open the seven-tier quantization plan |
|
|
50
|
+
| `q` | Quit |
|
|
51
|
+
|
|
52
|
+
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.
|
|
53
|
+
|
|
54
|
+
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.
|
|
55
|
+
|
|
56
|
+
## Configuration
|
|
57
|
+
|
|
58
|
+
DataHub resolves each path from its CLI flag, environment variable, TOML setting, then default.
|
|
59
|
+
|
|
60
|
+
| Path | Flag | Environment | TOML | Default |
|
|
61
|
+
| --- | --- | --- | --- | --- |
|
|
62
|
+
| Data and catalog | `--data-root` | `DATA_ROOT` | `data_root` | `~/data` |
|
|
63
|
+
| Project scan root | `--projects-root` | `PROJECTS_ROOT` | `projects_root` | Disabled |
|
|
64
|
+
|
|
65
|
+
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.
|
|
66
|
+
|
|
67
|
+
```sh
|
|
68
|
+
datahub init --data-root ~/data --projects-root ~/work --save-config
|
|
69
|
+
datahub scan --deps
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
`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.
|
|
73
|
+
|
|
74
|
+
## Python API
|
|
75
|
+
|
|
76
|
+
```python
|
|
77
|
+
from datahub import detect_hardware, evaluate_model, get_dataset_dir, get_model_path
|
|
78
|
+
|
|
79
|
+
dataset = get_dataset_dir("category/dataset-name")
|
|
80
|
+
checkpoint = get_model_path("weights/my-model")
|
|
81
|
+
hardware = detect_hardware(memory="16G")
|
|
82
|
+
fit = evaluate_model("example-7B", hardware, max_context=4096)
|
|
83
|
+
print(fit.quant, fit.total_gb, fit.verdict)
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
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.
|
|
87
|
+
|
|
88
|
+
## Development
|
|
89
|
+
|
|
90
|
+
```sh
|
|
91
|
+
uv run ruff check
|
|
92
|
+
uv run pytest
|
|
93
|
+
uv build
|
|
94
|
+
```
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling>=1.27"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "datahub-cli"
|
|
7
|
+
version = "0.2.0"
|
|
8
|
+
description = "Local data catalog and hardware-aware model discovery"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
license-files = ["LICENSE"]
|
|
12
|
+
authors = [{ name = "Tyler Ungerman" }]
|
|
13
|
+
keywords = ["datasets", "models", "catalog", "ollama", "hugging-face", "tui"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Environment :: Console",
|
|
17
|
+
"Operating System :: OS Independent",
|
|
18
|
+
"Programming Language :: Python :: 3",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
"Programming Language :: Python :: 3.13",
|
|
22
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
23
|
+
]
|
|
24
|
+
requires-python = ">=3.11"
|
|
25
|
+
dependencies = [
|
|
26
|
+
"textual>=0.80.0",
|
|
27
|
+
"huggingface_hub>=0.25.0",
|
|
28
|
+
"rich>=13.3.3",
|
|
29
|
+
"tqdm>=4.42.1",
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[project.optional-dependencies]
|
|
33
|
+
parquet = ["pyarrow>=15.0.0"]
|
|
34
|
+
onnx = ["onnxruntime>=1.18.0"]
|
|
35
|
+
kaggle = ["kaggle>=1.6.0"]
|
|
36
|
+
all = ["pyarrow>=15.0.0", "onnxruntime>=1.18.0", "kaggle>=1.6.0"]
|
|
37
|
+
|
|
38
|
+
[project.urls]
|
|
39
|
+
Homepage = "https://github.com/tyler-ungerman/data-hub"
|
|
40
|
+
Repository = "https://github.com/tyler-ungerman/data-hub"
|
|
41
|
+
Issues = "https://github.com/tyler-ungerman/data-hub/issues"
|
|
42
|
+
|
|
43
|
+
[project.scripts]
|
|
44
|
+
datahub-cli = "datahub.cli:main"
|
|
45
|
+
datahub = "datahub.cli:main"
|
|
46
|
+
dhub = "datahub.cli:main"
|
|
47
|
+
|
|
48
|
+
[tool.hatch.build.targets.wheel]
|
|
49
|
+
packages = ["src/datahub"]
|
|
50
|
+
|
|
51
|
+
[dependency-groups]
|
|
52
|
+
dev = ["pytest>=8", "ruff>=0.8"]
|
|
53
|
+
|
|
54
|
+
[tool.pytest.ini_options]
|
|
55
|
+
testpaths = ["tests"]
|
|
56
|
+
|
|
57
|
+
[tool.ruff]
|
|
58
|
+
target-version = "py311"
|
|
59
|
+
|
|
60
|
+
[tool.ruff.lint]
|
|
61
|
+
extend-select = ["I"]
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"""Public API for the local data catalog and hardware-aware model estimates."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
|
|
8
|
+
from .catalog import catalog_path
|
|
9
|
+
from .config import resolve_config
|
|
10
|
+
from .hardware import HardwareProfile, detect_hardware
|
|
11
|
+
from .scoring import ModelSpec, QuantTier, parse_parameters, score_model
|
|
12
|
+
|
|
13
|
+
try:
|
|
14
|
+
__version__ = version("datahub-cli")
|
|
15
|
+
except PackageNotFoundError:
|
|
16
|
+
__version__ = "0+unknown"
|
|
17
|
+
|
|
18
|
+
__all__ = ["__version__", "detect_hardware", "evaluate_model", "get_dataset_dir", "get_model_path"]
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
def get_dataset_dir(dataset_id: str, *, data_root: str | Path | None = None) -> Path:
|
|
22
|
+
"""Return the indexed dataset path, using its exact ID or unique name."""
|
|
23
|
+
return catalog_path("datasets", dataset_id, resolve_config(data_root=data_root))
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def get_model_path(model_id: str, *, data_root: str | Path | None = None) -> Path:
|
|
27
|
+
"""Return the indexed model file or bundle path by exact ID or unique name."""
|
|
28
|
+
return catalog_path("models", model_id, resolve_config(data_root=data_root))
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def evaluate_model(
|
|
32
|
+
model: str | ModelSpec,
|
|
33
|
+
hardware: HardwareProfile | None = None,
|
|
34
|
+
*,
|
|
35
|
+
params: int | None = None,
|
|
36
|
+
active_params: int | None = None,
|
|
37
|
+
task: str = "",
|
|
38
|
+
max_context: int = 8192,
|
|
39
|
+
) -> QuantTier:
|
|
40
|
+
"""Estimate fit for a model ID or an explicit model specification."""
|
|
41
|
+
if isinstance(model, str):
|
|
42
|
+
total, active = parse_parameters(model)
|
|
43
|
+
# An explicit total for a dense model also controls active parameters by default.
|
|
44
|
+
inferred_active = active if active != total or params is None else params
|
|
45
|
+
model = ModelSpec(model, params or total, active_params or inferred_active, task)
|
|
46
|
+
return score_model(model, hardware or detect_hardware(), max_context)
|