Skip to content

Kaggle/kaggle-api

Kaggle API

The official CLI to interact with Kaggle.


User documentation


Key Features

Some of the key features are:

  • List competitions, download competition data, submit to a competion.
  • List, create, update, download or delete datasets.
  • List, create, update, download or delete models & model variations.
  • List, update & run, download code & output or delete kernels (notebooks).

Installation

Install the kaggle package with pip:

pip install kaggle

Additional installation instructions can be found here.

Quick start

Explore the available commands by running:

kaggle --help

See the User documentation for more examples & tutorials.

Development

Prerequisites

We use hatch to manage this project.

Follow these instructions to install it.

Run kaggle from source

Option 1: Execute a one-liner of code from the command line

hatch run kaggle datasets list

Option 2: Run many commands in a shell

hatch shell

# Inside the shell, you can run many commands
kaggle datasets list
kaggle competitions list
...

Lint / Format

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

# Format
hatch run lint:fmt

Tests

Note: These tests are not true unit tests and are calling the Kaggle web server.

# Run against kaggle.com
hatch run test:prod

# Run against a local web server (Kaggle engineers only)
hatch run test:local

Integration Tests

To run integration tests on your local machine, you need to set up your Kaggle API credentials. You can do this in one of these two ways described this doc. Refer to the sections:

  • Using environment variables
  • Using credentials file

After setting up your credentials by any of these methods, you can run the integration tests as follows:

hatch run test:integration

Changelog

See CHANGELOG.

Contributing

See CONTRIBUTING.md.

License

The Kaggle API is released under the Apache 2.0 license.

About

Official Kaggle API

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

No packages published

Contributors 48

Languages