Skip to content

Invalid-Notebook-Solver is a Python tool designed to clean and rebuild Jupyter notebooks to ensure they are valid for platforms like GitHub. This tool addresses common issues with notebook compatibility and provides functionalities to add new code and markdown cells, and to save and rebuild notebooks while preserving cell outputs.

License

Notifications You must be signed in to change notification settings

ValentinLibouton/Invalid-Notebook-Solver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Invalid-Notebook-Solver

Invalid-Notebook-Solver is a Python tool designed to clean and rebuild Jupyter notebooks to ensure they are valid for platforms like GitHub. This tool addresses common issues with notebook compatibility and provides functionalities to add new code and markdown cells, and to save and rebuild notebooks while preserving cell outputs.

Error

Features

  • Open and Load Notebooks: Load Jupyter notebooks from a specified file path.
  • Add Code Cells: Add new code cells with specified content to the notebook.
  • Add Markdown Cells: Add new markdown cells with specified content to the notebook.
  • Save Notebooks: Save the current state of the notebook to a specified file path.
  • Rebuild Notebooks: Rebuild notebooks to ensure all cells and outputs are correctly formatted and compatible with GitHub.

Usage

from notebook_editor import NotebookEditor

# Initialize notebook editor with original notebook path
nb_editor = NotebookEditor(file_path="path/to/original_notebook.ipynb")

# Add a code cell
nb_editor.add_cell_code(content="print('This is a new code cell.')")

# Add a markdown cell
nb_editor.add_cell_markdown(content="This is a new markdown cell.")

# Save the modified notebook
nb_editor.save_notebook()

# Rebuild the notebook in a valid format for GitHub
nb_editor.rebuild_notebook(new_file_path="path/to/rebuilt_notebook.ipynb")

Installation

git clone [email protected]:ValentinLibouton/Invalid-Notebook-Solver.git
cd Invalid-Notebook-Solver
pip install -r requirements.txt

Requirements

  • nbformat

License

This project is licensed under the MIT License.

About

Invalid-Notebook-Solver is a Python tool designed to clean and rebuild Jupyter notebooks to ensure they are valid for platforms like GitHub. This tool addresses common issues with notebook compatibility and provides functionalities to add new code and markdown cells, and to save and rebuild notebooks while preserving cell outputs.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages