Commit 45ca2945 authored by Duncan Macleod's avatar Duncan Macleod

docs: added sphinx documentation

parent 2b400d60
......@@ -8,3 +8,4 @@ build
dist
glue/git_version.py
src/conf/s6_db2/*.sql
/docs/_build
......@@ -137,6 +137,20 @@ build:debian:stretch:
# -- deploy -----------------
pages:
stage: deploy
image: python
before_script:
- apt-get -yqq install python-sphinx
script:
- python setup.py build_sphinx
- mv build/sphinx/html public
artifacts:
paths:
- public
only:
- tags
deploy:
stage: deploy
image: python
......
# Makefile for Sphinx documentation
#
# You can set these variables from the command line.
SPHINXOPTS =
SPHINXBUILD = sphinx-build
SPHINXPROJ = ligo-segments
SOURCEDIR = .
BUILDDIR = _build
.PHONY: help html
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
html:
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.icon {
font-size: 24px !important;
}
pre {
font-size: 14px !important;
}
div[class^='highlight'] {
background-color: #272822;
}
code,
.rst-content code {
border: none;
font-size: inherit;
padding: 0px;
background-color: #f9f2f4;
}
.rst-content code.xref {
background: none;
color: #e74C3c;
}
.gp {
color: #999;
}
# -*- coding: utf-8 -*-
#
# ligo-segments documentation build configuration file
import glob
import os.path
import re
from ligo.segments import __version__ as VERSION
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.doctest',
'sphinx.ext.autosummary',
]
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
# General information about the project.
project = u'ligo-segments'
copyright = u'2018, Kipp Cannon'
author = u'Kipp Cannon'
# The short X.Y version.
version = re.split('[\w-]', VERSION)[0]
# The full version, including alpha/beta/rc tags.
release = VERSION
# 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 = 'monokai'
# Don't complain about remote URIs for images
suppress_warnings = ['image.nonlocal_uri']
# -- 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'
# 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']
# Output file base name for HTML help builder.
htmlhelp_basename = 'ligo-segmentsdoc'
# -- add static files----------------------------------------------------------
def setup_static_content(app):
# configure stylesheets
for sdir in html_static_path:
# add stylesheets
cssdir = os.path.join(sdir, 'css')
for cssf in glob.glob(os.path.join(cssdir, '*.css')):
app.add_stylesheet(cssf.split(os.path.sep, 1)[1])
# add custom javascript
jsdir = os.path.join(sdir, 'js')
for jsf in glob.glob(os.path.join(jsdir, '*.js')):
app.add_javascript(jsf.split(os.path.sep, 1)[1])
# -- setup --------------------------------------------------------------------
def setup(app):
setup_static_content(app)
=============
ligo.segments
=============
|pypi-version| |license| |python-versions|
.. automodule:: ligo.segments
:inherited-members:
:imported-members:
:show-inheritance:
.. |pypi-version| image:: https://badge.fury.io/py/ligo-segments.svg
:target: http://badge.fury.io/py/ligo-segments
.. |license| image:: https://img.shields.io/pypi/l/ligo-segments.svg
:target: https://choosealicense.com/licenses/gpl-3.0/
.. |python-versions| image:: https://img.shields.io/pypi/pyversions/ligo-segments.svg
:target: http://badge.fury.io/py/ligo-segments
......@@ -23,6 +23,7 @@ import sys
from setuptools import (setup, find_packages, Extension)
cmdclass = {}
# get version
def find_version(path):
......@@ -43,9 +44,18 @@ setup_requires = ['setuptools']
install_requires = ['six']
# add test dependencies
if set(('pytest', 'test', 'prt')).intersection(sys.argv):
if {'pytest', 'test', 'prt'}.intersection(sys.argv):
setup_requires.append('pytest_runner')
# add documentation dependencies
if {'build_sphinx'}.intersection(sys.argv):
setup_requires.extend([
'sphinx',
'sphinx_rtd_theme',
])
from sphinx.setup_command import BuildDoc
cmdclass['build_sphinx'] = BuildDoc
# define extension
csegments = Extension(
'ligo.__segments',
......@@ -59,8 +69,10 @@ setup(name='ligo-segments',
description='Representations of semi-open intervals',
author='Kipp Cannon',
author_email='kipp.cannon@ligo.org',
license='GPLv3',
packages=packages,
namespace_packages=['ligo'],
cmdclass=cmdclass,
setup_requires=setup_requires,
install_requires=install_requires,
ext_modules=[csegments],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment