Skip to content

Commit

Permalink
fixup! WIP: Generate docs/conf.py
Browse files Browse the repository at this point in the history
  • Loading branch information
hunse committed May 1, 2019
1 parent 03f0146 commit 61bd629
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 38 deletions.
3 changes: 3 additions & 0 deletions nengo_bones/scripts/generate_bones.py
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,9 @@ def config_format_list(config, key):
conf_config.setdefault("description", config["description"])
conf_config.setdefault("copyright_start", config["copyright_start"])
conf_config.setdefault("copyright_end", config["copyright_end"])
conf_config.setdefault("extensions", [])
conf_config.setdefault("pygments_style", "default")
conf_config.setdefault("nengo_logo", "general-full-light.svg")

# conf_config["data_files"] = format_list(
# conf_config.get("data_files", {}).items(),
Expand Down
79 changes: 41 additions & 38 deletions nengo_bones/templates/docs_conf.py.template
Original file line number Diff line number Diff line change
Expand Up @@ -22,43 +22,47 @@ except ImportError:

def copy_examples(app, exception):
if exception is None:
download_path = os.path.join(app.outdir, '_downloads')
dest_path = os.path.join(download_path, 'examples')
download_path = os.path.join(app.outdir, "_downloads")
dest_path = os.path.join(download_path, "examples")
if not os.path.exists(download_path):
os.mkdir(download_path)
if os.path.exists(dest_path):
shutil.rmtree(dest_path)
shutil.copytree(os.path.join(app.srcdir, 'examples'), dest_path)
shutil.copytree(os.path.join(app.srcdir, "examples"), dest_path)


def setup(app):
app.connect('build-finished', copy_examples)
app.connect("build-finished", copy_examples)


extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.githubpages',
'sphinx.ext.intersphinx',
'sphinx.ext.mathjax',
'sphinx.ext.todo',
'sphinx.ext.viewcode',
'nengo_sphinx_theme',
'nbsphinx',
'numpydoc',
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
"sphinx.ext.githubpages",
"sphinx.ext.intersphinx",
"sphinx.ext.mathjax",
"sphinx.ext.todo",
"sphinx.ext.viewcode",
"nengo_sphinx_theme",
"nbsphinx",
"numpydoc",
{% for ext in extensions %}
"{{ ext }}",
{% endfor %}
]

# -- sphinx.ext.autodoc
autoclass_content = 'both' # class and __init__ docstrings are concatenated
autoclass_content = "both" # class and __init__ docstrings are concatenated
autodoc_default_options = {"members": None}
autodoc_member_order = 'bysource' # default is alphabetical
autodoc_member_order = "bysource" # default is alphabetical

# -- sphinx.ext.intersphinx
intersphinx_mapping = {
'numpy': ('https://docs.scipy.org/doc/numpy', None),
'python': ('https://docs.python.org/3', None),
'scipy': ('https://docs.scipy.org/doc/scipy/reference', None),
'sklearn': ('https://scikit-learn.org/dev', None),
"numpy": ("https://docs.scipy.org/doc/numpy", None),
"python": ("https://docs.python.org/3", None),
{% for key, val in intersphinx_mapping.items() %}
"{{ key }}": ("{{ val }}", None),
{% endfor %}
}

# -- sphinx.ext.todo
Expand All @@ -71,64 +75,63 @@ numpydoc_show_class_members = False
nbsphinx_timeout = -1

# -- sphinx
needs_sphinx = '1.3'
needs_sphinx = "1.3"
nitpicky = True
exclude_patterns = ['_build', '**/.ipynb_checkpoints']
exclude_patterns = ["_build", "**/.ipynb_checkpoints"]
linkcheck_timeout = 30
source_suffix = '.rst'
source_encoding = 'utf-8'
master_doc = 'index'
source_suffix = ".rst"
source_encoding = "utf-8"
master_doc = "index"

project = "{{ project_name }}"
authors = "{{ author }}"
copyright = "{{ copyright_start }}-{{ copyright_end }} {{ author }}"
version = '.'.join({{ pkg_name }}.__version__.split('.')[:2]) # Short X.Y version
version = ".".join({{ pkg_name }}.__version__.split(".")[:2]) # Short X.Y version
release = {{ pkg_name }}.__version__ # Full version, with tags
pygments_style = 'default'

# -- Options for HTML output --------------------------------------------------
pygments_style = "{{ pygments_style }}"

pygments_style = "sphinx"
# -- Options for HTML output --------------------------------------------------
templates_path = ["_templates"]
html_static_path = ["_static"]

html_theme = "nengo_sphinx_theme"

html_title = "{{ project_name }} {0} docs".format(release)
htmlhelp_basename = "{{ project_name }}"
html_last_updated_fmt = '' # Suppress 'Last updated on:' timestamp
html_last_updated_fmt = "" # Suppress "Last updated on:" timestamp
html_show_sphinx = False
html_favicon = os.path.join("_static", "favicon.ico")
html_theme_options = {
"sidebar_logo_width": 200,
"nengo_logo": "general-full-light.svg",
"nengo_logo": "{{ nengo_logo }}",
}

# -- Options for LaTeX output -------------------------------------------------

latex_elements = {
'papersize': 'letterpaper',
'pointsize': '11pt',
# 'preamble': '',
"papersize": "letterpaper",
"pointsize": "11pt",
# "preamble": "",
}

latex_documents = [
# (source start file, target, title, author, documentclass [howto/manual])
('index', '{{ pkg_name }}.tex', html_title, authors, 'manual'),
("index", "{{ pkg_name }}.tex", html_title, authors, "manual"),
]

# -- Options for manual page output -------------------------------------------

man_pages = [
# (source start file, name, description, authors, manual section).
('index', '{{ pkg_name }}', html_title, [authors], 1)
("index", "{{ pkg_name }}", html_title, [authors], 1)
]

# -- Options for Texinfo output -----------------------------------------------

texinfo_documents = [
# (source start file, target, title, author, dir menu entry,
# description, category)
('index', '{{ pkg_name }}', html_title, authors, '{{ project_name }}',
'{{ description }}', 'Miscellaneous'),
("index", "{{ pkg_name }}", html_title, authors, "{{ project_name }}",
"{{ description }}", "Miscellaneous"),
]

0 comments on commit 61bd629

Please sign in to comment.