This is an automated email from the ASF dual-hosted git repository.

kamilbregula pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airflow.git


The following commit(s) were added to refs/heads/master by this push:
     new a66d29f  Dev documentation uses sphinx-airflow-theme (#12582)
a66d29f is described below

commit a66d29f44da3db8e5c6f243aedb01a70a810585a
Author: Kamil Breguła <[email protected]>
AuthorDate: Tue Nov 24 16:31:39 2020 +0100

    Dev documentation uses sphinx-airflow-theme (#12582)
---
 docs/conf.py | 76 +++++++++++++++++++++++++++---------------------------------
 setup.py     |  6 +++++
 2 files changed, 40 insertions(+), 42 deletions(-)

diff --git a/docs/conf.py b/docs/conf.py
index ce8844e..619f732 100644
--- a/docs/conf.py
+++ b/docs/conf.py
@@ -41,13 +41,6 @@ import yaml
 import airflow
 from airflow.configuration import default_config_yaml
 
-try:
-    import sphinx_airflow_theme  # pylint: disable=unused-import
-
-    airflow_theme_is_available = True
-except ImportError:
-    airflow_theme_is_available = False
-
 sys.path.append(os.path.join(os.path.dirname(__file__), 'exts'))
 
 CONF_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__)))
@@ -118,6 +111,7 @@ extensions = [
     'sphinx_copybutton',
     'airflow_intersphinx',
     "sphinxcontrib.spelling",
+    'sphinx_airflow_theme',
 ]
 if PACKAGE_NAME == 'apache-airflow':
     extensions.extend(
@@ -212,10 +206,7 @@ keep_warnings = True
 
 # The theme to use for HTML and HTML Help pages.  See the documentation for
 # a list of builtin themes.
-html_theme = 'sphinx_rtd_theme'
-
-if airflow_theme_is_available:
-    html_theme = 'sphinx_airflow_theme'
+html_theme = 'sphinx_airflow_theme'
 
 # The name for this set of Sphinx documents.  If None, it defaults to
 # "<project> v<release> documentation".
@@ -248,15 +239,16 @@ if PACKAGE_NAME == 'apache-airflow':
 else:
     html_js_files = []
 
+# -- Theme configuration 
-------------------------------------------------------
 # Custom sidebar templates, maps document names to template names.
-if airflow_theme_is_available:
-    html_sidebars = {
-        '**': [
-            'version-selector.html',
-            'searchbox.html',
-            'globaltoc.html',
-        ]
-    }
+html_sidebars = {
+    '**': [
+        # TODO(mik-laj): TODO: Add again on production version of documentation
+        # 'version-selector.html',
+        'searchbox.html',
+        'globaltoc.html',
+    ]
+}
 
 # If false, no index is generated.
 html_use_index = True
@@ -264,36 +256,36 @@ html_use_index = True
 # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
 html_show_copyright = False
 
+# Theme configuration
+sphinx_airflow_theme_navbar_links = [{'href': '/index.html', 'text': 
'Documentation'}]
+sphinx_airflow_theme_hide_website_buttons = True
 # A dictionary of values to pass into the template engine’s context for all 
pages.
 html_context = {
     # Google Analytics ID.
     # For more information look at:
     # 
https://github.com/readthedocs/sphinx_rtd_theme/blob/master/sphinx_rtd_theme/layout.html#L222-L232
     'theme_analytics_id': 'UA-140539454-1',
+    # Variables used to build a button for editing the source code
+    #
+    # The path is created according to the following template:
+    #
+    # https://{{ github_host|default("github.com") }}/{{ github_user }}/{{ 
github_repo }}/
+    # {{ theme_vcs_pageview_mode|default("blob") }}/{{ github_version }}{{ 
conf_py_path }}
+    # {{ pagename }}{{ suffix }}
+    #
+    # More information:
+    # 
https://github.com/readthedocs/readthedocs.org/blob/master/readthedocs/doc_builder/templates/doc_builder/conf.py.tmpl#L100-L103
+    # 
https://github.com/readthedocs/sphinx_rtd_theme/blob/master/sphinx_rtd_theme/breadcrumbs.html#L45
+    # 
https://github.com/apache/airflow-site/blob/91f760c/sphinx_airflow_theme/sphinx_airflow_theme/suggest_change_button.html#L36-L40
+    #
+    'theme_vcs_pageview_mode': 'edit',
+    'conf_py_path': f'/docs/{PACKAGE_NAME}/',
+    'github_user': 'apache',
+    'github_repo': 'airflow',
+    'github_version': 'master',
+    'display_github': 'master',
+    'suffix': '.rst',
 }
-if airflow_theme_is_available:
-    html_context = {
-        # Variables used to build a button for editing the source code
-        #
-        # The path is created according to the following template:
-        #
-        # https://{{ github_host|default("github.com") }}/{{ github_user }}/{{ 
github_repo }}/
-        # {{ theme_vcs_pageview_mode|default("blob") }}/{{ github_version }}{{ 
conf_py_path }}
-        # {{ pagename }}{{ suffix }}
-        #
-        # More information:
-        # 
https://github.com/readthedocs/readthedocs.org/blob/master/readthedocs/doc_builder/templates/doc_builder/conf.py.tmpl#L100-L103
-        # 
https://github.com/readthedocs/sphinx_rtd_theme/blob/master/sphinx_rtd_theme/breadcrumbs.html#L45
-        # 
https://github.com/apache/airflow-site/blob/91f760c/sphinx_airflow_theme/sphinx_airflow_theme/suggest_change_button.html#L36-L40
-        #
-        'theme_vcs_pageview_mode': 'edit',
-        'conf_py_path': '/docs/',
-        'github_user': 'apache',
-        'github_repo': 'airflow',
-        'github_version': 'master',
-        'display_github': 'master',
-        'suffix': '.rst',
-    }
 
 # == Extensions configuration 
==================================================
 
diff --git a/setup.py b/setup.py
index c3b74a8..9226c04 100644
--- a/setup.py
+++ b/setup.py
@@ -154,6 +154,11 @@ def write_version(filename: str = os.path.join(*[my_dir, 
"airflow", "git_version
         file.write(text)
 
 
+_SPHINX_AIRFLOW_THEME_URL = (
+    "https://github.com/apache/airflow-site/releases/download/v0.0.1/";
+    "sphinx_airflow_theme-0.0.1-py3-none-any.whl"
+)
+
 # 'Start dependencies group' and 'Start dependencies group' are mark for 
./scripts/ci/check_order_setup.py
 # If you change this mark you should also change 
./scripts/ci/check_order_setup.py
 # Start dependencies group
@@ -216,6 +221,7 @@ doc = [
     'sphinxcontrib-httpdomain>=1.7.0',
     "sphinxcontrib-redoc>=1.6.0",
     "sphinxcontrib-spelling==5.2.1",
+    f"sphinx-airflow-theme @ {_SPHINX_AIRFLOW_THEME_URL}",
 ]
 docker = [
     'docker~=3.0',

Reply via email to