Quickstart
==========

This guide gets you to a first dataset fetch in under a minute, then
shows the local index and the HuggingFace flow.

Install
-------

.. code-block:: bash

    pip install scitex-dataset
    # Optional extras:
    pip install "scitex-dataset[huggingface]"   # HF Hub access
    pip install "scitex-dataset[mcp]"           # MCP server

Python API
----------

The package exposes per-source ``<src>_fetch`` aliases plus a unified
``filter_results`` helper. Every alias has a matching MCP tool of the
same name (under the ``dataset`` namespace).

.. code-block:: python

    from scitex_dataset import (
        openneuro_fetch, dandi_fetch, huggingface_search,
        filter_results, list_sources,
        db_build, db_search,
    )

    # 1) Fetch from a catalog source.
    records = openneuro_fetch(max_datasets=200)

    # 2) Filter + rank in memory.
    top = filter_results(
        records, modality="eeg", min_subjects=20,
        sort_by="downloads", limit=10,
    )

    # 3) Search HuggingFace Hub directly.
    hf_hits = huggingface_search("biology", limit=20)

    # 4) Build the full-text dataset index in the shared SciTeX store.
    db_build()
    db_search("Alzheimer EEG")

    # 5) Inspect the supported sources.
    list_sources()["count"]   # 11

CLI
---

The CLI uses the SciTeX 3-level grammar
``scitex-dataset <domain> <dataset> <action>``:

.. code-block:: bash

    # Catalog fetch
    scitex-dataset neuroscience openneuro fetch -n 50 -o openneuro.json
    scitex-dataset general zenodo fetch -q "neuroscience" -n 20

    # HuggingFace
    scitex-dataset general huggingface fetch Anthropic/BioMysteryBench-full
    scitex-dataset general huggingface search "biology" -n 10 --json

    # Local index
    scitex-dataset db build
    scitex-dataset db search "Alzheimer EEG"
    scitex-dataset db show-stats

See :doc:`cli_reference` for the full subtree, or run
``scitex-dataset --help-recursive``.

Configuration
-------------

The Python config resolver supports explicit paths, environment overrides,
project scope and user scope. The CLI's advertised ``--config`` option is
not currently registered, and catalog commands do not load these settings.
Use command-specific flags; see :doc:`cli_reference` for the resolver's
precedence and this unresolved integration gap.

Runtime artifacts (snapshots, caches, logs) live under
``<scope-root>/runtime/``. The dataset index does not — it lives in the
shared SciTeX store, so every host reads one catalogue instead of each
keeping a private copy. ``scitex-dataset db show-stats`` names the store
it resolved to.

Next steps
----------

- :doc:`cli_reference` — full CLI grammar and per-action flags.
- :doc:`sources` — every supported repository.
- :doc:`api/scitex_dataset` — generated Python API reference.
