shepsci/kaggle-skill / skills/kaggle
kaggle
FlaggedUnified Kaggle skill. Use when the user explicitly mentions Kaggle, kaggle.com, a Kaggle URL, Kaggle competitions, Kaggle datasets/models/notebooks, Kaggle forums/discussions/writeups, Kaggle benchmarks, hackathons hosted on Kaggle, Kaggle badges, or Kaggle account setup. Do not use for generic ML, GPU/TPU, notebook, dataset, benchmark, or data-science tasks unless the user clearly ties them to Kaggle.
modules/notebooks/scripts/notebook_run.py
View on GitHub#!/usr/bin/env python3
"""Push a notebook, wait for its run, and download the output. A dry run unless --yes.
notebook_run.py ./notebook-dir dry run
notebook_run.py ./notebook-dir --yes
notebook_run.py ./notebook-dir --out ./output --timeout 7200 --yes
The notebook's name is read from the folder's kernel-metadata.json, so the
run that is watched is the one that was pushed. Pushing starts a run on
Kaggle; with an accelerator switched on it uses the weekly GPU hours. Get the
user's go-ahead before --yes.
When the run fails, the end of its log is printed. When it is still running
at the timeout, keep waiting with the notebook-wait command.
Exit status: 0 output downloaded, 1 the push or the run failed, 2 wrong
arguments or no credential, 4 the status or the output listing could not be
read, 5 refused (a code file outside the folder or named like a credential
file, or an output file name that would escape the output folder), 124 still
running at the timeout.
"""
from __future__ import annotations
import argparse
import sys
from pathlib import Path
SCRIPT_DIR = Path(__file__).resolve().parent
SKILL_ROOT = SCRIPT_DIR.parents[2]
sys.path.insert(0, str(SKILL_ROOT))
sys.path.insert(0, str(SCRIPT_DIR))
import notebook_push # noqa: E402
import notebook_wait # noqa: E402
from shared import credentials, script # noqa: E402
def main(argv: list[str] | None = None) -> int:
parser = argparse.ArgumentParser(
description="Push a notebook, wait for its run, and download the output. A dry run "
"unless --yes.",
epilog="Starts a run on Kaggle. Needs the Kaggle CLI and a credential.",
)
parser.add_argument("dir", help="Folder with the notebook and its kernel-metadata.json")
# The older form named the notebook as well. It must be the one in the metadata.
parser.add_argument("notebook", nargs="?", help=argparse.SUPPRESS)
notebook_wait.add_wait_arguments(parser)
script.add_yes(parser)
args = parser.parse_args(argv)
folder = Path(args.dir)
planned = notebook_push.plan(folder)
if isinstance(planned, int):
return planned
slug, details, cost = planned
if args.notebook and args.notebook != slug:
return script.fail(
"the notebook you named is not the one in kernel-metadata.json; the id there "
"decides what is pushed",
script.EXIT_USAGE,
)
details.append(("then", f"wait up to {args.timeout}s and download the output"))
gate = script.write_gate(
args.yes, action="push a notebook version and run it", details=details, cost=cost
)
if gate is not None:
return gate
credentials.load_configured_env_file()
status = notebook_push.push(folder)
if status != 0:
return status
return notebook_wait.wait_and_fetch(slug, args)
if __name__ == "__main__":
sys.exit(main())
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| deprecation-and-migrationaddyosmani/agent-skillsManages deprecation and migration. Use when removing old systems, APIs, or features. Use when migrating users from one implementation to another. Use when migrating a database schema in production, such as renaming or dropping a column without downtime (expand/contract). Use when deciding whether to maintain or sunset existing code. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| performance-optimizationaddyosmani/agent-skillsOptimizes application performance across frontend, backend, queries, and databases. Use when performance requirements exist, when you suspect performance regressions, when Core Web Vitals or load times need improvement, when N+1 query patterns need fixing, or when profiling reveals bottlenecks. | Stars: 119k | Updated | Claude CodeCodex | Verified | Install |
| agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |
| agent-cost-reportthedotmack/claude-memBelievable agent cost report for any period, default the last 7 full days PT, not counting today. Measured tokens from Claude Code transcripts priced at OpenRouter list prices (ESTIMATED), measured provider spend when a sanctioned source exists, note-taker cost separate, Timing-style HTML/PDF plus report.json, line-items.csv, evidence.json. | Stars: 118k | Updated | Claude CodeCodex | Verified | Install |