Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# based on https://stackoverflow.com/a/73218382/358804
*.ipynb filter=strip-notebook-execution
15 changes: 15 additions & 0 deletions extras/lib/clear_execution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# adapted from
# https://github.com/jupyter/nbconvert/blob/main/nbconvert/preprocessors/clearmetadata.py

from nbconvert.preprocessors import Preprocessor


class ClearExecutionPreprocessor(Preprocessor):
"""Removes the execution metadata from all code cells in a notebook."""

def preprocess_cell(self, cell, resources, cell_index):
if cell.cell_type == "code" and "metadata" in cell:
metadata = cell.metadata
if "execution" in metadata:
metadata["execution"] = {}
return cell, resources
10 changes: 5 additions & 5 deletions lecture_0.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -745,10 +745,10 @@
"execution_count": 1,
"metadata": {
"execution": {
"iopub.execute_input": "2024-09-21T02:01:34.277506Z",
"iopub.status.busy": "2024-09-21T02:01:34.277165Z",
"iopub.status.idle": "2024-09-21T02:01:34.288803Z",
"shell.execute_reply": "2024-09-21T02:01:34.288284Z"
"iopub.execute_input": "2024-09-21T03:30:34.911251Z",
"iopub.status.busy": "2024-09-21T03:30:34.910996Z",
"iopub.status.idle": "2024-09-21T03:30:34.922876Z",
"shell.execute_reply": "2024-09-21T03:30:34.922419Z"
},
"tags": [
"columbia-only"
Expand All @@ -770,7 +770,7 @@
" "
],
"text/plain": [
"<IPython.lib.display.IFrame at 0x103fe38b0>"
"<IPython.lib.display.IFrame at 0x105d5a710>"
]
},
"execution_count": 1,
Expand Down
Loading