Skip to main content

repo2nb

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 — and now Google Colab too.

Video Tutorial

repo2nb Quick Start Guide

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.

[!NOTE] 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 into a Kaggle-ready notebook
python -m repo2nb ./my_project --output my_project_kaggle.ipynb

Then literally just upload the resulting .ipynb file to Kaggle!

That's the whole idea: one command turns your file tree into a notebook that rebuilds your repo on a free GPU machine, installs your dependencies, and comes pre-wired with secure git auth so you can pull and push from the platform.

What you get

  • Instant Rebuild: Automatically translates your local file tree into correctly ordered %%writefile blocks.
  • 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), lock files, heavy binaries (.pt, .pkl, .jpg), and dataset files (.csv, .parquet) so your final notebook remains incredibly lightweight.
  • Dependency Auto-Detection: Resolves dependencies from poetry, uv, requirements.txt, or your actual imports — and emits one plain pip install cell.
  • Reverse Mode: Reconstruct your local repo from a generated notebook (repo2nb reverse), closing the loop on Kaggle-side edits.
  • Incremental Sync: Update an existing notebook in place after local changes (repo2nb sync) instead of regenerating from scratch.
  • Multi-Target: Generate for Kaggle (default) or Google Colab (--target colab).
  • 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, and git mv blocks directly in the UI.

Learn more

Doc Contents
TUTORIAL.md Every command and flag, dependency detection, .repo2nbignore, reverse & sync workflows, Colab setup, conventions
SECURITY.md How secrets are handled and what the tool writes to your machine
SUPPORT.md Getting help and reporting bugs
CONTRIBUTING.md Development setup, project layout, PR guidelines

Reporting Issues

Found a bug or have a feature request? Head over to SUPPORT.md for how to report it well.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

repo2nb-0.2.0.tar.gz (206.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

repo2nb-0.2.0-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

File details

Details for the file repo2nb-0.2.0.tar.gz.

File metadata

  • Download URL: repo2nb-0.2.0.tar.gz
  • Upload date:
  • Size: 206.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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

Hashes for repo2nb-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b2b4ae358091e06509aa869c420c72f45c2d97505d66487895bf51214d5b7d5e
MD5 7db73caa66d36bc4735efe9977807f0b
BLAKE2b-256 f2da3d312868a7bc0af8073fe3e27bf1e39d88a40c1817ee7d9c82e477251d63

See more details on using hashes here.

File details

Details for the file repo2nb-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: repo2nb-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 19.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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

Hashes for repo2nb-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ff4b2950b4fe5b3e673f8ccb32a671838d538689aca3b04a6aad518cd2275fe8
MD5 b5e4c3996f9f9edb6f2345e0c5a8d73c
BLAKE2b-256 4c0d8d3f585ed1b99117fd2f897caa81292f78ab588a0808f25743cd3771a005

See more details on using hashes here.

Release history Release notifications | RSS feed

0.2.1

2 files

This release

0.2.0 This release

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 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