Package: kkt
kktkkt is a tool for kaggle kernel management.FeatureShow the status of the latest versionPush your script or notebook to the Kaggle KernelsPack and emmbedded your library codes into the generated bootstrap codesCreate a dataset containing your dependent packagesAdd bootstrap codes into the head of your script or notebook automaticallyAdd git tags whose name is corresponding kernel versionSet environment variable for your kernelsInstallationFor now, kkt is designed to be used with poetry. So kkt can be installed by the following.$poetryaddkkt--devUsageSet username and token of kaggle-apiPlease setup your kaggle-api credentials as following thisarticleSetup kkt in your projectSetup this project fordigit-recognizer competition.
In this configuration, we use script.py. If you want to use notebook, kkt also support it.$poetryrunkktinit
AppendingKktsectionintoyourpyproject.tomlconfig.
competition:digit0digit-recognizer
>0slug:kkt-example
code_file[script.py]:script.py
kernel_type[script]:script
is_private[Y/n]:n
enable_gpu[y/N]:n
enable_internet[y/N]:y
Wouldyouliketoadddatasetsources?[y/N]:n
enable_git_tag[y/N]:nCreate kkt_example package and its driver code.kkt_example provides random choice solver for digit-recognizer competition.$tree
.
├──kkt_example
│└──__init__.py
├──poetry.lock
├──pyproject.toml
└──script.py1directory,4filesinit.pyfrompathlibimportPathimportrandomimportpandasaspddefchoice():returnrandom.randint(0,9)defload_sample_submission():path=Path("..")/"input"/"digit-recognizer"/"sample_submission.csv"returnpd.read_csv(path,index_col="ImageId")script.pyimportkkt_examplesubmission=kkt_example.load_sample_submission()for_,rowinsubmission.iterrows():row["Label"]=kkt_example.choice()submission.to_csv("submission.csv")pyproject.toml[tool.poetry]name="kkt-example"version="0.1.0"description=""authors=["Masahiro Wada <argon.argon.argon@gmail.com>"][tool.poetry.dependencies]python="^3.7"pandas="^1.0.0"[tool.poetry.dev-dependencies]kkt="^0.3.1"[tool.kkt]enable_git_tag=false[tool.kkt.meta_data]code_file="script.py"competition="digit-recognizer"competition_sources=["digit-recognizer"]dataset_sources=[]enable_gpu=falseenable_internet=trueis_private=falsekernel_type="script"slug="kkt-example"[build-system]requires=["poetry>=0.12"]build-backend="poetry.masonry.api"If you want run script.py in local environmet, please run the following.$poetryrunpythonscript.py
$headsubmission.csv
ImageId,Label1,12,13,04,25,46,87,58,39,2Create a dataset containing dependent packages if needIn this example, there aren't extra required packages. Sokkt installdisplays the following. And this step is not mandatory.$poetryrunkktinstall
ref:/ar90ngas/kkt-example-install
url:https://www.kaggle.com/ar90ngas/kkt-example-install
version:1Pushinginstallkernelsuccessed.
Waitforinstallkernelcompletion...
Waitforinstallkernelcompletion...
Waitforinstallkernelcompletion...
Extrarequiredpackagesarenothing.But in the little complicated project such as mnist_efficientnet example,kkt installdisplays the following. This means that a new dataset whose slug isar90ngas/mnist-efficientnet-requirementsis created. And it contains an extra package which is required by this example. And this package will be installed automatically in the bootstrap code.$poetryrunkktinstall
ref:/ar90ngas/mnist-efficientnet-install
url:https://www.kaggle.com/ar90ngas/mnist-efficientnet-install
version:1Pushinginstallkernelsuccessed.
Waitforinstallkernelcompletion...
Waitforinstallkernelcompletion...
Waitforinstallkernelcompletion...
Outputfiledownloadedto/tmp/tmpq6m9iq9p/timm-0.1.30-py3-none-any.whl
Startinguploadforfiletimm-0.1.30-py3-none-any.whl100%|█████████████████████████████████████████████████████████|203k/203k[00:03<00:00,53.7kB/s]Uploadsuccessful:timm-0.1.30-py3-none-any.whl(203KB)ref:ar90ngas/mnist-efficientnet-requirements
url:https://www.kaggle.com/ar90ngas/mnist-efficientnet-requirementsPush notebook to Kaggle Kernels$poetryrunkktpush
ref:/ar90ngas/kkt-example
url:https://www.kaggle.com/ar90ngas/kkt-example
version:1Please visitthe result.Show the status$poetryrunkktstatus
status:completeConfigurationPlease seeexamplesLicenseThis software is released under the Apache License, seeLICENSE.