Skip to main content

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 Kaggle
  • scripts/setup-credentials.sh — credential setup script
  • .gitignore entries 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] [OPTIONS]

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

Validate kernel-metadata.json.

Option Description
--directory Directory containing kernel-metadata.json (default: .)

kaggle-notebook-deploy push

Push a notebook to Kaggle (internally runs kaggle kernels push).

Option Description
--skip-validate Skip validation
--dry-run Print the command without executing
--wait Poll after push until kernel completes; on ERROR prints kernel diagnostics automatically

Notes

Code competition constraints

  • enable_internet: false is required (setting it to true disables submission)
  • API-based submit is not available — browser submit is required
  • kaggle kernels push resets 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

Metadata

Release files for kaggle-notebook-deploy 0.1.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kaggle-notebook-deploy 0.1.5
File Size Uploaded
kaggle_notebook_deploy-0.1.5.tar.gz 16.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kaggle-notebook-deploy 0.1.5
File Interpreter ABI Platform
kaggle_notebook_deploy-0.1.5-py3-none-any.whl Python 3 none any Details

Total release size: 30.6 kB

Release files / kaggle_notebook_deploy-0.1.5.tar.gz

Download URL kaggle_notebook_deploy-0.1.5.tar.gz
Size 16.1 kB
Tags Source
SHA-256 checksum
How to use checksums
611ef02d429a0c0ad531cd20f3105073e24658e325d4089f195cd5d9dc1376b1
BLAKE2b-256 checksum
How to use checksums
f539ac3d8816f3eb2f50aafd5fbd7c558678ac6a2998f089fbb14a874532dc0b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.

Transparency log

Release files / kaggle_notebook_deploy-0.1.5-py3-none-any.whl

Download URL kaggle_notebook_deploy-0.1.5-py3-none-any.whl
Size 14.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0865e75c71c576d0dbb648cd54c30b7cdaeb738f563f2bc65ce0e0da48c4f27f
BLAKE2b-256 checksum
How to use checksums
951394037c520dc47cc142a3acba243a33871b7df8814dd168e112060c2c8e75
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 7, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.5 This release

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page