Two simple Python tools for extracting and appending content to Jupyter notebooks.
What it does: Extracts content from Jupyter notebooks and saves it to JSON files
Features:
- Extracts code blocks and markdown blocks
- Maintains cell order and execution counts
- Captures outputs and errors
- Saves in clean JSON format
Usage:
python notebook_extractor.py notebook.ipynb output.jsonExample:
python notebook_extractor.py my_notebook.ipynb extracted_content.jsonWhat it does: Loads JSON blocks and appends them to notebooks, then executes them
Features:
- Loads blocks from JSON files
- Appends to existing notebooks or creates new ones
- Creates automatic backups
- Executes newly added code cells
Usage:
python simple_notebook_appender.py(Uses default files: NN_EDA.ipynb and example_blocks.json)
The JSON file follows this structure:
[
{
"type": "md",
"md": "# Your markdown content here"
},
{
"type": "code",
"code": "print('Your Python code here')"
}
]# 1. Extract content from notebook
python notebook_extractor.py my_notebook.ipynb blocks.json
# 2. Add blocks to notebook
python simple_notebook_appender.py- Backup: Save notebook content as JSON backup
- Templates: Reuse common code blocks across notebooks
- Automation: Programmatically manage notebook content
- Version Control: Track notebook changes more easily
Simple tools for Jupyter notebook content management! 🎯