Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit] added clean notebook output hook #639

Merged
merged 6 commits into from
Nov 10, 2021
Merged
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
8 changes: 0 additions & 8 deletions .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,3 @@ jobs:
- name: run mypy
run: |
mypy --install-types --non-interactive .

check-notebooks:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Check notebooks
uses: ResearchSoftwareActions/EnsureCleanNotebooksAction@1.1
6 changes: 6 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,3 +50,9 @@ repos:
hooks:
- id: nbqa-black
- id: nbqa-isort
- repo: https://github.com/roy-ht/pre-commit-jupyter
rev: v1.2.1
hooks:
- id: jupyter-notebook-cleanup
args:
- --remove-kernel-metadata
19 changes: 2 additions & 17 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

# Local build command ------------------------------------------------------------------

# sphinx-build -W -n -b html -d build/doctrees doc build/html --keep-going
# -D nbsphinx_kernel_name="weldx" -D nbsphinx_execute="never"
# sphinx-build -W -n -b html -d build/doctrees doc build/html --keep-going -D nbsphinx_execute="never"

# -- Path setup --------------------------------------------------------------
# If extensions (or modules to document with autodoc) are in another directory,
Expand All @@ -21,8 +20,6 @@
import sys
import typing

import traitlets


def _workaround_imports_typechecking():
"""Load some packages needed for type annotations."""
Expand Down Expand Up @@ -150,21 +147,9 @@ def _prevent_sphinx_circular_imports_bug():
nbsphinx_execute = "always"
nbsphinx_execute_arguments = [
"--InlineBackend.figure_formats={'svg', 'pdf'}",
"--InlineBackend.rc <figure.dpi=96>",
]

if traitlets.__version__ < "5":
nbsphinx_execute_arguments.append("--InlineBackend.rc={'figure.dpi': 96}")
else:
nbsphinx_execute_arguments.append("--InlineBackend.rc <figure.dpi=96>")

# Select notebook kernel for nbsphinx
# default "python3" is needed for readthedocs run
# if building locally, this might need to be "weldx" - try setting using -D option:
# -D nbsphinx_kernel_name="weldx"
if os.getenv("READTHEDOCS", False):
nbsphinx_kernel_name = "python3"
else:
nbsphinx_kernel_name = "weldx"

# This is processed by Jinja2 and inserted before each notebook
nbsphinx_prolog = r"""
Expand Down
4 changes: 2 additions & 2 deletions tutorials/GMAW_process.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "weldx",
"display_name": "",
"language": "python",
"name": "weldx"
"name": ""
},
"language_info": {
"codemirror_mode": {
Expand Down
4 changes: 2 additions & 2 deletions tutorials/custom_metadata.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "weldx",
"display_name": "",
"language": "python",
"name": "weldx"
"name": ""
},
"language_info": {
"codemirror_mode": {
Expand Down
4 changes: 2 additions & 2 deletions tutorials/experiment_design_01.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -476,9 +476,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "weldx",
"display_name": "",
"language": "python",
"name": "weldx"
"name": ""
},
"language_info": {
"codemirror_mode": {
Expand Down
4 changes: 2 additions & 2 deletions tutorials/geometry_01_profiles.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -901,9 +901,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "weldx",
"display_name": "",
"language": "python",
"name": "weldx"
"name": ""
},
"language_info": {
"codemirror_mode": {
Expand Down
4 changes: 2 additions & 2 deletions tutorials/geometry_02_geometry.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -477,9 +477,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "weldx",
"display_name": "",
"language": "python",
"name": "weldx"
"name": ""
},
"language_info": {
"codemirror_mode": {
Expand Down
4 changes: 2 additions & 2 deletions tutorials/groove_types_01.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -255,9 +255,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "weldx",
"display_name": "",
"language": "python",
"name": "weldx"
"name": ""
},
"language_info": {
"codemirror_mode": {
Expand Down
4 changes: 2 additions & 2 deletions tutorials/measurement_chain.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -570,9 +570,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "weldx",
"display_name": "",
"language": "python",
"name": "weldx"
"name": ""
},
"language_info": {
"codemirror_mode": {
Expand Down
4 changes: 2 additions & 2 deletions tutorials/measurement_example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -511,9 +511,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "weldx",
"display_name": "",
"language": "python",
"name": "weldx"
"name": ""
},
"language_info": {
"codemirror_mode": {
Expand Down
4 changes: 2 additions & 2 deletions tutorials/quality_standards.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -635,9 +635,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "weldx",
"display_name": "",
"language": "python",
"name": "weldx"
"name": ""
},
"language_info": {
"codemirror_mode": {
Expand Down
4 changes: 2 additions & 2 deletions tutorials/timeseries_01.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "weldx",
"display_name": "",
"language": "python",
"name": "weldx"
"name": ""
},
"language_info": {
"codemirror_mode": {
Expand Down
4 changes: 2 additions & 2 deletions tutorials/transformations_01_coordinate_systems.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1006,9 +1006,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "weldx",
"display_name": "",
"language": "python",
"name": "weldx"
"name": ""
},
"language_info": {
"codemirror_mode": {
Expand Down
4 changes: 2 additions & 2 deletions tutorials/transformations_02_coordinate_system_manager.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -893,9 +893,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "weldx",
"display_name": "",
"language": "python",
"name": "weldx"
"name": ""
},
"language_info": {
"codemirror_mode": {
Expand Down
4 changes: 2 additions & 2 deletions tutorials/welding_example_01_basics.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -567,9 +567,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "weldx",
"display_name": "",
"language": "python",
"name": "weldx-dev"
"name": ""
},
"language_info": {
"codemirror_mode": {
Expand Down
4 changes: 2 additions & 2 deletions tutorials/welding_example_02_weaving.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -620,9 +620,9 @@
],
"metadata": {
"kernelspec": {
"display_name": "weldx",
"display_name": "",
"language": "python",
"name": "weldx"
"name": ""
},
"language_info": {
"codemirror_mode": {
Expand Down