r/kaggle • u/PolarIceBear_ • 2h ago
I built a CLI that turns your local training repo into a Kaggle notebook, and v0.3.0 now pushes it for you (open source)
Disclosure: I'm the author.
If you train locally but want Kaggle's free GPUs, you know the pain: your repo is spread over folders and `.py` files, and getting it into a notebook means copy-pasting, uploading as a dataset, or fighting Git auth inside the notebook.
repo2nb converts a local repo into one self-contained notebook that rebuilds your file tree (`%%writefile` blocks), installs your dependencies, and is ready to run.
New in 0.3.0: the official Kaggle CLI is bundled.
- Authenticate once locally, then push and pull notebooks from your terminal. No manual uploading through the website.
- Edit locally, sync, push, run on GPU. No more tokens or Git setup inside the notebook.
- Dependency detection now reads `[project].dependencies` from `pyproject.toml`, and local modules no longer get wrongly added to `pip install`.
Already there:
- Smart filtering: skips venvs, weights, datasets and lock files so notebooks stay small
- `repo2nb sync` updates an existing notebook incrementally
- `repo2nb reverse` rebuilds a local repo from a notebook, so Kaggle-side edits aren't lost
- Colab support with `--target colab`
```
pip install repo2nb
python -m repo2nb ./my_project --output my_project_kaggle.ipynb
```
Requires Python 3.11+. If you have pre-0.3 notebooks, regenerate them (changelog explains how to keep manual cells).
It's aimed at students and hobbyists, not giant monorepos. MIT licensed, and I'd love feedback on what's still annoying in your Kaggle workflow.