LinuxCommandLibrary

kaggle-competitions

List Kaggle competitions

TLDR

List all competitions

$ kaggle [[c|competitions]] list
copy

Download competition data
$ kaggle [[c|competitions]] download [competition_name]
copy

Download specific file
$ kaggle [[c|competitions]] download [competition_name] [[-f|--file]] [file]
copy

Submit files to a competition
$ kaggle [[c|competitions]] submit [competition_name] [[-f|--file]] [path/to/file] [[-m|--message]] "[message]"
copy

Show or download leaderboard
$ kaggle [[c|competitions]] leaderboard [competition_name] [--show|--download]
copy

View submissions
$ kaggle [[c|competitions]] submissions [competition_name]
copy

SYNOPSIS

kaggle competitions list [-s KEYWORD] [-p PAGE_NUMBER] [-o]
kaggle competitions files -c NAME
kaggle competitions download -c NAME [-f FILENAME] [-p PATH] [-a] [-F]
kaggle competitions submit -c NAME -f FILE -m MESSAGE
kaggle competitions submissions -c NAME [-p PAGE_NUMBER]
kaggle competitions leaderboard -c NAME [-s KEYWORD] [-u USERNAME]

PARAMETERS

list
    Lists available Kaggle competitions.

list -s KEYWORD, --search KEYWORD
    Searches for competitions matching the specified keyword.

list -p PAGE_NUMBER, --page PAGE_NUMBER
    Displays a specific page of competition results.

list -o, --old
    Includes older, inactive competitions in the list.

files -c NAME, --competition NAME
    Lists all data files associated with the specified competition.

download -c NAME, --competition NAME
    Downloads all data files for the specified competition.

download -f FILENAME, --file FILENAME
    Downloads a specific file from the competition.

download -p PATH, --path PATH
    Specifies the local directory to download files to. Defaults to the current directory.

download -a, --all
    Downloads all competition files (redundant with default behavior if no -f is specified).

download -F, --force
    Overwrites existing files during download without prompting.

submit -c NAME, --competition NAME
    Specifies the competition to submit to.

submit -f FILE, --file FILE
    Specifies the path to your submission file.

submit -m MESSAGE, --message MESSAGE
    Provides a descriptive message for your submission.

submissions -c NAME, --competition NAME
    Lists your past submissions for the specified competition.

submissions -p PAGE_NUMBER, --page PAGE_NUMBER
    Displays a specific page of your submission history.

leaderboard -c NAME, --competition NAME
    Displays the current leaderboard for the specified competition.

leaderboard -s KEYWORD, --search KEYWORD
    Searches the leaderboard by user or team name.

leaderboard -u USERNAME, --user USERNAME
    Filters the leaderboard to show results for a specific username.

DESCRIPTION

The kaggle competitions command is a crucial component of the Kaggle Command Line Interface (CLI), providing a direct way to interact with Kaggle competition data and participate in competitions without leaving your terminal. It allows users to browse available competitions, inspect their details, list and download competition datasets, make submissions, track submission history, and view leaderboards. This tool streamlines the workflow for data scientists, enabling automation of common tasks and integration with scripting environments. It relies on the Kaggle API, requiring an API token for authentication, which must be configured beforehand. The command significantly enhances productivity by allowing programmatic access to competition-related tasks.

CAVEATS

The kaggle competitions command requires a Kaggle API token for authentication, which must be configured in `~/.kaggle/kaggle.json`. Users must accept competition rules and terms on the Kaggle website before attempting to download data or make submissions, as this cannot be done through the CLI. Downloads of large datasets may consume significant bandwidth and time.

<B>AUTHENTICATION SETUP</B>

To use the Kaggle CLI, you must generate an API token from your Kaggle account settings (Profile -> Account -> Create New API Token). This token is downloaded as `kaggle.json` and should be moved to `~/.kaggle/kaggle.json` on Linux/macOS or `C:\Users\\.kaggle\kaggle.json` on Windows. Ensure this file has appropriate read-only permissions for security.

<B>COMPETITION RULES ACCEPTANCE</B>

Before downloading competition data or submitting solutions, Kaggle often requires users to manually accept the competition's specific rules and terms of service. This acceptance process currently occurs only through the Kaggle website, not via the CLI. Attempting to download or submit without prior acceptance will result in an error.

HISTORY

The Kaggle API and its corresponding CLI client were developed by Kaggle to enable programmatic interaction with the platform. The kaggle competitions subcommand has been a foundational part of the CLI since its initial release, evolving with the Kaggle platform to support new competition features, data types, and submission mechanisms. This continuous development has significantly enhanced the automation and scripting capabilities for data scientists participating in Kaggle competitions.

SEE ALSO

kaggle(1), kaggle datasets(1), kaggle kernels(1), kaggle models(1)

Copied to clipboard