Skip to content

Commit

Permalink
feat: Improve notebook cleanup on lint (#1230)
Browse files Browse the repository at this point in the history
* feat: add extra cleanup steps to notebook cleanup

* fix: clean up existing notebook information

* feat: also remove empty cells from notebooks
  • Loading branch information
NiklasKoehneckeAA authored Jan 28, 2025
1 parent 5d67f16 commit ec5e369
Show file tree
Hide file tree
Showing 30 changed files with 65 additions and 311 deletions.
8 changes: 7 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@ repos:
- id: ruff-format
types_or: [python, pyi, jupyter]
- repo: https://github.com/kynan/nbstripout
rev: 0.8.0
rev: 0.8.1
hooks:
- id: nbstripout
files: ".ipynb"
args:
[
--drop-empty-cells,
--extra-keys=metadata.kernelspec metadata.language_info.codemirror_mode.version metadata.language_info.pygments_lexer metadata.language_info.version,
]

- repo: https://github.com/codespell-project/codespell
rev: v2.3.0
hooks:
Expand Down
20 changes: 2 additions & 18 deletions src/documentation/attention_manipulation_with_text_controls.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -262,33 +262,17 @@
"####### Expected Output #######\n",
"# Hallo (German)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "14",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
"name": "ipython"
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.6"
"nbconvert_exporter": "python"
}
},
"nbformat": 4,
Expand Down
12 changes: 2 additions & 10 deletions src/documentation/classification.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -372,22 +372,14 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
"name": "ipython"
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.7"
"nbconvert_exporter": "python"
}
},
"nbformat": 4,
Expand Down
12 changes: 2 additions & 10 deletions src/documentation/document_index.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -686,22 +686,14 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "intelligence-layer-LP3DLT23-py3.12",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
"name": "ipython"
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.2"
"nbconvert_exporter": "python"
}
},
"nbformat": 4,
Expand Down
12 changes: 2 additions & 10 deletions src/documentation/elo_qa_eval.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -596,22 +596,14 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "intelligence-layer-LP3DLT23-py3.12",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
"name": "ipython"
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.2"
"nbconvert_exporter": "python"
}
},
"nbformat": 4,
Expand Down
12 changes: 2 additions & 10 deletions src/documentation/evaluate_with_studio.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -276,22 +276,14 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "intelligence-layer-LP3DLT23-py3.12",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
"name": "ipython"
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.2"
"nbconvert_exporter": "python"
}
},
"nbformat": 4,
Expand Down
12 changes: 2 additions & 10 deletions src/documentation/evaluation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -443,22 +443,14 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
"name": "ipython"
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
"nbconvert_exporter": "python"
}
},
"nbformat": 4,
Expand Down
12 changes: 2 additions & 10 deletions src/documentation/fastapi_tutorial.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -300,22 +300,14 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "intelligence-layer-rp3__H-P-py3.11",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
"name": "ipython"
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
"nbconvert_exporter": "python"
}
},
"nbformat": 4,
Expand Down
12 changes: 2 additions & 10 deletions src/documentation/how_tos/how_to_aggregate_evaluations.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -69,22 +69,14 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "intelligence-layer-LP3DLT23-py3.12",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
"name": "ipython"
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.2"
"nbconvert_exporter": "python"
}
},
"nbformat": 4,
Expand Down
12 changes: 2 additions & 10 deletions src/documentation/how_tos/how_to_create_a_dataset.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -82,22 +82,14 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "intelligence-layer-dgcJwC7l-py3.11",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
"name": "ipython"
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
"nbconvert_exporter": "python"
}
},
"nbformat": 4,
Expand Down
12 changes: 2 additions & 10 deletions src/documentation/how_tos/how_to_define_a_task.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,14 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
"name": "ipython"
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.4"
"nbconvert_exporter": "python"
}
},
"nbformat": 4,
Expand Down
12 changes: 2 additions & 10 deletions src/documentation/how_tos/how_to_evaluate_runs.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -69,22 +69,14 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "intelligence-layer-d3iSWYpm-py3.10",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
"name": "ipython"
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.11.8"
"nbconvert_exporter": "python"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -198,22 +198,14 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "intelligence-layer-d3iSWYpm-py3.10",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
"name": "ipython"
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.2"
"nbconvert_exporter": "python"
}
},
"nbformat": 4,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,22 +147,14 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "intelligence-layer-d3iSWYpm-py3.10",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
"name": "ipython"
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.12"
"nbconvert_exporter": "python"
}
},
"nbformat": 4,
Expand Down
12 changes: 2 additions & 10 deletions src/documentation/how_tos/how_to_implement_a_task.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -156,22 +156,14 @@
}
],
"metadata": {
"kernelspec": {
"display_name": "intelligence-layer-LP3DLT23-py3.12",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
"name": "ipython"
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.12.2"
"nbconvert_exporter": "python"
}
},
"nbformat": 4,
Expand Down
Loading

0 comments on commit ec5e369

Please sign in to comment.