Skip to main content

kag - fresh Kaggle competition workspaces from your terminal

PyPI Python Versions

kag is a Textual TUI inspired by try, built for Kaggle workflows.

It helps you go from "I want to work on this competition" to a ready folder with data, notebook, notes, and editor open.

Demo

Asciinema walkthrough placeholder: docs/demo-placeholder.md

Planned recording file path: docs/demo.cast

What kag does

  • Shows a searchable competition picker with sections:
    • Your notebooks (local projects in KAG_PATH)
    • Joined competitions
    • All competitions
  • Uses paginated loading for competitions (20 per page) and auto-loads more when you reach the end.
  • Scaffolds a project folder:
    • data/ (download + extract) with data/SCHEMA.md describing each file's columns
    • <competition>.ipynb
    • notes.md (overview, evaluation, data description, rules, and top notebooks from Kaggle)
    • AGENTS.md and CLAUDE.md so coding agents start with the metric, submission format, and limits
    • .kag/competition.json (machine-readable competition metadata)
    • pyproject.toml listing the Python packages, and a .venv with them installed once you agree (see Python environment)
    • git init (optional)
  • Checks competition access before download and opens browser tabs for overview + rules when acceptance is needed.
  • Fills notes.md from Kaggle's official competition pages (Overview, Evaluation, Data, Code, Rules).

Installation

kag is published on PyPI and installs as a global terminal command.

uv tool install kag

Alternative: pipx

pipx install kag

Fallback: pip

python -m pip install kag

Validate your install:

kag --version
kag doctor

For development from this repository:

uv sync
uv run kag doctor

Maintainer release planning lives in docs/release.md.

Setup guide

1. Install kag

uv tool install kag

2. Sign in to Kaggle

kag installs the Kaggle CLI and library for you (Python 3.11+); there is nothing else to install. Sign in once in your browser:

kag login

This runs the Kaggle CLI bundled with kag (kaggle auth login) and caches credentials in ~/.kaggle/. You don't need a separate kaggle command: kag kaggle <args> runs the bundled CLI (for example kag kaggle competitions submit -c titanic -f submission.csv -m "first try"). Other ways to authenticate also work:

  • API token: KAGGLE_API_TOKEN, or the token saved to ~/.kaggle/access_token
  • Legacy: KAGGLE_USERNAME + KAGGLE_KEY, or ~/.kaggle/kaggle.json containing username and key

3. Verify your environment

kag doctor

Fix any FAIL rows before starting a competition workspace.

4. Choose where projects are created

By default, kag creates projects in ~/Kaggle. Set kag_path in the optional config file, ~/.kag_config.toml:

kag_path = "~/Kaggle"     # ~ and $VARIABLES are expanded
default_editor = "code"   # highlighted first in the editor picker: code, cursor, zed, windsurf or jupyter
auto_git = true

If the file can't be read, kag says so when it starts and uses the defaults; kag doctor shows the problem too.

Or set KAG_PATH for one shell or session:

export KAG_PATH=~/Kaggle

Environment variables (KAG_PATH, KAG_THEME, KAG_UPDATE_CHECK) take priority over ~/.kag_config.toml, which takes priority over the defaults.

Colours and themes

By default kag uses your terminal's own colours, with no background fill, so a transparent, blurred or themed terminal background shows through. Change it in ~/.kag_config.toml or with KAG_THEME, which takes priority:

theme = "terminal"     # default: your terminal's background and 16-colour palette
# theme = "kag"        # kag's dark look
# theme = "nord"       # or any built-in Textual theme: gruvbox, dracula, tokyo-night,
                       # catppuccin-mocha, rose-pine, solarized-light, ...

You can also press Ctrl+P in kag and choose Theme to try themes live; the one you pick is saved to ~/.kag_config.toml. An unknown name falls back to terminal with a warning, and kag doctor shows the active theme. kag respects NO_COLOR.

Python environment

Every new project gets a pyproject.toml listing its Python packages. Installing them downloads and runs code from PyPI, so by default kag shows you the list and asks first (the default answer is No). Every part of this can be changed in the [environment] section of ~/.kag_config.toml; these are the defaults:

[environment]
create = true          # false: no pyproject.toml or .venv (the older auto_venv = false also works)
install = "ask"        # "ask" shows the list and asks y/N; "always" installs; "never" only writes pyproject.toml
python = ""            # e.g. "3.12"; empty uses uv's default
packages = ["pandas", "numpy", "matplotlib", "seaborn", "scikit-learn", "ipykernel"]
command = []           # replace the install step, e.g. ["pixi", "install"]

kag installs with uv sync, or with python -m venv plus pip if uv isn't on your PATH. Output goes to .kag/logs/environment.log. If you skip the install, or it fails, kag still creates the project and tells you the command to run later. An existing pyproject.toml or .venv is never replaced, and kag only installs a pyproject.toml it wrote itself and you haven't edited. For any other pyproject.toml, kag installs nothing and tells you to run uv sync yourself (a custom command still runs).

