Skip to content
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

Check and lint sphinx configuration file doc/conf.py #630

Merged
merged 12 commits into from
Sep 23, 2020
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ PYTEST_ARGS=--cov=$(PROJECT) --cov-config=../.coveragerc \
--doctest-modules -v --mpl --mpl-results-path=results \
--pyargs ${PYTEST_EXTRA}
BLACK_FILES=$(PROJECT) setup.py doc/conf.py examples
FLAKE8_FILES=$(PROJECT) setup.py
LINT_FILES=$(PROJECT) setup.py
FLAKE8_FILES=$(PROJECT) setup.py doc/conf.py
LINT_FILES=$(PROJECT) setup.py doc/conf.py

help:
@echo "Commands:"
Expand Down
2 changes: 1 addition & 1 deletion doc/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ help:
@echo " doctest run all doctests embedded in the documentation (if enabled)"

clean:
rm -rf $(BUILDDIR)/html/*
rm -rf $(BUILDDIR)/html
rm -rf $(BUILDDIR)/doctrees
rm -rf $(BUILDDIR)/linkcheck
rm -rf modules
Expand Down
27 changes: 11 additions & 16 deletions doc/conf.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
# -*- coding: utf-8 -*-
import sys
import os
import glob
import shutil
# pylint: disable=invalid-name,redefined-builtin,redefined-builtin
# pylint: disable=missing-module-docstring
seisman marked this conversation as resolved.
Show resolved Hide resolved

import datetime
import sphinx_rtd_theme
import sphinx_gallery
from sphinx_gallery.sorting import FileNameSortKey, ExplicitOrder
from pygmt import __version__, __commit__
from pygmt.sphinx_gallery import PyGMTScraper
Expand Down Expand Up @@ -91,6 +88,7 @@
templates_path = ["_templates"]
exclude_patterns = ["_build", "**.ipynb_checkpoints"]
source_suffix = ".rst"
needs_sphinx = "1.8"
# The encoding of source files.
source_encoding = "utf-8-sig"
master_doc = "index"
Expand Down Expand Up @@ -118,6 +116,7 @@
html_logo = ""
html_favicon = "_static/favicon.png"
html_static_path = ["_static"]
html_css_files = ["style.css"]
html_extra_path = []
pygments_style = "default"
add_function_parentheses = False
Expand All @@ -129,28 +128,29 @@
html_theme = "sphinx_rtd_theme"
html_theme_options = {}
repository = "GenericMappingTools/pygmt"
commit_link = f'<a href="https://github.com/GenericMappingTools/pygmt/commit/{ __commit__ }">{ __commit__[:7] }</a>'
repository_url = "https://github.com/GenericMappingTools/pygmt"
commit_link = f'<a href="{repository_url}/commit/{ __commit__ }">{ __commit__[:7] }</a>'
html_context = {
"menu_links": [
(
'<i class="fa fa-users fa-fw"></i> Contributing',
"https://github.com/GenericMappingTools/pygmt/blob/master/CONTRIBUTING.md",
f"{repository_url}/blob/master/CONTRIBUTING.md",
),
(
'<i class="fa fa-gavel fa-fw"></i> Code of Conduct',
"https://github.com/GenericMappingTools/pygmt/blob/master/CODE_OF_CONDUCT.md",
f"{repository_url}/blob/master/CODE_OF_CONDUCT.md",
),
(
'<i class="fa fa-book fa-fw"></i> License',
"https://github.com/GenericMappingTools/pygmt/blob/master/LICENSE.txt",
f"{repository_url}/blob/master/LICENSE.txt",
),
(
'<i class="fa fa-comment fa-fw"></i> Contact',
"https://forum.generic-mapping-tools.org",
),
(
'<i class="fa fa-github fa-fw"></i> Source Code',
"https://github.com/GenericMappingTools/pygmt",
repository_url,
),
],
# Custom variables to enable "Improve this page"" and "Download notebook"
Expand All @@ -164,8 +164,3 @@
"github_version": "master",
"commit": commit_link,
}


# Load the custom CSS files (needs sphinx >= 1.6 for this to work)
def setup(app):
app.add_stylesheet("style.css")