Skip to content

MRG: refactoring doc build #429

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

Merged
merged 18 commits into from
Mar 15, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 52 additions & 18 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,22 @@
# - There can't be any leading "-"s - All newlines will be removed, so use
# ";"s
sudo: false # To use travis container infrastructure

language: python

cache:
directories:
- $HOME/.cache/pip

env:
global:
- DEPENDS="numpy scipy sympy matplotlib nibabel"
- INSTALL_TYPE="setup"
- EXTRA_WHEELS="https://5cf40426d9f06eb7461d-6fe47d9331aba7cd62fc36c7196769e4.ssl.cf2.rackcdn.com"
- PRE_WHEELS="https://7933911d6844c6c53a7d-47bd50c35cd79bd838daf386af554a83.ssl.cf2.rackcdn.com"
- EXTRA_PIP_FLAGS="--find-links=$EXTRA_WHEELS"
- PRE_PIP_FLAGS="--pre $EXTRA_PIP_FLAGS --find-links $PRE_WHEELS"
global:
- DEPENDS="numpy scipy sympy matplotlib nibabel"
- EXTRA_WHEELS="https://5cf40426d9f06eb7461d-6fe47d9331aba7cd62fc36c7196769e4.ssl.cf2.rackcdn.com"
- PRE_WHEELS="https://7933911d6844c6c53a7d-47bd50c35cd79bd838daf386af554a83.ssl.cf2.rackcdn.com"
- EXTRA_PIP_FLAGS="--find-links=$EXTRA_WHEELS"
- PRE_PIP_FLAGS="--pre $EXTRA_PIP_FLAGS --find-links $PRE_WHEELS"
- INSTALL_TYPE="pip"

python:
- 3.4
- 3.5
Expand Down Expand Up @@ -54,11 +58,28 @@ matrix:
env:
- INSTALL_TYPE=requirements
- DEPENDS=
- python: 3.6
# test 3.5 against pre-release builds of everything
- python: 3.5
env:
- EXTRA_PIP_FLAGS="$PRE_PIP_FLAGS"
# test python setup.py install
- python: 3.5
env:
- INSTALL_TYPE=setup
- python: 3.5
env:
- INSTALL_TYPE="pip_e"
- python: 3.5
env:
- DOC_BUILD=1
addons:
apt:
packages:
- graphviz
- texlive-latex-base
- texlive-latex-extra
- texlive-fonts-recommended
- texlive-latex-recommended

before_install:
- source tools/travis_tools.sh
Expand All @@ -77,12 +98,17 @@ before_install:
pip install coverage;
pip install coveralls codecov;
fi

# command to install dependencies
# e.g. pip install -r requirements.txt # --use-mirrors
install:
- |
if [ "$INSTALL_TYPE" == "setup" ]; then
python setup.py install
if [ "$INSTALL_TYPE" == "pip" ]; then
pip install .
elif [ "$INSTALL_TYPE" == "pip_e" ]; then
pip install -e .
elif [ "$INSTALL_TYPE" == "setup" ]; then
python setup.py install
elif [ "$INSTALL_TYPE" == "sdist" ]; then
python setup_egg.py egg_info # check egg_info while we're here
python setup_egg.py sdist
Expand All @@ -96,15 +122,23 @@ install:
pip install -r requirements.txt
python setup.py install
fi
# command to run tests, e.g. python setup.py test

# command to run tests
script:
# Change into an innocuous directory and find tests from installation
- mkdir for_testing
- cd for_testing
- if [ "${COVERAGE}" == "1" ]; then
cp ../.coveragerc .;
COVER_ARGS="--with-coverage --cover-package nipy";
- |
if [ "$DOC_BUILD" ]; then # doc build
pip install -r doc-requirements.txt
make html-stamp pdf-stamp
else
# Change into an innocuous directory and find tests from installation
mkdir for_testing
cd for_testing
if [ "${COVERAGE}" == "1" ]; then
cp ../.coveragerc .
COVER_ARGS="--with-coverage --cover-package nipy"
fi
$PYTHON ../tools/nipnost --verbosity=3 $COVER_ARGS nipy
fi
- $PYTHON ../tools/nipnost --verbosity=3 $COVER_ARGS nipy

