Skip to main content

Access Kaggle resources anywhere

Project description

Kaggle Hub Client Library

Installation

Install the kagglehub package with pip:

pip install kagglehub

Usage

Authenticate

Authenticating is only needed to access public resources requiring user consent or private resources.

First, you will need a Kaggle account. You can sign up here.

After login in, you can download your Kaggle API credentials at https://www.kaggle.com/settings by clicking on the "Create New Token" button under the "API" section.

You have 3 different options to authenticate

Option 1: Calling kagglehub.login()

# TODO(b/305808471): Not yet implemented.
kagglehub.login()

Option 2: Read credentials from environment variables

You can also choose to export your Kaggle username and token to the environment:

export KAGGLE_USERNAME=datadinosaur
export KAGGLE_KEY=xxxxxxxxxxxxxx

Option 3: Read credentials from kaggle.json

Store your kaggle.json credentials file at ~/.kaggle/kaggle.json.

Alternatively, you can set the KAGGLE_CONFIG_DIR environment variable to change this location to $KAGGLE_CONFIG_DIR/kaggle.json.

Note for Windows users: The default directory is %HOMEPATH%/kaggle.json.

Download Model

# TODO(b/305947384) Not yet implemented
kagglehub.model_download(...)

Development

Prequisites

We use hatch to manage this project.

Follow these instructions to install it.

Tests

# Run all tests
hatch run test

# Run a single test file
hatch run test tests/test_<SOME_FILE>.py

Lint / Format

# Lint check
hatch run lint:style
hatch run lint:typing
hatch run lint:all     # for both

# Format
hatch run lint:fmt

Coverage report

hatch cov

Build

hatch build

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kagglehub-0.0.1a1.tar.gz (16.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

kagglehub-0.0.1a1-py3-none-any.whl (16.5 kB view details)

Uploaded Python 3

File details

Details for the file kagglehub-0.0.1a1.tar.gz.

File metadata

  • Download URL: kagglehub-0.0.1a1.tar.gz
  • Upload date:
  • Size: 16.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for kagglehub-0.0.1a1.tar.gz
Algorithm Hash digest
SHA256 4afbf676958c0c8426906e99693154bb97a107279d751d63bdba6a40b27b462d
MD5 680bd484f52d36692bc58306b988ce60
BLAKE2b-256 8e932b5f80b898b0ed33647c29b8eef4b17fdbfad9780bf7cc53fe3be7d4563b

See more details on using hashes here.

File details

Details for the file kagglehub-0.0.1a1-py3-none-any.whl.

File metadata

  • Download URL: kagglehub-0.0.1a1-py3-none-any.whl
  • Upload date:
  • Size: 16.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.5

File hashes

Hashes for kagglehub-0.0.1a1-py3-none-any.whl
Algorithm Hash digest
SHA256 a193927d43bcc178c53f2942881a8032b7bef090effea5ae6b9c38c6db3bf289
MD5 976fb67ba67f46247419b624f9aa84c7
BLAKE2b-256 fe2ee651a923cde2c1cd62e764f1af11131e2c70866f2b588c25b29726369744

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page