From 57ae8cf47c87ba192363bb4ee6b9892510a10cf1 Mon Sep 17 00:00:00 2001 From: Nabil Freij Date: Wed, 15 Mar 2023 17:33:44 -0700 Subject: [PATCH] Undo it all --- .readthedocs.yaml | 1 + docs/conf.py | 33 +++++------------------------- docs/examples/3d_functionality.rst | 8 ++++++++ docs/examples/_readme.txt | 13 ++++++++++++ docs/examples/assume_spherical.rst | 8 ++++++++ docs/examples/field_lines.rst | 8 ++++++++ docs/examples/index.rst | 10 +++++++++ docs/examples/setup.py | 3 +++ docs/index.rst | 2 +- setup.cfg | 7 ++++--- 10 files changed, 61 insertions(+), 32 deletions(-) create mode 100644 docs/examples/3d_functionality.rst create mode 100644 docs/examples/_readme.txt create mode 100644 docs/examples/assume_spherical.rst create mode 100644 docs/examples/field_lines.rst create mode 100644 docs/examples/index.rst create mode 100644 docs/examples/setup.py diff --git a/.readthedocs.yaml b/.readthedocs.yaml index d6aad89..cb5a7ae 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -7,6 +7,7 @@ build: apt_packages: - xvfb - libgl1-mesa-dev + - mesa-utils conda: environment: .rtd-environment.yml diff --git a/docs/conf.py b/docs/conf.py index a5d06cd..e71c12e 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -6,13 +6,14 @@ from datetime import datetime from packaging.version import Version -from sunpy_sphinx_theme.conf import * +from sunpy_sphinx_theme.conf import * # NOQA from sunkit_pyvista import __version__ # -- Project information ----------------------------------------------------- on_rtd = os.environ.get("READTHEDOCS", None) == "True" os.environ["HIDE_PARFIVE_PROGESS"] = "True" +os.environ["PYDEVD_DISABLE_FILE_VALIDATION"] = "1" project = "sunkit-pyvista" author = "SunPy Community" copyright = "{}, {}".format(datetime.now().year, author) @@ -28,7 +29,6 @@ extensions = [ "sphinx_automodapi.automodapi", "sphinx_automodapi.smart_resolver", - "sphinx_gallery.gen_gallery", "sphinx_changelog", "sphinx.ext.autodoc", "sphinx.ext.coverage", @@ -39,6 +39,7 @@ "sphinx.ext.napoleon", "sphinx.ext.todo", "sphinx.ext.viewcode", + "jupyter_sphinx", ] # List of patterns, relative to source directory, that match files and @@ -87,31 +88,7 @@ import pyvista pyvista.OFF_SCREEN = True -# Preferred plotting style for documentation pyvista.set_plot_theme("document") pyvista.global_theme.window_size = [512, 512] -pyvista.global_theme.font.size = 18 -pyvista.global_theme.font.label_size = 18 -pyvista.global_theme.font.title_size = 18 -pyvista.global_theme.return_cpos = False -# Necessary when building the sphinx gallery -pyvista.BUILDING_GALLERY = True -pyvista.set_jupyter_backend(None) - - -# -- Sphinx Gallery ------------------------------------------------------------ -sphinx_gallery_conf = { - "backreferences_dir": os.path.join("generated", "modules"), - "filename_pattern": "^((?!skip_).)*$", - "examples_dirs": os.path.join("..", "examples"), - "gallery_dirs": os.path.join("generated", "gallery"), - "matplotlib_animations": True, - # Comes from the theme. - "default_thumb_file": png_icon, # NOQA - "abort_on_example_error": False, - "plot_gallery": "True", - "remove_config_comments": True, - "doc_module": ("sunpy"), - "only_warn_on_example_error": True, - "image_scrapers": ("matplotlib", "pyvista"), -} +if on_rtd: + pyvista.start_xvfb() diff --git a/docs/examples/3d_functionality.rst b/docs/examples/3d_functionality.rst new file mode 100644 index 0000000..4f1fe6e --- /dev/null +++ b/docs/examples/3d_functionality.rst @@ -0,0 +1,8 @@ +================================== +Extending functionality from sunpy +================================== + +.. jupyter-execute:: setup.py + :hide-code: + +.. jupyter-execute:: ../../examples/3d_functionality.py diff --git a/docs/examples/_readme.txt b/docs/examples/_readme.txt new file mode 100644 index 0000000..dde9f8a --- /dev/null +++ b/docs/examples/_readme.txt @@ -0,0 +1,13 @@ +To create a new example, follow these steps: + +1. Create a new python script for the example in /examples/. You should be + able to run this script by itself, and produce a plot at the end. +2. Create a .rst file in this directory that has: + - A title + - .. jupyter-execute:: setup.py + :hide-code: + + - .. jupyter-execute:: ../../examples/FILENAME.py + + + where FILENAME is the name of the file created in step 1. diff --git a/docs/examples/assume_spherical.rst b/docs/examples/assume_spherical.rst new file mode 100644 index 0000000..25b66d4 --- /dev/null +++ b/docs/examples/assume_spherical.rst @@ -0,0 +1,8 @@ +======================== +Ignoring off-limb pixels +======================== + +.. jupyter-execute:: setup.py + :hide-code: + +.. jupyter-execute:: ../../examples/assume_spherical.py diff --git a/docs/examples/field_lines.rst b/docs/examples/field_lines.rst new file mode 100644 index 0000000..4bd08a1 --- /dev/null +++ b/docs/examples/field_lines.rst @@ -0,0 +1,8 @@ +================================ +Plotting Field Lines from pfsspy +================================ + +.. jupyter-execute:: setup.py + :hide-code: + +.. jupyter-execute:: ../../examples/field_lines.py diff --git a/docs/examples/index.rst b/docs/examples/index.rst new file mode 100644 index 0000000..41c895c --- /dev/null +++ b/docs/examples/index.rst @@ -0,0 +1,10 @@ +*************** +Example Gallery +*************** + +This gallery contains examples of how to use sunkit-pyvista. + +.. toctree:: + :glob: + + * diff --git a/docs/examples/setup.py b/docs/examples/setup.py new file mode 100644 index 0000000..78a92d6 --- /dev/null +++ b/docs/examples/setup.py @@ -0,0 +1,3 @@ +import pyvista + +pyvista.global_theme.jupyter_backend = "client" diff --git a/docs/index.rst b/docs/index.rst index b62bf38..9060e7d 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -10,6 +10,6 @@ It is built on top of the `pyvista` package, which itself is built as a Python i installing getting_started - generated/gallery/index + examples/index api changelog diff --git a/setup.cfg b/setup.cfg index 098af7d..0a90e92 100644 --- a/setup.cfg +++ b/setup.cfg @@ -35,7 +35,7 @@ setup_requires = setuptools_scm install_requires = pfsspy>=1.1.2 - pyvista>= 0.38.4 + pyvista[all,trame]>= 0.38.4 sunpy[map]>=4.0.0 [options.extras_require] @@ -45,13 +45,14 @@ tests = pytest-doctestplus scikit-image docs = + jupyter-sphinx sphinx sphinx-automodapi sphinx-changelog - streamtracer sphinx-gallery + streamtracer sunpy-sphinx-theme - ipython + trame [options.package_data] sunkit_pyvista = data/*