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

check all notebooks use show_plot() if plotting (svg, download button, ...) #10

Open
slayoo opened this issue May 24, 2023 · 6 comments

Comments

@slayoo
Copy link
Member

slayoo commented May 24, 2023

No description provided.

@slayoo
Copy link
Member Author

slayoo commented May 25, 2023

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()")

@slayoo
Copy link
Member Author

slayoo commented May 30, 2023

should fail on PyMPDATA_examples/Olesik_et_al_2022/demo_analytical_solution.ipynb

@github-actions
Copy link

Stale issue message

@github-actions
Copy link

github-actions bot commented Oct 9, 2023

Stale issue message

Copy link

Stale issue message

Copy link

github-actions bot commented Apr 5, 2024

Stale issue message

@slayoo slayoo reopened this Oct 12, 2024
@slayoo 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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant