# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

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

print(f"Sphinx is using Python executable at: {sys.executable}", flush=True)
print(f"Python version: {sys.version}", flush=True)

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

from redisvl import __version__

project = 'RedisVL'
copyright = '2024, Redis Inc.'
author = 'Redis Applied AI'
version = __version__

# The full version, including alpha/beta/rc tags
release = version


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
    'sphinx.ext.autodoc',
    'sphinx.ext.todo',
    'sphinx.ext.coverage',
    'sphinx.ext.imgmath',
    'sphinx.ext.viewcode',
    'sphinx.ext.githubpages',
    'sphinx.ext.autosummary',
    'sphinx.ext.napoleon',
    "sphinx_design",
    "sphinx_copybutton",
    "_extension.gallery_directive",
    "myst_nb",
    "sphinx_favicon"
]


# 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', "**.ipynb_checkpoints"]


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

# The theme to use for HTML and HTML Help pages.
html_theme = "sphinx_book_theme"

# Pygments syntax highlighting style
pygments_style = "friendly"
pygments_dark_style = "monokai"

# 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']
html_css_files = ["css/custom.css"]
html_title = "RedisVL"
html_logo = "_static/Redis_Favicon_32x32_Red.png"
html_favicon = "_static/Redis_Favicon_32x32_Red.png"

html_context = {
    "github_user": "redis",
    "github_repo": "redis-vl-python",
    "github_version": "main",
    "doc_path": "docs",
    "default_mode": "auto",
}

# This allows us to use ::: to denote directives, useful for admonitions
myst_enable_extensions = ["colon_fence"]
myst_heading_anchors = 3

# Sphinx Book Theme options
html_theme_options = {
    "repository_url": "https://github.com/redis/redis-vl-python",
    "use_repository_button": True,
    "use_edit_page_button": True,
    "use_source_button": True,
    "use_issues_button": True,
    "use_download_button": True,
    "use_fullscreen_button": True,
    "repository_branch": "main",
    "path_to_docs": "docs",
    "show_navbar_depth": 2,
    "navigation_depth": 4,
    "show_toc_level": 3,
    "home_page_in_toc": True,
    "logo": {
        "text": "Redis Vector Library",
        "image_light": "_static/Redis_Favicon_32x32_Red.png",
        "image_dark": "_static/Redis_Favicon_32x32_Red.png",
    },
}


autoclass_content = 'both'
add_module_names = False

nb_execution_mode = "off"

# -- Options for autosummary/autodoc output ------------------------------------
autosummary_generate = True
autodoc_typehints = "description"
autodoc_member_order = "groupwise"

# -- Options for autoapi -------------------------------------------------------
autoapi_type = "python"
autoapi_dirs = ["../src/redisvl"]
autoapi_keep_files = True
autoapi_root = "api"
autoapi_member_order = "groupwise"


# -- favicon options ---------------------------------------------------------

# see https://sphinx-favicon.readthedocs.io for more information about the
# sphinx-favicon extension

favicons = [
    # generic icons compatible with most browsers
    "Redis_Favicon_32x32_Red.png",
    "Redis_Favicon_16x16_Red.png",
    "Redis_Favicon_144x144_Red.png",
]
