A CLI tool to deploy Kaggle Notebooks with git push via GitHub Actions
Project description
kaggle-notebook-deploy
A CLI tool to deploy Kaggle Notebooks by simply running git push.
Manage your Kaggle Notebook code on GitHub and set up an automated deployment workflow via GitHub Actions.
Workflow
Edit notebook → git push → GitHub Actions → Upload to Kaggle → Submit in browser
Installation
pip install kaggle-notebook-deploy
Quick Start
1. Set up repository
# Generate GitHub Actions workflow and .gitignore
kaggle-notebook-deploy init-repo
Generated files:
.github/workflows/kaggle-push.yml— workflow for pushing to Kagglescripts/setup-credentials.sh— credential setup script.gitignoreentries for Kaggle-related files
2. Set GitHub Secrets
gh secret set KAGGLE_USERNAME
gh secret set KAGGLE_KEY
3. Create a competition directory
# Basic
kaggle-notebook-deploy init titanic
# GPU-enabled, public notebook
kaggle-notebook-deploy init march-machine-learning-mania-2026 --gpu --public
Generated files:
<slug>/kernel-metadata.json— Kaggle kernel metadata<slug>/<slug>-baseline.ipynb— baseline notebook
4. Develop and deploy
# Edit the notebook
vim titanic/titanic-baseline.ipynb
# Validate
kaggle-notebook-deploy validate titanic
# Push directly from local
kaggle-notebook-deploy push titanic
# Or via GitHub Actions
git add titanic/ && git commit -m "Add titanic baseline" && git push
gh workflow run kaggle-push.yml -f notebook_dir=titanic
Commands
kaggle-notebook-deploy init <competition-slug>
Generate a competition directory from a template.
| Option | Description |
|---|---|
-u, --username |
Kaggle username (default: read from ~/.kaggle/kaggle.json) |
-t, --title |
Notebook title (default: auto-generated from slug) |
--gpu |
Enable GPU |
--internet |
Enable internet (not recommended for code competitions) |
--public |
Create as public notebook |
kaggle-notebook-deploy init-repo
Set up GitHub Actions workflow and related files.
| Option | Description |
|---|---|
-f, --force |
Overwrite existing files |
kaggle-notebook-deploy validate [directory]
Validate kernel-metadata.json.
Checks:
- Required fields exist
idformat isusername/slugcode_fileexists on disk- Valid values for
languageandkernel_type - Consistency between
enable_internetandcompetition_sources
kaggle-notebook-deploy push [directory]
Push a notebook to Kaggle (internally runs kaggle kernels push).
| Option | Description |
|---|---|
--skip-validate |
Skip validation |
--dry-run |
Print the command without executing |
Notes
Code competition constraints
enable_internet: falseis required (setting it totruedisables submission)- API-based submit is not available — browser submit is required
kaggle kernels pushresets Kaggle Secrets bindings; re-attach W&B keys etc. via the web UI after each push
Data path differences
| Source | Mount path |
|---|---|
competition_sources |
/kaggle/input/competitions/<slug>/ |
dataset_sources |
/kaggle/input/<slug>/ |
Note that competition_sources data is mounted under competitions/ subdirectory, not directly under /kaggle/input/. Hardcoding /kaggle/input/<slug>/ will cause FileNotFoundError.
Recommended pattern — auto-detect the data directory in your notebook:
from pathlib import Path
INPUT_ROOT = Path('/kaggle/input')
# Find actual data location instead of hardcoding the path
DATA_DIR = None
for p in INPUT_ROOT.rglob('your-expected-file.csv'):
DATA_DIR = p.parent
break
if DATA_DIR is None:
# Print structure for debugging
for p in sorted(INPUT_ROOT.iterdir()):
print(f' {p.name}/')
for sub in sorted(p.iterdir())[:5]:
print(f' {sub.name}')
raise FileNotFoundError('Data directory not found.')
NaN handling for missing feature columns
When building features, some columns may be entirely NaN (e.g., a ranking system not available for Women's tournaments). fillna(median) does not help when the median itself is NaN. Always chain a fallback:
X = df[feat_cols].fillna(df[feat_cols].median()).fillna(0)
License
MIT
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kaggle_notebook_deploy-0.1.4.tar.gz.
File metadata
- Download URL: kaggle_notebook_deploy-0.1.4.tar.gz
- Upload date:
- Size: 15.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1f28f56424e104692f55c296ae42f459736098e8f9131245f7aa7e88d87ffbc7
|
|
| MD5 |
26ae12a193c4976b9bf5214f69b7efb9
|
|
| BLAKE2b-256 |
63698d388a85104b4ba9a25e938f38de522ba8aad9a3359fb5ebeafae011b375
|
Provenance
The following attestation bundles were made for kaggle_notebook_deploy-0.1.4.tar.gz:
Publisher:
publish.yml on yasumorishima/kaggle-notebook-deploy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kaggle_notebook_deploy-0.1.4.tar.gz -
Subject digest:
1f28f56424e104692f55c296ae42f459736098e8f9131245f7aa7e88d87ffbc7 - Sigstore transparency entry: 1020241949
- Sigstore integration time:
-
Permalink:
yasumorishima/kaggle-notebook-deploy@95da71c0d4b8a078a9a511b4642a232eeca22d1c -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/yasumorishima
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@95da71c0d4b8a078a9a511b4642a232eeca22d1c -
Trigger Event:
release
-
Statement type:
File details
Details for the file kaggle_notebook_deploy-0.1.4-py3-none-any.whl.
File metadata
- Download URL: kaggle_notebook_deploy-0.1.4-py3-none-any.whl
- Upload date:
- Size: 14.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39c098a4a6a9c8efba6049ca42a58502c4ed35f6f1a3398d7469ca30b85d5438
|
|
| MD5 |
c05e90ddbe33cbabf74d15a3c83867bb
|
|
| BLAKE2b-256 |
8926b099a2c9478db5c4fd6f464447879cf1c2bee683e428606de20ea1d2dc72
|
Provenance
The following attestation bundles were made for kaggle_notebook_deploy-0.1.4-py3-none-any.whl:
Publisher:
publish.yml on yasumorishima/kaggle-notebook-deploy
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
kaggle_notebook_deploy-0.1.4-py3-none-any.whl -
Subject digest:
39c098a4a6a9c8efba6049ca42a58502c4ed35f6f1a3398d7469ca30b85d5438 - Sigstore transparency entry: 1020242010
- Sigstore integration time:
-
Permalink:
yasumorishima/kaggle-notebook-deploy@95da71c0d4b8a078a9a511b4642a232eeca22d1c -
Branch / Tag:
refs/tags/v0.1.4 - Owner: https://github.com/yasumorishima
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@95da71c0d4b8a078a9a511b4642a232eeca22d1c -
Trigger Event:
release
-
Statement type: