Skip to content

Migrate Kaggle authentication to API token and add dataset source - #869

Merged
cristian-tamblay merged 4 commits into
developfrom
feat/kaggle-dataset-source
Sep 10, 2026
Merged

Migrate Kaggle authentication to API token and add dataset source#869
cristian-tamblay merged 4 commits into
developfrom
feat/kaggle-dataset-source

Conversation

@Irozuku

@Irozuku Irozuku commented Sep 7, 2026

Copy link
Copy Markdown
Collaborator

Summary

Updated the Kaggle credential to authenticate with the modern kaggle 2.x API access token (KAGGLE_API_TOKEN, e.g. KGAT_...) instead of the legacy username:key pair, and added a new KaggleDatasetSource so users can search, preview, and download Kaggle datasets directly in dashAI.


Type of Change

Check all that apply like this [x]:

  • Backend change
  • Frontend change
  • CI / Workflow change
  • Build / Packaging change
  • Bug fix
  • Documentation

Changes (by file)

  • DashAI/back/credentials/kaggle_credential.py: migrated KaggleCredential to a single Kaggle API access token. verify() now authenticates with kaggle 2.x and only accepts a token that authenticates via the ACCESS_TOKEN method; apply() exports KAGGLE_API_TOKEN and re authenticates the module level kaggle.api instance when it was already imported.
  • tests/back/credentials/test_concrete_credentials.py: updated the fake_kaggle stub for the token flow and added tests for successful/failed/expired/empty token verification and apply().
  • DashAI/back/dataset_sources/kaggle_dataset_source.py: new KaggleDatasetSource(BaseDatasetSource) using the official kaggle library (kaggle 2.x). Implements search() (with pagination via Kaggle page tokens), get_info() (description, keywords, total size), and download_dataset() (downloads and unzips into the target path). Public datasets work anonymously; the optional KaggleCredential is applied when downloading for private/consent gated datasets. Suppresses kaggle's import time auth help output.
  • tests/back/dataset_sources/test_kaggle_dataset_source.py: new tests covering search mapping and pagination, get_info enrichment and error handling, and download_dataset.
  • DashAI/back/initial_components.py: registered KaggleDatasetSource so it appears automatically in the DatasetSource registry (frontend Hub discovers sources from the registry, so no frontend changes were needed).

Testing (optional)

  • Authenticate with Kaggle: open the Credentials section and save a Kaggle credential using an API access token (generate at https://www.kaggle.com/settings/api). Confirming the credential should succeed; an invalid/expired token should be rejected.
  • Verify the search works: open the Hub and switch to the Kaggle source. Searching should return dataset results with title, tags, and size, and pagination should advance on subsequent pages.
  • Download a datafile: pick a dataset from the Kaggle source and download/import it. The files should be fetched and the dataset should load into DashAI (e.g. uciml/iris).
  • Optional credential path: confirm public datasets still search and download when no Kaggle credential is stored.

Notes (optional)

  • Previously stored legacy username:key Kaggle credentials will fail verification with the new format and must be regenerated as access tokens from https://www.kaggle.com/settings/api. Backwards compatibility is not handled.

Update KaggleCredential to authenticate with a single KAGGLE_API_TOKEN
instead of the legacy username:key pair. verify() requires the token to
authenticate via the ACCESS_TOKEN method, and apply() re authenticates
the module level kaggle.api instance when it was already imported.
Add KaggleDatasetSource inheriting from BaseDatasetSource, exposing
search, get_info and download_dataset through the official kaggle
library (kaggle 2.x). Public datasets work anonymously; an optional
KaggleCredential is applied when downloading. Register it as a
DatasetSource component on startup.
@Irozuku Irozuku added enhancement New feature or request back Backend work labels Sep 7, 2026
@cristian-tamblay cristian-tamblay mentioned this pull request Sep 9, 2026
6 tasks
Kaggle ignores page_size and never fills next_page_token, so the search
returned twenty rows whatever was asked and its cursor was always None:
the Hub could never load a second page. The page parameter does work, so
the cursor is now the page number as a string, the way the Zenodo source
already does it, and a page shorter than Kaggle's fixed size is read as
the last one. Entries are not trimmed to the requested limit, because the
next page starts where this one ended and a trimmed row is never served
again.

The credential and the source rely on the kaggle 2.x token API, which the
old ">=1.7.4.5" floor did not guarantee. With Python 3.10 gone the lock
already resolves 2.2.4 everywhere; the pin makes the requirement explicit.
@cristian-tamblay
cristian-tamblay merged commit 782a758 into develop Sep 10, 2026
18 checks passed
@cristian-tamblay
cristian-tamblay deleted the feat/kaggle-dataset-source branch September 10, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

back Backend work enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants