Skip to content

Commit c5b219d

Browse files
committed
update conf.py & Makefile
1 parent 707aeb3 commit c5b219d

File tree

2 files changed

+368
-0
lines changed

2 files changed

+368
-0
lines changed

docs/Makefile

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line.
5+
SPHINXOPTS =
6+
SPHINXBUILD = sphinx-build
7+
SPHINXPROJ = libpysal
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@rsync -r --exclude '.ipynb_checkpoints/' ../notebooks/ ./notebooks/
21+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
22+
23+
github:
24+
@make html
25+
26+
sync:
27+
@rsync -avh _build/html/ ../docs/ --delete
28+
@make clean
29+
touch .nojekyll
30+
31+
clean:
32+
rm -rf $(BUILDDIR)/*
33+
rm -rf auto_examples/
34+
rm -rf generated/

docs/conf.py

Lines changed: 334 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,334 @@
1+
# -*- coding: utf-8 -*-
2+
#
3+
# libpysal documentation build configuration file, created by
4+
# sphinx-quickstart on Wed Jun 6 15:54:22 2018.
5+
#
6+
# This file is execfile()d with the current directory set to its
7+
# containing dir.
8+
#
9+
# Note that not all possible configuration values are present in this
10+
# autogenerated file.
11+
#
12+
# All configuration values have a default; values that are commented out
13+
# serve to show the default.
14+
15+
# If extensions (or modules to document with autodoc) are in another directory,
16+
# add these directories to sys.path here. If the directory is relative to the
17+
# documentation root, use os.path.abspath to make it absolute, like shown here.
18+
#
19+
import sys, os
20+
import sphinx_bootstrap_theme
21+
22+
23+
sys.path.insert(0, os.path.abspath("../"))
24+
25+
import libpysal
26+
27+
28+
# -- General configuration ------------------------------------------------
29+
30+
# If your documentation needs a minimal Sphinx version, state it here.
31+
#
32+
# needs_sphinx = '1.0'
33+
# Add any Sphinx extension module names here, as strings. They can be
34+
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
35+
# ones.
36+
extensions = [ #'sphinx_gallery.gen_gallery',
37+
"sphinx.ext.autodoc",
38+
"sphinx.ext.autosummary",
39+
"sphinx.ext.viewcode",
40+
"sphinxcontrib.bibtex",
41+
"sphinx.ext.mathjax",
42+
"sphinx.ext.doctest",
43+
"sphinx.ext.intersphinx",
44+
"numpydoc",
45+
#'sphinx.ext.napoleon',
46+
"matplotlib.sphinxext.plot_directive",
47+
"nbsphinx",
48+
]
49+
50+
51+
# sphinx_gallery_conf = {
52+
# # path to your examples scripts
53+
# 'examples_dirs': '../examples',
54+
# # path where to save gallery generated examples
55+
# 'gallery_dirs': 'auto_examples',
56+
# 'backreferences_dir': False,
57+
# }
58+
59+
60+
# Add any paths that contain templates here, relative to this directory.
61+
templates_path = ["_templates"]
62+
63+
# The suffix(es) of source filenames.
64+
# You can specify multiple suffix as a list of string:
65+
#
66+
# source_suffix = ['.rst', '.md']
67+
source_suffix = ".rst"
68+
69+
# The master toctree document.
70+
master_doc = "index"
71+
72+
# General information about the project.
73+
project = "libpysal"
74+
copyright = "2018-, pysal developers"
75+
author = "pysal developers"
76+
77+
# The version info for the project you're documenting, acts as replacement for
78+
# |version| and |release|, also used in various other places throughout the
79+
# built documents.
80+
#
81+
# The full version.
82+
version = libpysal.__version__
83+
release = libpysal.__version__
84+
85+
# The language for content autogenerated by Sphinx. Refer to documentation
86+
# for a list of supported languages.
87+
#
88+
# This is also used if you do content translation via gettext catalogs.
89+
# Usually you set "language" from the command line for these cases.
90+
language = None
91+
92+
# List of patterns, relative to source directory, that match files and
93+
# directories to ignore when looking for source files.
94+
# This patterns also effect to html_static_path and html_extra_path
95+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "tests/*"]
96+
97+
# The name of the Pygments (syntax highlighting) style to use.
98+
pygments_style = "sphinx"
99+
100+
# If true, `todo` and `todoList` produce output, else they produce nothing.
101+
todo_include_todos = False
102+
103+
# -- Options for HTML output ----------------------------------------------
104+
105+
# The theme to use for HTML and HTML Help pages. See the documentation for
106+
# a list of builtin themes.
107+
108+
# html_theme = 'alabaster'
109+
html_theme = "bootstrap"
110+
html_theme_path = sphinx_bootstrap_theme.get_html_theme_path()
111+
html_title = "%s v%s Manual" % (project, version)
112+
113+
# (Optional) Logo. Should be small enough to fit the navbar (ideally 24x24).
114+
# Path should be relative to the ``_static`` files directory.
115+
# html_logo = "_static/images/CGS_logo.jpg"
116+
# html_logo = "_static/images/CGS_logo_green.png"
117+
# html_logo = "_static/images/pysal_logo_small.jpg"
118+
html_favicon = "_static/images/pysal_favicon.ico"
119+
120+
121+
# Theme options are theme-specific and customize the look and feel of a theme
122+
# further. For a list of options available for each theme, see the
123+
# documentation.
124+
#
125+
html_theme_options = {
126+
# Navigation bar title. (Default: ``project`` value)
127+
"navbar_title": project,
128+
# Render the next and previous page links in navbar. (Default: true)
129+
"navbar_sidebarrel": False,
130+
# Render the current pages TOC in the navbar. (Default: true)
131+
#'navbar_pagenav': True,
132+
#'navbar_pagenav': False,
133+
# No sidebar
134+
"nosidebar": True,
135+
# Tab name for the current pages TOC. (Default: "Page")
136+
#'navbar_pagenav_name': "Page",
137+
# Global TOC depth for "site" navbar tab. (Default: 1)
138+
# Switching to -1 shows all levels.
139+
"globaltoc_depth": 2,
140+
# Include hidden TOCs in Site navbar?
141+
#
142+
# Note: If this is "false", you cannot have mixed ``:hidden:`` and
143+
# non-hidden ``toctree`` directives in the same page, or else the build
144+
# will break.
145+
#
146+
# Values: "true" (default) or "false"
147+
"globaltoc_includehidden": "true",
148+
# HTML navbar class (Default: "navbar") to attach to <div> element.
149+
# For black navbar, do "navbar navbar-inverse"
150+
#'navbar_class': "navbar navbar-inverse",
151+
# Fix navigation bar to top of page?
152+
# Values: "true" (default) or "false"
153+
"navbar_fixed_top": "true",
154+
# Location of link to source.
155+
# Options are "nav" (default), "footer" or anything else to exclude.
156+
"source_link_position": "footer",
157+
# Bootswatch (http://bootswatch.com/) theme.
158+
#
159+
# Options are nothing (default) or the name of a valid theme
160+
# such as "amelia" or "cosmo", "yeti", "flatly".
161+
"bootswatch_theme": "yeti",
162+
# Choose Bootstrap version.
163+
# Values: "3" (default) or "2" (in quotes)
164+
"bootstrap_version": "3",
165+
"navbar_links": [
166+
# ("Gallery", "auto_examples/index"),
167+
("Installation", "installation"),
168+
("Tutorial", "tutorial"),
169+
("API", "api"),
170+
("References", "references"),
171+
],
172+
}
173+
174+
# Add any paths that contain custom static files (such as style sheets) here,
175+
# relative to this directory. They are copied after the builtin static files,
176+
# so a file named "default.css" will overwrite the builtin "default.css".
177+
html_static_path = ["_static"]
178+
179+
# Custom sidebar templates, maps document names to template names.
180+
# html_sidebars = {}
181+
# html_sidebars = {'sidebar': ['localtoc.html', 'sourcelink.html', 'searchbox.html']}
182+
183+
# -- Options for HTMLHelp output ------------------------------------------
184+
185+
# Output file base name for HTML help builder.
186+
htmlhelp_basename = "%sdoc" % project
187+
188+
189+
# -- Options for LaTeX output ---------------------------------------------
190+
191+
latex_elements = {
192+
# The paper size ('letterpaper' or 'a4paper').
193+
#
194+
# 'papersize': 'letterpaper',
195+
# The font size ('10pt', '11pt' or '12pt').
196+
#
197+
# 'pointsize': '10pt',
198+
# Additional stuff for the LaTeX preamble.
199+
#
200+
# 'preamble': '',
201+
# Latex figure (float) alignment
202+
#
203+
# 'figure_align': 'htbp',
204+
}
205+
206+
# Grouping the document tree into LaTeX files. List of tuples
207+
# (source start file, target name, title,
208+
# author, documentclass [howto, manual, or own class]).
209+
latex_documents = [
210+
(
211+
master_doc,
212+
"%s.tex" % project,
213+
u"%s Documentation" % project,
214+
u"pysal developers",
215+
"manual",
216+
),
217+
]
218+
219+
220+
# -- Options for manual page output ---------------------------------------
221+
222+
# One entry per manual page. List of tuples
223+
# (source start file, name, description, authors, manual section).
224+
man_pages = [(master_doc, project, u"%s Documentation" % project, [author], 1)]
225+
226+
227+
# -- Options for Texinfo output -------------------------------------------
228+
229+
# Grouping the document tree into Texinfo files. List of tuples
230+
# (source start file, target name, title, author,
231+
# dir menu entry, description, category)
232+
texinfo_documents = [
233+
(
234+
master_doc,
235+
project,
236+
u"%s Documentation" % project,
237+
author,
238+
project,
239+
"One line description of project.",
240+
"Miscellaneous",
241+
),
242+
]
243+
244+
# -----------------------------------------------------------------------------
245+
# Napoleon configuration
246+
# -----------------------------------------------------------------------------
247+
# numpydoc_show_class_members = True
248+
# numpydoc_class_members_toctree = False
249+
#
250+
# napoleon_use_ivar = True
251+
252+
# -----------------------------------------------------------------------------
253+
# Autosummary
254+
# -----------------------------------------------------------------------------
255+
256+
# Generate the API documentation when building
257+
autosummary_generate = True
258+
259+
# avoid showing members twice
260+
numpydoc_show_class_members = False
261+
numpydoc_use_plots = True
262+
class_members_toctree = True
263+
264+
#
265+
numpydoc_show_inherited_class_members = True
266+
numpydoc_xref_param_type = True
267+
268+
# automatically document class members
269+
autodoc_default_options = {"members": True, "undoc-members": True}
270+
271+
# display the source code for Plot directive
272+
plot_include_source = True
273+
274+
275+
def setup(app):
276+
app.add_stylesheet("pysal-styles.css")
277+
278+
279+
# Example configuration for intersphinx: refer to the Python standard library.
280+
intersphinx_mapping = {
281+
"geopandas": ("https://geopandas.readthedocs.io/en/latest/", None),
282+
"libpysal": ("https://pysal.org/libpysal/", None),
283+
"matplotlib": ("https://matplotlib.org/", None),
284+
"networkx": ("https://networkx.github.io/documentation/stable/", None),
285+
"numpy": ("https://docs.scipy.org/doc/numpy", None),
286+
"pandas": ("https://pandas.pydata.org/pandas-docs/stable/", None),
287+
"python": ("https://docs.python.org/3.8/", None),
288+
"scipy": ("https://docs.scipy.org/doc/scipy/reference/", None),
289+
}
290+
291+
292+
# This is processed by Jinja2 and inserted before each notebook
293+
nbsphinx_prolog = r"""
294+
{% set docname = env.doc2path(env.docname, base='') %}
295+
{% set fullpath = env.doc2path(env.docname, base='tree/master/') %}
296+
297+
.. only:: html
298+
299+
.. role:: raw-html(raw)
300+
:format: html
301+
302+
.. nbinfo::
303+
304+
This page was generated from `{{ docname }}`__.
305+
Interactive online version:
306+
:raw-html:`<a href="https://mybinder.org/v2/gh/pysal/libpysal/master?filepath={{ docname }}"><img alt="Binder badge" src="https://mybinder.org/badge_logo.svg" style="vertical-align:text-bottom"></a>`
307+
308+
__ https://github.com/pysal/libpysal/{{ fullpath }}
309+
310+
.. raw:: latex
311+
312+
\nbsphinxstartnotebook{\scriptsize\noindent\strut
313+
\textcolor{gray}{The following section was generated from
314+
\sphinxcode{\sphinxupquote{\strut {{ docname | escape_latex }}}} \dotfill}}
315+
"""
316+
317+
# This is processed by Jinja2 and inserted after each notebook
318+
nbsphinx_epilog = r"""
319+
.. raw:: latex
320+
321+
\nbsphinxstopnotebook{\scriptsize\noindent\strut
322+
\textcolor{gray}{\dotfill\ \sphinxcode{\sphinxupquote{\strut
323+
{{ env.doc2path(env.docname, base='doc') | escape_latex }}}} ends here.}}
324+
"""
325+
326+
# List of arguments to be passed to the kernel that executes the notebooks:
327+
nbsphinx_execute_arguments = [
328+
"--InlineBackend.figure_formats={'svg', 'pdf'}",
329+
"--InlineBackend.rc={'figure.dpi': 96}",
330+
]
331+
332+
mathjax_config = {
333+
"TeX": {"equationNumbers": {"autoNumber": "AMS", "useLabelIds": True}},
334+
}

0 commit comments

Comments
 (0)