Skip to content

Commit

Permalink
Add github actions doc build
Browse files Browse the repository at this point in the history
  • Loading branch information
dstansby committed Jun 25, 2021
1 parent 1a0ad47 commit 6595bbd
Show file tree
Hide file tree
Showing 6 changed files with 62 additions and 23 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/build_docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Build docs

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install .[docs]
- name: Build docs
run: |
cd docs
make html
19 changes: 0 additions & 19 deletions .readthedocs.yaml

This file was deleted.

14 changes: 13 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
'sphinx.ext.napoleon',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
'sphinx_gallery.gen_gallery'
'sphinx_gallery.gen_gallery',
'jupyter_sphinx.execute'
]

# Add any paths that contain templates here, relative to this directory.
Expand Down Expand Up @@ -126,3 +127,14 @@
'remove_config_comments': True,
'doc_module': ('sunkit_pyvista'),
}

import pyvista
import numpy as np

# Manage errors
pyvista.set_error_output_file("errors.txt")
# Ensure that offscreen rendering is used for docs generation
pyvista.OFF_SCREEN = True # Not necessary - simply an insurance policy
# Preferred plotting style for documentation
pyvista.set_plot_theme("document")
pyvista.global_theme.window_size = np.array([512, 256]) * 2
20 changes: 19 additions & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,25 @@
sunkit-pyvista Documentation
****************************

This is the documentation for sunkit-pyvista.
.. jupyter-execute::
:hide-code:

# using ipyvtk as it loads faster
import pyvista
pyvista.set_jupyter_backend('ipygany')

``sunkit-pyvista`` is a python package for visualising solar physics data in
3D. As a quick example:


.. jupyter-execute::

grid = pyvista.Sphere()

plotter = pyvista.Plotter()
plotter.add_mesh(grid)
plotter.show()


.. toctree::
:maxdepth: 2
Expand Down
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@ tests =
pytest-cov
pytest-doctestplus
docs =
ipygany
jupyter-sphinx
sphinx
sphinx-automodapi
sphinx-automodapi
Expand Down
3 changes: 1 addition & 2 deletions sunkit_pyvista/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def _coords_to_xyz(self, coords):

def set_camera_coordinate(self, coord):
"""
Sets the inital camera position of the rendered plot.
Sets the camera position.
Parameters
----------
Expand All @@ -91,7 +91,6 @@ def set_view_angle(self, angle: u.deg):
if not view_angle > 0 and view_angle <= 180:
raise ValueError("specified view angle must be "
"0 deg < angle <= 180 deg")
# Zoom/view_angle = current view angle (default is set to 30 degrees) / 1
zoom_value = self.camera.view_angle / view_angle
self.plotter.camera.zoom(zoom_value)

Expand Down

0 comments on commit 6595bbd

Please sign in to comment.