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

Initial documentation #77

Merged
merged 10 commits into from
Apr 15, 2019
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Sphinx & coverage
build
doc/_build
doc/api
docs/_build
docs/api
glue/tests/htmlcov
*.coverage
*htmlcov*
Expand Down
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,18 @@ install:
- pip install -e .[test]

script:

# Run test suite
- pytest --cov glue_jupyter glue_jupyter -p no:warnings

# Check notebooks
- pip install astroquery pyyaml
- python .validate-notebooks.py

# Test documentation build
- pip install -e .[docs]
- cd docs
- make html

after_success:
- codecov
133 changes: 133 additions & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
# Makefile for Sphinx documentation
#

# You can set these variables from the command line.
SPHINXOPTS = -W --keep-going
SPHINXBUILD = sphinx-build
PAPER =
BUILDDIR = _build

# Internal variables.
PAPEROPT_a4 = -D latex_paper_size=a4
PAPEROPT_letter = -D latex_paper_size=letter
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .

.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest

#This is needed with git because git doesn't create a dir if it's empty
$(shell [ -d "_static" ] || mkdir -p _static)

help:
@echo "Please use \`make <target>' where <target> is one of"
@echo " html to make standalone HTML files"
@echo " dirhtml to make HTML files named index.html in directories"
@echo " singlehtml to make a single large HTML file"
@echo " pickle to make pickle files"
@echo " json to make JSON files"
@echo " htmlhelp to make HTML files and a HTML help project"
@echo " qthelp to make HTML files and a qthelp project"
@echo " devhelp to make HTML files and a Devhelp project"
@echo " epub to make an epub"
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
@echo " latexpdf to make LaTeX files and run them through pdflatex"
@echo " text to make text files"
@echo " man to make manual pages"
@echo " changes to make an overview of all changed/added/deprecated items"
@echo " linkcheck to check all external links for integrity"

clean:
-rm -rf $(BUILDDIR)
-rm -rf api
-rm -rf generated

html:
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."

dirhtml:
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
@echo
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."

singlehtml:
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
@echo
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."

pickle:
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
@echo
@echo "Build finished; now you can process the pickle files."

json:
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
@echo
@echo "Build finished; now you can process the JSON files."

htmlhelp:
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
@echo
@echo "Build finished; now you can run HTML Help Workshop with the" \
".hhp project file in $(BUILDDIR)/htmlhelp."

qthelp:
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
@echo
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/Astropy.qhcp"
@echo "To view the help file:"
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/Astropy.qhc"

devhelp:
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
@echo
@echo "Build finished."
@echo "To view the help file:"
@echo "# mkdir -p $$HOME/.local/share/devhelp/Astropy"
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/Astropy"
@echo "# devhelp"

epub:
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
@echo
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."

latex:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
@echo "Run \`make' in that directory to run these through (pdf)latex" \
"(use \`make latexpdf' here to do that automatically)."

latexpdf:
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
@echo "Running LaTeX files through pdflatex..."
make -C $(BUILDDIR)/latex all-pdf
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."

text:
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
@echo
@echo "Build finished. The text files are in $(BUILDDIR)/text."

man:
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
@echo
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."

changes:
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
@echo
@echo "The overview file is in $(BUILDDIR)/changes."

linkcheck:
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
@echo
@echo "Link check complete; look for any errors in the above output " \
"or in $(BUILDDIR)/linkcheck/output.txt."

doctest:
@echo "Run 'python setup.py test' in the root directory to run doctests " \
@echo "in the documentation."
35 changes: 35 additions & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
API Documentation
=================
General
-------
.. automodapi:: glue_jupyter

.. automodapi:: glue_jupyter.app

.. automodapi:: glue_jupyter.view

.. automodapi:: glue_jupyter.common.state3d

.. automodapi:: glue_jupyter.compat

bqplot viewers
--------------

.. automodapi:: glue_jupyter.bqplot.common

.. automodapi:: glue_jupyter.bqplot.histogram

.. automodapi:: glue_jupyter.bqplot.image

.. automodapi:: glue_jupyter.bqplot.profile

.. automodapi:: glue_jupyter.bqplot.scatter

ipyvolume viewers
-----------------

.. automodapi:: glue_jupyter.ipyvolume.common

.. automodapi:: glue_jupyter.ipyvolume.scatter

.. automodapi:: glue_jupyter.ipyvolume.volume
48 changes: 39 additions & 9 deletions docs/source/conf.py → docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,15 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.autodoc',
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.mathjax',
'sphinx.ext.viewcode',
'nbsphinx']
'sphinx.ext.intersphinx',
'sphinx.ext.todo',
'sphinx.ext.mathjax',
'sphinx.ext.viewcode',
'nbsphinx', 'numpydoc',
'sphinx_automodapi.automodapi',
'sphinx_automodapi.smart_resolver']

numpydoc_show_class_members = False

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
Expand Down Expand Up @@ -170,8 +174,34 @@
'Miscellaneous'),
]




