From ecd17805f87ad87d0a650d3e949d443f910fa280 Mon Sep 17 00:00:00 2001 From: Matthias Geier Date: Thu, 23 Jan 2020 15:12:39 +0100 Subject: [PATCH] Provide entry_points for loading the theme --- README.rst | 12 ------------ guzzle_sphinx_theme/__init__.py | 8 ++++++++ setup.py | 7 ++++++- 3 files changed, 14 insertions(+), 13 deletions(-) diff --git a/README.rst b/README.rst index cb4c620..7717b12 100644 --- a/README.rst +++ b/README.rst @@ -22,14 +22,8 @@ Add the following to your conf.py: .. code-block:: python - import guzzle_sphinx_theme - - html_theme_path = guzzle_sphinx_theme.html_theme_path() html_theme = 'guzzle_sphinx_theme' - # Register the theme as an extension to generate a sitemap.xml - extensions.append("guzzle_sphinx_theme") - # Guzzle theme options (see theme.conf for more information) html_theme_options = { # Set the name of the project to appear in the sidebar @@ -41,14 +35,8 @@ example shows: .. code-block:: python - import guzzle_sphinx_theme - - html_theme_path = guzzle_sphinx_theme.html_theme_path() html_theme = 'guzzle_sphinx_theme' - # Register the theme as an extension to generate a sitemap.xml - extensions.append("guzzle_sphinx_theme") - # Guzzle theme options (see theme.conf for more information) html_theme_options = { diff --git a/guzzle_sphinx_theme/__init__.py b/guzzle_sphinx_theme/__init__.py index 4c4eda8..f23f9a8 100644 --- a/guzzle_sphinx_theme/__init__.py +++ b/guzzle_sphinx_theme/__init__.py @@ -14,10 +14,18 @@ def setup(app): """Setup conntects events to the sitemap builder""" + app.require_sphinx('1.6') # For add_html_theme() + app.add_html_theme( + 'guzzle_sphinx_theme', + os.path.abspath(os.path.join(os.path.dirname(__file__), + 'guzzle_sphinx_theme'))) app.connect('html-page-context', add_html_link) app.connect('build-finished', create_sitemap) app.set_translator('html', HTMLTranslator) app.sitemap_links = [] + return { + 'parallel_read_safe': True, + } def add_html_link(app, pagename, templatename, context, doctree): diff --git a/setup.py b/setup.py index 2aea2d9..6688d24 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ url='https://github.com/guzzle/guzzle_sphinx_theme', packages=['guzzle_sphinx_theme'], include_package_data=True, - install_requires=['Sphinx>1.3'], + install_requires=['Sphinx>=1.6'], license="MIT", classifiers=( 'Development Status :: 3 - Alpha', @@ -19,4 +19,9 @@ 'License :: OSI Approved :: MIT License', 'Programming Language :: Python', ), + entry_points={ + 'sphinx.html_themes': [ + 'guzzle_sphinx_theme = guzzle_sphinx_theme', + ] + }, )