after_success:
- if [ "${COVERAGE}" == "1" ]; then coveralls; codecov; fi
11 changes: 4 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ dev: cythonize
test:
cd .. && $(PYTHON) -c 'import nipy; nipy.test()'

build:
$(PYTHON) setup.py build

install:
$(PYTHON) setup.py install

Expand Down Expand Up @@ -113,11 +110,11 @@ recythonize:
$(WWW_DIR):
if [ ! -d $(WWW_DIR) ]; then mkdir -p $(WWW_DIR); fi

htmldoc: build
cd $(DOCSRC_DIR) && PYTHONPATH=$(CURDIR):$(PYTHONPATH) $(MAKE) html
htmldoc:
cd $(DOCSRC_DIR) && $(MAKE) html

pdfdoc: build
cd $(DOCSRC_DIR) && PYTHONPATH=$(CURDIR):$(PYTHONPATH) $(MAKE) latex
pdfdoc:
cd $(DOCSRC_DIR) && $(MAKE) latex
cd $(LATEX_DIR) && $(MAKE) all-pdf

html: html-stamp
Expand Down
27 changes: 8 additions & 19 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -92,36 +92,25 @@ directory of the nipy distribution::
is part of the nose package. Try ``nipnost --help`` to see a large number of
command-line options.

Dependencies
Installation
============

To run NIPY, you will need:
See the latest `installation instructions`_.

* python_ >= 2.6 (tested with 2.6, 2.7, 3.2 through 3.5)
* numpy_ >= 1.6.0
* scipy_ >= 0.9.0
* sympy_ >= 0.7.0
* nibabel_ >= 1.2

You will probably also like to have:
License
=======

* ipython_ for interactive work
* matplotlib_ for 2D plotting
* mayavi_ for 3D plotting
We use the 3-clause BSD license; the full license is in the file ``LICENSE`` in
the nipy distribution.

.. links:
.. _python: http://python.org
.. _numpy: http://numpy.scipy.org
.. _scipy: http://www.scipy.org
.. _sympy: http://sympy.org
.. _nibabel: http://nipy.org/nibabel
.. _ipython: http://ipython.org
.. _matplotlib: http://matplotlib.org
.. _mayavi: http://code.enthought.com/projects/mayavi/
.. _nose: http://nose.readthedocs.org/en/latest
.. _mock: https://pypi.python.org/pypi/mock

License
=======

We use the 3-clause BSD license; the full license is in the file ``LICENSE``
in the nipy distribution.
.. _installation instructions: http://nipy.org/nipy/users/installation.html
4 changes: 4 additions & 0 deletions dev-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Requirements for running tests
-r requirements.txt
nose
mock
8 changes: 8 additions & 0 deletions doc-requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Requirements for building docs
# Check these dependencies against doc/conf.py
-r dev-requirements.txt
sphinx>=1.0
numpydoc
matplotlib
texext
ipython
7 changes: 7 additions & 0 deletions doc/README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ you must have:
* latex (for the PNG mathematics graphics)
* graphviz (for the inheritance diagrams)

For the Python dependencies, do::

pip install -r ../doc-requirements.txt

Files and directories
=====================

This directory contains:

* Makefile - the build script to build the HTML or PDF docs. Type
Expand Down
101 changes: 62 additions & 39 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,42 @@
# serve to show the default value.

import sys, os
from importlib import import_module

import sphinx

# Doc generation depends on being able to import project
project = 'nipy'
try:
project_module = import_module(project)
except ImportError:
raise RuntimeError('Cannot import {}, please investigate'.format(project))

