Convert EPUB files into Jupyter notebooks for use with solve.it.com.
Inspired by karpathy/reader3 for EPUB parsing.
- Extracts chapters from EPUB files
- Creates one Jupyter notebook per chapter
- Converts HTML content to Markdown
- Generates index notebook with table of contents
- Works with or without optional dependencies (graceful fallback)
pip install -r requirements.txtOr install dependencies directly:
pip install ebooklib beautifulsoup4 lxmlpython epub_to_notebook.py book.epubThis creates a book_notebooks/ directory with:
00_index.ipynb- Table of contentschapter_00_*.ipynb- Individual chapter notebooks
python epub_to_notebook.py book.epub -o my_notebookspython epub_to_notebook.py book.epub --format textpython epub_to_notebook.py book.epub --list-chaptersEach chapter notebook contains:
- A title cell with chapter name, book title, and author
- A content cell with the chapter text in Markdown format
The notebooks are compatible with Jupyter and can be used with solve.it.com for interactive reading and analysis.
ebooklib- EPUB parsing (optional, has fallback)beautifulsoup4- HTML processing (optional, has fallback)lxml- XML/HTML parser for BeautifulSoup
The converter works without these dependencies using built-in Python libraries, but the output quality is better with them installed.