-
Notifications
You must be signed in to change notification settings - Fork 4
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
check all notebooks use show_plot() if plotting (svg, download button, ...) #10
Comments
something like this should do: @staticmethod
def test_show_plot_used_if_notebook_uses_matplotlib(notebook):
""" checks if all notebooks use the open-atmos-jupyter-utils show_plot instead of pyplot.show() """
with open(notebook) as fp:
nb = nbformat.read(fp, nbformat.NO_CONVERT)
matplotlib_used = False
show_plot_used = False
for cell in nb.cells:
if cell.cell_type == "code":
if "matplotlib" in cell.source:
matplotlib_used = True
if "import open_atmos_jupyter_utils" in cell.source or "from open_atmos_jupyter_utils" in cell.source:
show_plot_used = True
if matplotlib_used and not show_plot_used:
raise AssertionError("if using matplotlib, please use open_atmos_jupyter_utils.show_plot()") |
should fail on |
Stale issue message |
Stale issue message |
Stale issue message |
Stale issue message |
This was referenced Nov 27, 2024
slayoo
changed the title
check all notebooks use show_plot() is plotting (svg, download button, ...)
check all notebooks use show_plot() if plotting (svg, download button, ...)
Nov 27, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: