Skip to content

Commit

Permalink
Clean up sphinx settings
Browse files Browse the repository at this point in the history
  • Loading branch information
TomDonoghue committed Mar 15, 2020
1 parent 1c4a6ed commit 414ff94
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 136 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,4 @@ doc/auto_examples/*
doc/auto_tutorials/*
doc/auto_motivations/*
doc/generated/*
doc/backrefs/*
175 changes: 41 additions & 134 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,39 +2,32 @@
#
# Configuration file for the Sphinx documentation builder.
#
# This file does only contain a selection of the most common options. For a
# full list see the documentation:
# http://www.sphinx-doc.org/en/master/config
# For a full list of documentation options, see:
# https://www.sphinx-doc.org/en/master/usage/configuration.html


# ----------------------------------------------------------------------------

import os
from os.path import dirname as up

from datetime import date

import sphinx_gallery
import sphinx_bootstrap_theme
from sphinx_gallery.sorting import FileNameSortKey, ExplicitOrder

# -- Path setup --------------------------------------------------------------

# 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('.'))

# -- Project information -----------------------------------------------------

# Set project information
project = 'fooof'
copyright = '2018 - VoytekLab'
copyright = '2018-{}, VoytekLab'.format(date.today().year)
author = 'Thomas Donoghue'

# Get the current version number from inside the module
# Get and set the current version number
from fooof import __version__

# The short X.Y version
version = __version__
# The full version, including alpha/beta/rc tags
release = version


Expand All @@ -44,69 +37,57 @@
#
# 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.
# Note: uses extra dependency 'm2r' to convert markdown README to an rst file
# Add any Sphinx extension module names here, as strings.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.autosummary',
'sphinx.ext.doctest',
'sphinx.ext.intersphinx',
'sphinx.ext.githubpages',
'sphinx.ext.mathjax',
'sphinx.ext.intersphinx',
'sphinx.ext.viewcode',
'sphinx_gallery.gen_gallery',
'numpydoc',
'm2r'
]

# This is a hack to deal with an issue that otherwise raises a lot of warning when building documentation.
# See: https://github.com/numpy/numpydoc/issues/69
# Also related: https://stackoverflow.com/questions/34216659/sphinx-autosummary-produces-two-summaries-for-each-class
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path .
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']

# numpydoc interacts with autosummary, that creates excessive warnings
# This line is a 'hack' for that interaction that stops the warnings
numpydoc_show_class_members = False

# Set to generate sphinx docs for class members (methods)
autodoc_default_flags = ['members']
autodoc_default_options = {
'members': None,
'no-inherited-members': None,
}

# generate autosummary even if no references
autosummary_generate = True

# 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:
# The suffix(es) of source filenames. Can be str or list of string
source_suffix = '.rst' # ['.rst', '.md']

# The master toctree document.
master_doc = 'index'

# 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 pattern also affects 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'


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
# The theme to use for HTML and HTML Help pages.
html_theme = 'bootstrap'

# 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.
#
# Theme options to customize the look and feel, which are theme-specific.
html_theme_options = {
'navbar_sidebarrel': False,
'navbar_links': [
Expand All @@ -119,94 +100,22 @@
("Reference", "reference"),
("GitHub", "https://github.com/fooof-tools/fooof", True)
],

# Bootswatch (http://bootswatch.com/) theme to apply.
'bootswatch_theme': "flatly",

# Drop the page & source links in the navbar
# Render the current pages TOC in the navbar
'navbar_pagenav': False,
'source_link_position': False
}

# 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']

# Custom sidebar templates, must be a dictionary that maps document names
# to template names.
#
# The default sidebars (for documents that don't match any pattern) are
# defined by theme itself. Builtin themes are using these templates by
# default: ``['localtoc.html', 'relations.html', 'sourcelink.html',
# 'searchbox.html']``.
#
# html_sidebars = {}

####

# def setup(app):
# app.add_stylesheet("my-styles.css") # also can be a full URL
# # app.add_stylesheet("ANOTHER.css")
# # app.add_stylesheet("AND_ANOTHER.css")


# -- Options for HTMLHelp output ---------------------------------------------

# Output file base name for HTML help builder.
htmlhelp_basename = 'fooofdoc'

# -- 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, 'fooof.tex', 'FOOOF Documentation',
'Thomas Donoghue', '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, 'fooof', 'FOOOF 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, 'fooof', 'FOOOF Documentation',
author, 'fooof', 'Parameterizing neural power spectra.',
'Miscellaneous'),
]
# Settings for whether to copy over and show link rst source pages
html_copy_source = False
html_show_sourcelink = False


# -- Extension configuration -------------------------------------------------

# Configurations for sphinx gallery
sphinx_gallery_conf = {
'examples_dirs': ['../examples', '../tutorials', '../motivations'],
'gallery_dirs': ['auto_examples', 'auto_tutorials', 'auto_motivations'],
Expand All @@ -218,10 +127,8 @@
'../motivations/measurements']),
'within_subsection_order': FileNameSortKey,
'default_thumb_file': 'img/spectrum.png',
'backreferences_dir': 'generated',
'reference_url': {
'fooof': None,
'numpy': 'http://docs.scipy.org/doc/numpy-1.9.1',
'scipy': 'http://docs.scipy.org/doc/scipy-0.17.0/reference'
}
# Settings for linking between examples & API examples
'backreferences_dir': 'backrefs',
'doc_module': ('fooof',),
'reference_url': {'fooof': None}
}
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
# Only update here in coordination with the README, to keep things consistent.
LONG_DESCRIPTION = \
"""
Fitting Oscillations & One-Over F (FOOOF)
FOOOF: Fitting Oscillations & One-Over F
FOOOF is a fast, efficient, physiologically-informed model to parameterize neural
power spectra, characterizing both the aperiodic & periodic components.
Expand Down Expand Up @@ -69,7 +69,8 @@
'Programming Language :: Python',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7'
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8'
],
platforms = 'any',
project_urls = {
Expand Down

0 comments on commit 414ff94

Please sign in to comment.