
Picture by Creator
The Kaggle CLI (Command Line Interface) means that you can work together with Kaggle’s datasets, competitions, notebooks, and fashions straight out of your terminal. That is helpful for automating downloads, submissions, and dataset administration without having an internet browser. Most of my GitHub Motion workflows use Kaggle CLI for downloading or pushing datasets, as it’s the quickest and best approach.
1. Set up & Setup
Ensure you have Python 3.10+ put in. Then, run the next command in your terminal to put in the official Kaggle API:
To acquire your Kaggle credentials, obtain the kaggle.json file out of your Kaggle account settings by clicking “Create New Token.”
Subsequent, set the setting variables in your native system:
- KAGGLE_USERNAME=
- KAGGLE_API_KEY=
- KAGGLE_API_KEY=
2. Competitions
Kaggle Competitions are hosted challenges the place you may resolve machine studying issues, obtain information, submit predictions, and see your outcomes on the leaderboard.
The CLI helps you automate every little thing: shopping competitions, downloading information, submitting options, and extra.
Record Competitions
kaggle competitions listing -s
Reveals an inventory of Kaggle competitions, optionally filtered by a search time period. Helpful for locating new challenges to hitch.
Record Competitors Information
kaggle competitions information
Shows all information out there for a particular competitors, so you understand what information is supplied.
Obtain Competitors Information
kaggle competitions obtain [-f ] [-p ]
Downloads all or particular information from a contest to your native machine. Use -f to specify a file, -p to set the obtain folder.
Undergo a Competitors
kaggle competitions submit -f -m ""
Add your answer file to a contest with an elective message describing your submission.
Record Your Submissions
kaggle competitions submissions
Reveals all of your earlier submissions for a contest, together with scores and timestamps.
View Leaderboard
kaggle competitions leaderboard [-s]
Shows the present leaderboard for a contest. Use -s to indicate solely the highest entries.
3. Datasets
Kaggle Datasets are collections of information shared by the group. The dataset CLI instructions aid you discover, obtain, and add datasets, in addition to handle dataset variations.
Record Datasets
Finds datasets on Kaggle, optionally filtered by a search time period. Nice for locating information in your tasks.
Record Information in a Dataset
Reveals all information included in a particular dataset, so you may see what’s out there earlier than downloading.
Obtain Dataset Information
kaggle datasets obtain / [-f ] [--unzip]
Downloads all or particular information from a dataset. Use –unzip to mechanically extract zipped information.
Initialize Dataset Metadata
Creates a metadata file in a folder, getting ready it for dataset creation or versioning.
Create a New Dataset
kaggle datasets create -p
Uploads a brand new dataset from a folder containing your information and metadata.
Create a New Dataset Model
kaggle datasets model -p -m ""
Uploads a brand new model of an present dataset, with a message describing the adjustments.
4. Notebooks
Kaggle Notebooks are executable code snippets or notebooks. The CLI means that you can listing, obtain, add, and verify the standing of those notebooks, which is helpful for sharing or automating evaluation.
Record Kernels
Finds public Kaggle notebooks (kernels) matching your search time period.
Get Kernel Code
Downloads the code for a particular kernel to your native machine.
Initialize Kernel Metadata
Creates a metadata file in a folder, getting ready it for kernel creation or updates.
Replace Kernel
Uploads new code and runs the kernel, updating it on Kaggle.
Get Kernel Output
kaggle kernels output / -p
Downloads the output information generated by a kernel run.
Verify Kernel Standing
Reveals the present standing (e.g., working, full, failed) of a kernel.
5. Fashions
Kaggle Fashions are versioned machine studying fashions you may share, reuse, or deploy. The CLI helps handle these fashions, from itemizing and downloading to creating and updating them.
Record Fashions
Finds public fashions on Kaggle matching your search time period.
Get a Mannequin
Downloads a mannequin and its metadata to your native machine.
Initialize Mannequin Metadata
Creates a metadata file in a folder, getting ready it for mannequin creation.
Create a New Mannequin
Uploads a brand new mannequin to Kaggle out of your native folder.
Replace a Mannequin
Uploads a brand new model of an present mannequin.
Delete a Mannequin
Removes a mannequin from Kaggle.
6. Config
Kaggle CLI configuration instructions management default behaviors, akin to obtain areas and your default competitors. Alter these settings to make your workflow smoother.
View Config
Shows your present Kaggle CLI configuration settings (e.g., default competitors, obtain path).
Set Config
Units a configuration worth, akin to default competitors or obtain path.
Unset Config
Removes a configuration worth, reverting to default habits.
7. Ideas
- Use -h or –help after any command for detailed choices and utilization
- Use -v for CSV output, -q for quiet mode
- You will need to settle for competitors guidelines on the Kaggle web site earlier than downloading or submitting to competitions
Abid Ali Awan (@1abidaliawan) is an authorized information scientist skilled who loves constructing machine studying fashions. Presently, he’s specializing in content material creation and writing technical blogs on machine studying and information science applied sciences. Abid holds a Grasp’s diploma in expertise administration and a bachelor’s diploma in telecommunication engineering. His imaginative and prescient is to construct an AI product utilizing a graph neural community for college kids scuffling with psychological sickness.