5. Start using kag

kag
kag titanic

Optional shell integration lets kag automatically cd into the selected project directory:

eval "$(kag init)"

Quick start

kag login            # sign in to Kaggle (first time only)
kag                  # open the competition picker
kag titanic          # open the picker searching for "titanic"
kag new titanic      # create a workspace without the TUI

Commands

Commands are words; options such as --force or --json modify them.

kag [query]                  # open the picker, optionally searching
kag search <query>           # same, and works for words like "new" or "login"
kag new <competition>        # create a workspace without the TUI (see below)
kag login [--force]          # sign in to Kaggle in your browser
kag doctor [--json]          # check your environment
kag init                     # print shell integration that cds into new projects
kag kaggle <args>            # run the Kaggle CLI bundled with kag
kag --help                   # help (also `kag <command> --help`)
kag --version                # installed version

A bare query searches unless its first word is a command name; use kag search <query> to search for "new", "login", and so on. kag --help works without Kaggle authentication. The older kag --doctor and kag --init forms still work.

For scripts and AI agents: kag new

kag new builds the same workspace as the TUI without any prompts, which makes it usable from scripts and coding agents:

kag new titanic --json                  # create ~/Kaggle/titanic and print a JSON result
kag new titanic --json --no-download    # metadata, notes, and agent files only
kag new titanic --json --force          # existing folder: add missing files (never overwrites)

Options: --no-download, --no-git, --no-venv, --install, --editor NAME, --force, --json. Progress goes to stderr; the result goes to stdout.

kag new can't ask before installing packages. With the default install = "ask", it writes pyproject.toml, skips the install, and reports "environment": {"status": "not_installed", "packages": [...], "install_command": "uv sync"} so the agent can ask you first. --install agrees for that run, and install = "always" agrees every time.

Status Exit code Meaning
created / updated 0 Workspace ready. next_steps says where to start (AGENTS.md).
error 1 Something failed; see message.
needs_join 3 Join the competition and accept its rules at url (a human has to click), then rerun.
exists 4 The folder already exists; rerun with --force to add missing files.
cancelled 130 Interrupted with Ctrl-C; changes were rolled back.

Every project includes AGENTS.md (plus a CLAUDE.md that imports it) and .kag/competition.json, so an agent starts with the metric, submission template, and daily submission limit. When data is downloaded, data/SCHEMA.md (kept local with the data, not committed) adds per-file column schemas; with --no-download, files.schema is null until a later kag new --force downloads the data.

How it works

  1. Open picker (kag)
  2. Search and select competition or local project
  3. If needed, choose download and editor
  4. kag verifies competition access before download
  5. Project is scaffolded and opened
  6. If the kag init shell hook is installed, your shell cds into the project

Search behavior

Search is currently case-insensitive substring filtering over competition slug/title and local project names.

Troubleshooting

Run:

kag doctor

It checks:

  • kag on PATH
  • bundled Kaggle CLI + auth status
  • API probe (kaggle competitions list --page-size 1)
  • shell hook presence
  • writable directories
  • detected editors

If you pick Jupyter Lab (or another editor) when creating a project, its output is written to .kag/logs/<editor>.log inside the project. On a headless or SSH session, find the Jupyter server URL and token there, or run jupyter server list.

Current limitations

  • Competition join/terms acceptance is browser-assisted (not a direct Kaggle CLI command).
  • Notes extraction depends on Kaggle page APIs/content shape and may vary by competition.
  • Search is substring-based (not fuzzy-ranked yet).

License

MIT

Metadata

Release files for kag 0.2.2

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

Source distribution (sdist)

Source distribution for kag 0.2.2
File Size Uploaded Provenance Actions
kag-0.2.2.tar.gz 127.5 kB With provenance Details for kag-0.2.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for kag 0.2.2
File Interpreter ABI Platform Actions
kag-0.2.2-py3-none-any.whl Python 3 none any Details for kag-0.2.2-py3-none-any.whl

Total release size: 186.6 kB

Release files / kag-0.2.2.tar.gz

Download URL kag-0.2.2.tar.gz
Size 127.5 kB
Tags Source
SHA-256 checksum
How to use checksums
06017bab66aab155420060477256e27219bf8207dde5b5999913df66a820f47e
BLAKE2b-256 checksum
How to use checksums
663d13a984aded9f9aa4beb4c3cca974974f88770aa968b1e5d8b41b99f31713
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 Oct 12, 2026.

Transparency log

Release files / kag-0.2.2-py3-none-any.whl

Download URL kag-0.2.2-py3-none-any.whl
Size 59.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e0937fd8514076cf73f8d97bb97a0644c66523ec8ec9fd73229098af40c83919
BLAKE2b-256 checksum
How to use checksums
c62bc3977b45a3142afbbf82a951ac77ef5ba57026250db14f647cf4a5c5174c
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 Oct 12, 2026.

Transparency log

Security for kag 0.2.2

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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for kag-0.2.2.tar.gz

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 Oct 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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