Description
Support for Kaggle Notebooks
Invocation
- CLI:
gitingest https://www.kaggle.com/code/USER-NAME/NOTEBOOK-NAME
- PyPI package:
ingest("https://www.kaggle.com/code/USER-NAME/NOTEBOOK-NAME")
Implementation
-
Detect the
kaggle.com/code/
host and route to a Kaggle downloader. -
Wrap the Kaggle CLI command:
kaggle kernels get --path PATH USER-NAME/NOTEBOOK-NAME
Private Kaggle Notebooks
Follow the Kaggle API instructions to create a Kaggle API token.
Options
-
Save the
kaggle.json
file containing the token in the default path (~/.kaggle/kaggle.json
orC:\Users\<username>\.kaggle\kaggle.json
). -
Export the username and token as environment variables:
export KAGGLE_USERNAME=USER-NAME export KAGGLE_KEY=TOKEN
-
Specify the token per run
-
PyPI package:
token="TOKEN"
(iningest
/ingest_async
) -
CLI:
--token TOKEN
-
Web UI: tick Private Repository and paste the token in the Private Access Token field.
Note: Option 3 temporarily overrides any local
KAGGLE_USERNAME
/KAGGLE_KEY
environment variables.Update: Kaggle CLI requires
KAGGLE_USERNAME
+KAGGLE_KEY
even for public notebooks. Therefore, option 3 would require to allow the user to, in some way, enter their username. -
Notebook outputs
- Cell outputs are never downloaded by the Kaggle API.