Skip to content

Commit 3b53604

Browse files
author
valentinlibouton
committed
upload first version
1 parent 1f29074 commit 3b53604

File tree

11 files changed

+388
-0
lines changed

11 files changed

+388
-0
lines changed

.idea/.gitignore

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/Invalid-Notebook-Solver.iml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 181 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/profiles_settings.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 7 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,43 @@
11
# Invalid-Notebook-Solver
22
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.
3+
4+
![Error](./images/error.png)
5+
## Features
6+
- Open and Load Notebooks: Load Jupyter notebooks from a specified file path.
7+
- Add Code Cells: Add new code cells with specified content to the notebook.
8+
- Add Markdown Cells: Add new markdown cells with specified content to the notebook.
9+
- Save Notebooks: Save the current state of the notebook to a specified file path.
10+
- Rebuild Notebooks: Rebuild notebooks to ensure all cells and outputs are correctly formatted and compatible with GitHub.
11+
12+
## Usage
13+
```python
14+
from notebook_editor import NotebookEditor
15+
16+
# Initialize notebook editor with original notebook path
17+
nb_editor = NotebookEditor(file_path="path/to/original_notebook.ipynb")
18+
19+
# Add a code cell
20+
nb_editor.add_cell_code(content="print('This is a new code cell.')")
21+
22+
# Add a markdown cell
23+
nb_editor.add_cell_markdown(content="This is a new markdown cell.")
24+
25+
# Save the modified notebook
26+
nb_editor.save_notebook()
27+
28+
# Rebuild the notebook in a valid format for GitHub
29+
nb_editor.rebuild_notebook(new_file_path="path/to/rebuilt_notebook.ipynb")
30+
```
31+
32+
## Installation
33+
```bash
34+
git clone git@github.com:ValentinLibouton/Invalid-Notebook-Solver.git
35+
cd Invalid-Notebook-Solver
36+
pip install -r requirements.txt
37+
```
38+
39+
## Requirements
40+
- nbformat
41+
42+
## License
43+
This project is licensed under the MIT License.

images/error.png

34.9 KB
Loading

requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
nbformat

0 commit comments

Comments
 (0)