Skip to main content

A tool for kaggle kernel

Project description


kkt is a tool for kaggle kernel management.

Actions Status PyPI PythonVersions


  • Show the status of the latest version
  • Push your script or notebook to the Kaggle Kernels
  • Pack and emmbedded your library codes into the generated bootstrap codes
  • Create a dataset containing your dependent packages
  • Add bootstrap codes into the head of your script or notebook automatically
  • Add git tags whose name is corresponding kernel version
  • Set environment variable for your kernels


For now, kkt is designed to be used with poetry. So kkt can be installed by the following.

$ poetry add kkt --dev


Set username and token of kaggle-api

Please setup your kaggle-api credentials as following this article

Setup kkt in your project

Setup this project for digit-recognizer competition. In this configuration, we use If you want to use notebook, kkt also support it.

$ poetry run kkt init
Appending Kkt section into your pyproject.toml config.
competition: digit
0 digit-recognizer
> 0
slug: kkt-example
code_file []:
kernel_type [script]: script
is_private [Y/n]: n
enable_gpu [y/N]: n
enable_internet [y/N]: y
Would you like to add dataset sources? [y/N]: n
enable_git_tag [y/N]: n

Create kkt_example package and its driver code.

kkt_example provides random choice solver for digit-recognizer competition.

$ tree
├── kkt_example
│   └──
├── poetry.lock
├── pyproject.toml

1 directory, 4 files

from pathlib import Path
import random

import pandas as pd

def choice():
    return random.randint(0, 9)

def load_sample_submission():
    path = Path("..") / "input" / "digit-recognizer" / "sample_submission.csv"
    return pd.read_csv(path,  index_col="ImageId")

import kkt_example

submission = kkt_example.load_sample_submission()
for _, row in submission.iterrows():
    row["Label"] = kkt_example.choice()



name = "kkt-example"
version = "0.1.0"
description = ""
authors = ["Masahiro Wada <>"]

python = "^3.7"
pandas = "^1.0.0"

kkt = "^0.3.1"

enable_git_tag = false

code_file = ""
competition = "digit-recognizer"
competition_sources = ["digit-recognizer"]
dataset_sources = []
enable_gpu = false
enable_internet = true
is_private = false
kernel_type = "script"
slug = "kkt-example"

requires = ["poetry>=0.12"]
build-backend = "poetry.masonry.api"

If you want run in local environmet, please run the following.

$ poetry run python
$ head submission.csv

Create a dataset containing dependent packages if need

In this example, there aren't extra required packages. So kkt install displays the following. And this step is not mandatory.

$ poetry run kkt install
ref: /ar90ngas/kkt-example-install
version: 1
Pushing install kernel successed.
Wait for install kernel completion...
Wait for install kernel completion...
Wait for install kernel completion...
Extra required packages are nothing.

But in the little complicated project such as mnist_efficientnet example, kkt install displays the following. This means that a new dataset whose slug is ar90ngas/mnist-efficientnet-requirements is created. And it contains an extra package which is required by this example. And this package will be installed automatically in the bootstrap code.

$ poetry run kkt install
ref: /ar90ngas/mnist-efficientnet-install
version: 1
Pushing install kernel successed.
Wait for install kernel completion...
Wait for install kernel completion...
Wait for install kernel completion...
Output file downloaded to /tmp/tmpq6m9iq9p/timm-0.1.30-py3-none-any.whl
Starting upload for file timm-0.1.30-py3-none-any.whl
100%|█████████████████████████████████████████████████████████| 203k/203k [00:03<00:00, 53.7kB/s]
Upload successful: timm-0.1.30-py3-none-any.whl (203KB)
ref: ar90ngas/mnist-efficientnet-requirements

Push notebook to Kaggle Kernels

$ poetry run kkt push
ref: /ar90ngas/kkt-example
version: 1

Please visit the result.

Show the status

$ poetry run kkt status
status: complete


Please see examples


This software is released under the Apache License, see LICENSE.

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

kkt-0.3.9.tar.gz (21.9 kB view hashes)

Uploaded source

Built Distribution

kkt-0.3.9-py3-none-any.whl (30.1 kB view hashes)

Uploaded py3

Supported by

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