-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from QuantEcon/add-docs
DOC: add initial documentation for jupinx utility
- Loading branch information
Showing
7 changed files
with
355 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
.cache/ | ||
.idea | ||
Jupinx.egg-info/ | ||
build/ | ||
dist/ | ||
|
||
docs/_build/ | ||
|
||
jupinx/cmd/__pycache__/ | ||
jupinx/util/__pycache__/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,12 @@ | ||
# jupinx | ||
Jupyter + Sphinx Utilities and Tools | ||
|
||
This software has been adapted from the sphinx documentation tool - http://www.sphinx-doc.org/ | ||
This software has been adapted from the sphinx documentation tool - http://www.sphinx-doc.org/ | ||
|
||
.. |status-docs| image:: https://readthedocs.org/projects/jupinx/badge/?version=latest | ||
:target: http://jupinx.readthedocs.io/en/latest/?badge=latest | ||
:alt: Documentation Status | ||
|
||
+---------------+ | ||
| |status-docs| | | ||
+---------------+ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Minimal makefile for Sphinx documentation | ||
# | ||
|
||
# You can set these variables from the command line. | ||
SPHINXOPTS = | ||
SPHINXBUILD = sphinx-build | ||
SPHINXPROJ = jupinx | ||
SOURCEDIR = . | ||
BUILDDIR = _build | ||
|
||
# Put it first so that "make" without argument is like "make help". | ||
help: | ||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) | ||
|
||
.PHONY: help Makefile | ||
|
||
# Catch-all target: route all unknown targets to Sphinx using the new | ||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). | ||
%: Makefile | ||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
#!/usr/bin/env python3 | ||
# -*- coding: utf-8 -*- | ||
# | ||
# jupinx documentation build configuration file, created by | ||
# sphinx-quickstart | ||
# | ||
# This file is execfile()d with the current directory set to its | ||
# containing dir. | ||
# | ||
# Note that not all possible configuration values are present in this | ||
# autogenerated file. | ||
# | ||
# All configuration values have a default; values that are commented out | ||
# serve to show the default. | ||
|
||
# If extensions (or modules to document with autodoc) are in another directory, | ||
# add these directories to sys.path here. If the directory is relative to the | ||
# documentation root, use os.path.abspath to make it absolute, like shown here. | ||
# | ||
# import os | ||
# import sys | ||
# sys.path.insert(0, os.path.abspath('.')) | ||
|
||
|
||
# -- General configuration ------------------------------------------------ | ||
|
||
# If your documentation needs a minimal Sphinx version, state it here. | ||
# | ||
# needs_sphinx = '1.0' | ||
|
||
# Add any Sphinx extension module names here, as strings. They can be | ||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom | ||
# ones. | ||
extensions = ['sphinx.ext.autodoc', | ||
'sphinx.ext.todo', | ||
'sphinx.ext.mathjax'] | ||
|
||
# Add any paths that contain templates here, relative to this directory. | ||
templates_path = ['_templates'] | ||
|
||
# The suffix(es) of source filenames. | ||
# You can specify multiple suffix as a list of string: | ||
# | ||
# source_suffix = ['.rst', '.md'] | ||
source_suffix = '.rst' | ||
|
||
# The master toctree document. | ||
master_doc = 'index' | ||
|
||
# General information about the project. | ||
project = 'jupinx' | ||
copyright = '2019, QuantEcon Development Team' | ||
author = 'QuantEcon Development Team' | ||
|
||
# The version info for the project you're documenting, acts as replacement for | ||
# |version| and |release|, also used in various other places throughout the | ||
# built documents. | ||
# | ||
# The short X.Y version. | ||
version = '0.0.1' | ||
# The full version, including alpha/beta/rc tags. | ||
release = '0.0.1' | ||
|
||
# The language for content autogenerated by Sphinx. Refer to documentation | ||
# for a list of supported languages. | ||
# | ||
# This is also used if you do content translation via gettext catalogs. | ||
# Usually you set "language" from the command line for these cases. | ||
language = None | ||
|
||
# List of patterns, relative to source directory, that match files and | ||
# directories to ignore when looking for source files. | ||
# This patterns also effect to html_static_path and html_extra_path | ||
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] | ||
|
||
# The name of the Pygments (syntax highlighting) style to use. | ||
pygments_style = 'sphinx' | ||
|
||
# If true, `todo` and `todoList` produce output, else they produce nothing. | ||
todo_include_todos = True | ||
|
||
|
||
# -- Options for HTML output ---------------------------------------------- | ||
|
||
# The theme to use for HTML and HTML Help pages. See the documentation for | ||
# a list of builtin themes. | ||
# | ||
html_theme = "sphinx_rtd_theme" | ||
|
||
# Theme options are theme-specific and customize the look and feel of a theme | ||
# further. For a list of options available for each theme, see the | ||
# documentation. | ||
# | ||
# html_theme_options = {} | ||
|
||
# Add any paths that contain custom static files (such as style sheets) here, | ||
# relative to this directory. They are copied after the builtin static files, | ||
# so a file named "default.css" will overwrite the builtin "default.css". | ||
html_static_path = ['_static'] | ||
|
||
|
||
# -- Options for HTMLHelp output ------------------------------------------ | ||
|
||
# Output file base name for HTML help builder. | ||
htmlhelp_basename = 'sphinxcontrib-jupyterdoc' | ||
|
||
|
||
# -- Options for LaTeX output --------------------------------------------- | ||
|
||
latex_elements = { | ||
# The paper size ('letterpaper' or 'a4paper'). | ||
# | ||
# 'papersize': 'letterpaper', | ||
|
||
# The font size ('10pt', '11pt' or '12pt'). | ||
# | ||
# 'pointsize': '10pt', | ||
|
||
# Additional stuff for the LaTeX preamble. | ||
# | ||
# 'preamble': '', | ||
|
||
# Latex figure (float) alignment | ||
# | ||
# 'figure_align': 'htbp', | ||
} | ||
|
||
# Grouping the document tree into LaTeX files. List of tuples | ||
# (source start file, target name, title, | ||
# author, documentclass [howto, manual, or own class]). | ||
latex_documents = [ | ||
(master_doc, 'jupinx.tex', 'Jupinx Documentation', | ||
'QuantEcon Development Team', 'manual'), | ||
] | ||
|
||
|
||
# -- Options for manual page output --------------------------------------- | ||
|
||
# One entry per manual page. List of tuples | ||
# (source start file, name, description, authors, manual section). | ||
man_pages = [ | ||
(master_doc, 'jupinx', 'Jupinx Documentation', | ||
[author], 1) | ||
] | ||
|
||
|
||
# -- Options for Texinfo output ------------------------------------------- | ||
|
||
# Grouping the document tree into Texinfo files. List of tuples | ||
# (source start file, target name, title, author, | ||
# dir menu entry, description, category) | ||
texinfo_documents = [ | ||
(master_doc, 'jupinx', 'Jupinx Documentation', | ||
author, 'jupinx', 'Jupyter + Sphinx Utilities and Tools', | ||
'Miscellaneous'), | ||
] | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
.. _custom_configuration: | ||
|
||
Custom Configuration | ||
==================== | ||
|
||
This project depends on `sphinxcontrib-jupyter <https://github.com/QuantEcon/sphinxcontrib-jupyter>`__ | ||
to modify ``sphinx`` to work with Jupyter notebooks. | ||
|
||
Full documentation for the extension can be found `here <http://sphinxcontrib-jupyter.readthedocs.io/en/latest/?badge=latest>`__ | ||
|
||
An Example | ||
---------- | ||
|
||
Let's say you have a collection of notebooks that you would like pre-executed. | ||
You can do this by modifying the ``conf.py`` file to enable notebook execution. | ||
|
||
Add the following in the ``conf.py`` in the `jupyter` options section: | ||
|
||
.. code-block:: python | ||
jupyter_execute_notebooks = True | ||
as documented `here <https://sphinxcontrib-jupyter.readthedocs.io/en/latest/config-extension-execution.html#jupyter-execute-notebooks>`__ | ||
|
||
and let's imagine some of your documents produce a file required by a future | ||
document in your collection. An execution dependency can be added by: | ||
|
||
.. code-block:: python | ||
jupyter_dependency_lists = { | ||
'lecture2' : ['lecture1'] | ||
'lecture3' : ['lecture1'] | ||
} | ||
as documented `here <https://sphinxcontrib-jupyter.readthedocs.io/en/latest/config-extension-execution.html#jupyter-dependency-lists>`__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
``Jupinx`` Documentation | ||
======================================= | ||
|
||
Jupinx is a collection of utilities and tools for Jupyter and Sphinx | ||
|
||
**Requires:** Sphinx >= 1.8.5 (for running tests). | ||
|
||
.. toctree:: | ||
:maxdepth: 1 | ||
:caption: Contents: | ||
|
||
quickstart | ||
custom-config | ||
|
||
|
||
Credits | ||
------- | ||
|
||
This project is supported by `QuantEcon <https://www.quantecon.org>`__ | ||
|
||
Many thanks to the lead developers of this project. | ||
|
||
* `@AakashGfude <https://github.com/AakashGfude>`__ | ||
|
||
LICENSE | ||
======= | ||
|
||
Copyright © 2019 QuantEcon Development Team: BSD-3 All rights reserved. | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are | ||
met: | ||
|
||
1. Redistributions of source code must retain the above copyright | ||
notice, this list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright | ||
notice, this list of conditions and the following disclaimer in the | ||
documentation and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS | ||
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED | ||
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A | ||
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT | ||
HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, | ||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED | ||
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR | ||
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF | ||
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING | ||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
|
||
Indices and tables | ||
================== | ||
|
||
* :ref:`genindex` | ||
* :ref:`modindex` | ||
* :ref:`search` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
.. _quickstart: | ||
|
||
jupinx-quickstart | ||
================= | ||
|
||
A quickstart utility has been developed to help users get setup quickly | ||
with Sphinx, configured in a way to get building collections of Jupyter notebooks | ||
quickly. | ||
|
||
Installation | ||
------------ | ||
|
||
To install `jupinx <https://github.com/QuantEcon/jupinx>`__: | ||
|
||
.. warning:: | ||
|
||
This project is **not** yet released through PyPI. Please instead install | ||
using: :code:`python setup.py install` from within a clone of the | ||
repository. | ||
|
||
.. code-block:: bash | ||
pip install jupinx | ||
.. note:: | ||
|
||
``Windows`` is currently not tested or supported. | ||
See `Issue #7 <https://github.com/QuantEcon/jupinx/issues/7>`_ | ||
|
||
Running :code:`jupinx-quickstart` | ||
--------------------------------- | ||
|
||
Once, ``jupinx`` is installed, to run the jupinx quickstart program you can run: | ||
|
||
.. code-block:: bash | ||
jupinx-quickstart | ||
on a terminal. | ||
|
||
The ``jupinx-quickstart`` will: | ||
|
||
#. setup a `directory structure <Directory_structure>`_ for your project | ||
#. check for ``sphinxcontrib-jupyter`` installation | ||
#. construct ``Makefile`` and `conf.p`` files | ||
#. a parent document ``source/index.rst`` | ||
|
||
after running the quickstart you may run ``make jupyter`` to build the project | ||
|
||
Directory structure | ||
------------------- | ||
|
||
The following directory structure is adopted during the setup: | ||
|
||
- ``./`` | ||
- ``source``: where source RST files should be added | ||
- ``source/_static``: where _static assets such as figures and images are kept | ||
- ``theme``: allows you to customise builders using themes and templates | ||
- ``Makefile``: provides ``make`` commands for compiling the project | ||
- ``conf.py``: provides configuration for ``sphinx-build`` | ||
|
||
.. note:: | ||
|
||
``sphinx`` is actually quite flexible in setting up a project in a way | ||
that suits your workflow. If you want to change directory structure this | ||
is likely possible but you will need to update your ``Makefile`` |