Convert a local code repository into a Kaggle-ready Jupyter notebook
Project description
repo2nb
repo2nb is an open-source Python CLI tool that converts a local code repository into a self-contained Jupyter notebook (.ipynb) designed natively to run on Kaggle's free GPU environment.
It reconstructs your entire repo in Kaggle's /kaggle/working directory using Python's %%writefile magic cells, and integrates git for version control so you can pull, test, and push fixes back to your remote repository without ever leaving the Kaggle interface.
Motivation
This is a tool I made for personal use first, then I wanted to publish it.
My motivation was that I wanted to securely run a training repo on Kaggle, but it was scattered across directories and Python files. It is extremely frustrating copying all of this into a notebook and debugging why it's giving an error.
I used to do workarounds like uploading the repo as a dataset and starting from there. It was exhausting and wasted a couple of minutes just to realize I missed an indented line! Attempting the same flow manually using git for authenticating myself, pushing, and pulling for simple microscopic changes, which was equally painful. repo2nb automates all of this seamlessly.
Heads Up: This project is intended for personal and academic projects. It is specifically designed for students and hobbyists like myself who want to quickly leverage free GPU compute without friction, rather than managing massive corporate repositories with hundreds of nested files!
Installation
pip install repo2nb
Usage
# Convert your local project to a Kaggle notebook
repo2nb ./my_project --output my_project_kaggle.ipynb
Then literally just upload the resulting .ipynb file to Kaggle!
Options
--output,-o: Specify the output notebook path. Defaults to<folder_name>.ipynb.--omit-instructions: Omits the beginner-friendly warning cells and instructional git cheat sheets. Perfect for power users who already know the setup routine.--ignore-extra: Provide extra file extensions to ignore entirely (e.g.,--ignore-extra ".yaml .json"). These files will be completely omitted from the generated notebook.--include: Force include specific file extensions that are usually skipped as binary/data (e.g.,--include ".csv .json").
Features
- Instant Rebuild: Automatically translates your local file tree into correctly ordered
%%writefileblocks. - Git Integration: Injects pre-formatted shell cells for initializing Git, adding tokens, selecting branches, pulling, and pushing.
- Smart Filtering: Automatically skips cached data, virtual environments (
.venv),uvlock files, heavy binaries (.pt,.pkl,.jpg), and dataset files (.csv,.parquet) so your final notebook remains incredibly lightweight. - Visual Segregation: Creates unmissable structural phases isolating where the automatic repo build ends and where your actual coding workspace begins.
- Built-in Git Cheat Sheet: Gives you immediate interactive access to
git status,git rm -rf, andgit mvblocks directly in the UI.
Important Conventions & Security
Security & Publishing:
The generated notebook contains a prompt to hook up your GitHub personal access token so you can sync edits back. If you plan to make this notebook public, DO NOT hardcode your GitHub token! Use Kaggle Secrets instead. Additionally, ensure that Kaggle's .virtual_documents directory is added to your .gitignore before pushing any changes to avoid leaking Kaggle's system files into your repo.
Run All Only Once: When you first start your Kaggle session, use "Run All" to bootstrap the directory structure and recreate the files. After the initial setup, run cells individually as needed. Using "Run All" again may overwrite any local manual code changes you have made that session!
Branch Management:
The notebook's git hooks default to main. The generated code blocks remind you to swap "main" for your target branch name if you are pulling or committing to a different branch.
Project details
Release history Release notifications | RSS feed
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 repo2nb-0.1.0.tar.gz.
File metadata
- Download URL: repo2nb-0.1.0.tar.gz
- Upload date:
- Size: 736.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
30813a344d1a7b23e9512becda8ca89fcece162713686950a1df94db0b5ece0b
|
|
| MD5 |
6038e854b1a2bd659d1db55445d4ad3e
|
|
| BLAKE2b-256 |
9f7b294ea1ca97778199d25071f52baacfc96712d4e7615708321db06b2e8437
|
File details
Details for the file repo2nb-0.1.0-py3-none-any.whl.
File metadata
- Download URL: repo2nb-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
858ffd027699e572fea394b52c10ae98c7b704b55300b47e4693294848c2b869
|
|
| MD5 |
b363d01884699b4fd79bd2a913ca92e2
|
|
| BLAKE2b-256 |
0894251e245c90936eda6abb35baac6a83d21c9aa083c7161f66d35cd2aae77b
|