# If your extensions are in another directory, add it here. If the directory
# is relative to the documentation root, use os.path.abspath to make it
# absolute, like shown here.
sys.path.append(os.path.abspath('sphinxext'))

# Get project related strings. Please do not change this line to use
# execfile because execfile is not available in Python 3
_info_fname = os.path.join('..', 'nipy', 'info.py')
rel = {}
exec(open(_info_fname, 'rt').read(), {}, rel)

# Import support for ipython console session syntax highlighting (lives
# in the sphinxext directory defined above)
import ipython_console_highlighting

# 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.doctest',
'sphinx.ext.mathjax',
'sphinx.ext.autosummary',
'sphinx.ext.inheritance_diagram',
'numpy_ext.numpydoc',
'matplotlib.sphinxext.plot_directive',
'matplotlib.sphinxext.only_directives', # needed for above
]
extensions = [
'texext.mathcode',
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.mathjax',
'sphinx.ext.autosummary',
'texext.math_dollar',
'numpydoc',
'sphinx.ext.inheritance_diagram',
'matplotlib.sphinxext.plot_directive',
'IPython.sphinxext.ipython_console_highlighting',
]

# Autosummary on
autosummary_generate=True
Expand All @@ -56,17 +62,15 @@
# The master toctree document.
master_doc = 'index'

# General substitutions.
project = 'nipy'

#copyright = ':ref:`2005-2010, Neuroimaging in Python team. <nipy-software-license>`'
# copyright = ':ref:`2005-2017, Neuroimaging in Python team.
# <nipy-software-license>`'
copyright = '2005-2017, Neuroimaging in Python team'

# The default replacements for |version| and |release|, also used in various
# other places throughout the built documents.
#
# The short X.Y version.
version = rel['__version__']
version = project_module.__version__
# The full version, including alpha/beta/rc tags.
release = version

Expand Down Expand Up @@ -164,11 +168,29 @@
# Options for LaTeX output
# ------------------------

# The paper size ('letter' or 'a4').
#latex_paper_size = 'letter'
# Additional stuff for the LaTeX preamble.
_latex_preamble = """
\usepackage{amsmath}
\usepackage{amssymb}
% Uncomment these two if needed
%\usepackage{amsfonts}
%\usepackage{txfonts}
"""

latex_elements = {
# The paper size ('letterpaper' or 'a4paper').
#'papersize': 'letterpaper',

# The font size ('10pt', '11pt' or '12pt').
#latex_font_size = '10pt'
#'pointsize': '10pt',

# Additional stuff for the LaTeX preamble.
#'preamble': '',

# Latex figure (float) alignment
#'figure_align': 'htbp',
'preamble': _latex_preamble,
}

# Grouping the document tree into LaTeX files. List of tuples
# (source start file, target name, title, author, document class
Expand All @@ -183,21 +205,22 @@
# the title page.
#latex_logo = None

# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
latex_use_parts = True

# Additional stuff for the LaTeX preamble.
latex_preamble = """
\usepackage{amsmath}
\usepackage{amssymb}
% Uncomment these two if needed
%\usepackage{amsfonts}
%\usepackage{txfonts}
"""
if sphinx.version_info[:2] < (1, 4):
# For "manual" documents, if this is true, then toplevel headings are parts,
# not chapters.
latex_use_parts = True
else: # Sphinx >= 1.4
latex_toplevel_sectioning = 'part'

# Documents to append as an appendix to all manuals.
#latex_appendices = []

# If false, no module index is generated.
latex_use_modindex = True

# Numpy extensions
# ----------------
# Worked out by Steven Silvester in
# https://github.com/scikit-image/scikit-image/pull/1356
numpydoc_show_class_members = False
numpydoc_class_members_toctree = False
Binary file added doc/devel/guidelines/gitwash/branch_dropdown.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed doc/devel/guidelines/gitwash/branch_list.png
Binary file not shown.
Binary file removed doc/devel/guidelines/gitwash/branch_list_compare.png
Binary file not shown.
Loading