# Example configuration for intersphinx: refer to the Python standard library.
intersphinx_mapping = {'https://docs.python.org/': None}
intersphinx_cache_limit = 10 # days to keep the cached inventories
intersphinx_mapping = {
# 'sphinx': ('https://www.sphinx-doc.org/en/latest/', None),
'python': ('https://docs.python.org/3.7', None),
# 'matplotlib': ('https://matplotlib.org', None),
# 'numpy': ('https://docs.scipy.org/doc/numpy', None),
# 'astropy': ('http://docs.astropy.org/en/stable/', None),
'echo': ('https://echo.readthedocs.io/en/latest/', None),
'ipywidgets': ('https://ipywidgets.readthedocs.io/en/stable/', None),
'traitlets': ('https://traitlets.readthedocs.io/en/stable/', None),
'glue': ('http://docs.glueviz.org/en/latest/', None),
}

default_role = 'obj'
nitpicky = True
nitpick_ignore = [('py:class', 'ipywidgets.widgets.widget_box.Box'),
('py:class', 'ipywidgets.widgets.widget_box.VBox'),
('py:class', 'ipywidgets.widgets.widget.Widget'),
('py:class', 'ipywidgets.widgets.widget.LoggingHasTraits'),
('py:class', 'ipywidgets.widgets.domwidget.DOMWidget'),
('py:class', 'ipywidgets.widgets.widget_core.CoreWidget'),
('py:class', 'traitlets.traitlets.HasTraits'),
('py:class', 'traitlets.traitlets.HasDescriptors'),
('py:class', 'glue.external.echo.core.HasCallbackProperties'),
('py:class', 'glue.viewers.image.layer_artist.ImageLayerArtist'),
('py:class', 'glue.viewers.image.layer_artist.BaseImageLayerArtist'),
('py:class', 'glue_vispy_viewers.volume.layer_state.VolumeLayerState'),
('py:class', 'glue_vispy_viewers.common.layer_state.VispyLayerState')]

automodapi_inheritance_diagram = False
40 changes: 40 additions & 0 deletions docs/getting_started.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Getting started
===============

To start using glue in the Jupyter notebook or Jupyter lab, you will need to
call the :func:`~glue_jupyter.jglue` function::

>>> from glue_jupyter import jglue
>>> app = jglue()

This will automatically set up a data container (called a *data collection* in
glue) and the ``app`` object can then be used to load data, link data, and
create visualizations. For instance, suppose that you have a CSV file that you
want to visualize. Start off by loading it with::

>>> table = app.load_data('mytable.csv')

The ``table`` variable points to a glue `~glue.core.data.Data` object. For more
information about how to work with and extract values from this kind of object
see `this tutorial <http://docs.glueviz.org/en/stable/python_guide/data_tutorial.html>`__
in the main glue documentation.

You can then create visualizations using methods on ``app`` - for example, to
create a histogram visualization, use `~glue_jupyter.JupyterApplication.histogram1d`::

>>> histogram = app.histogram1d(data=table)

for a 2-d scatter plot, use `~glue_jupyter.JupyterApplication.scatter2d`::

>>> scatter2d = app.scatter2d(data=table)

and for a 3-d scatter plot, use `~glue_jupyter.JupyterApplication.scatter3d`::

>>> scatter3d = app.scatter3d(data=table)

Other available visualizations include
`~glue_jupyter.JupyterApplication.profile1d`,
`~glue_jupyter.JupyterApplication.imshow`, and
`~glue_jupyter.JupyterApplication.volshow`.

.. TODO: continue writing this page!
23 changes: 23 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
Glue in the Jupyter Notebook
============================

About
-----

The **glue-jupyter** package provides a way to use the `glue
<http://glueviz.org/>`_ package for multi-dimensional linked-data exploration in
the `Jupyter <https://jupyter.org/>`_ notebook and Jupyter Lab. This package is
still in early development, but it is already possible to try out some of the
functionality. If you run into any issues or would like to request features,
please head over to our `issue tracker
<https://github.com/glue-viz/glue-jupyter/issues>`_.

User guide
----------

.. toctree::
:maxdepth: 1

installing.rst
getting_started.rst
api.rst
18 changes: 18 additions & 0 deletions docs/installing.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Installation
============

To install the latest developer version of the **glue-jupyter** package as
well as its dependencies, you will need the latest developer version of some
dependencies, including glue itself. If you are using conda, we therefore
recommend that you create a new environment::

conda create -n glue-jupyter python=3.7

To install glue-jupyter along with all its dependencies, you can do::

pip install git+https://github.com/glue-viz/glue-jupyter

If you are interested in using glue-jupyter in Jupyter Lab, you will need to
also install the following extensions manually::

jupyter labextension install @jupyter-widgets/jupyterlab-manager bqplot ipyvolume jupyter-threejs
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the same goes for ipyastroimage, but it's not on npm yet, I can give you maintainer rights.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes and ipymaterialui is also missing from npm. I'm happy to deal with ipyastroimage if you like.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In any case, I'll just add these to the list later.

Loading