Skip to content

Commit

Permalink
Fix the doc generation failure (#352)
Browse files Browse the repository at this point in the history
Signed-off-by: SimFG <[email protected]>
  • Loading branch information
SimFG authored May 17, 2023
1 parent 8e11f55 commit 84a016b
Show file tree
Hide file tree
Showing 10 changed files with 493 additions and 199 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/pylint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ on:
- 'examples/**'
- 'gptcache/**'
- 'tests/**'
- 'docs/**'
- '!**.md'
- '.github/workflows/**'
workflow_dispatch:
Expand All @@ -37,3 +38,13 @@ jobs:
run: |
pip install pylint==2.10.2
make pylint_check
- name: Install doc dependency
shell: bash
working-directory: docs
run: |
pip install -r requirements.txt
- name: Make the readthedoc html
shell: bash
working-directory: docs
run: |
make html
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,5 @@ dmypy.json
**/example.py
**/example.db
**/.chroma
docs/references/*
!docs/references/index.rst
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,7 @@ The **Vector Store** module helps find the K most similar requests from the inpu
- [x] Support [Hnswlib](https://github.com/nmslib/hnswlib), header-only C++/python library for fast approximate nearest neighbors.
- [x] Support [pgvector](https://github.com/pgvector/pgvector), open-source vector similarity search for Postgres.
- [x] Support [chroma](https://github.com/chroma-core/chroma), the AI-native open-source embedding database.
- [x] Support [DocArray](https://github.com/docarray/docarray), DocArray is a library for representing, sending and storing multi-modal data, perfect for Machine Learning applications.
- [ ] Support qdrant
- [ ] Support weaviate
- [ ] Support other vector databases.
Expand Down
1 change: 1 addition & 0 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SPHINXAUTOBUILD ?= sphinx-autobuild
SOURCEDIR = .
BUILDDIR = _build

Expand Down
25 changes: 0 additions & 25 deletions docs/_exts/indexCon.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,32 +50,7 @@ def preprocess(self):

with open('toc.bak', 'r') as t:
f.write(t.read())


























if __name__ == '__main__':
index = IndexCon('../../README.md')

108 changes: 53 additions & 55 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,34 +12,25 @@

import os
import sys
from m2r2 import parse_from_file

sys.path.insert(0, os.path.abspath('.'))
sys.path.insert(0, os.path.abspath('..'))
sys.path.insert(0, os.path.abspath('_exts'))
sys.path.insert(0, os.path.abspath("."))
sys.path.insert(0, os.path.abspath(".."))
sys.path.insert(0, os.path.abspath("_exts"))
from _exts.docgen import DocGen
from _exts.indexCon import IndexCon

# -- Preactions --------------------------------------------------------------

# Prepare docs
docgen = DocGen(output_dir='references')
docgen.generate('gptcache')

IndexCon('../README.md', 'index.rst')


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

project = 'GPTCache'
copyright = '2023, Zilliz Inc'
author = 'Zilliz Inc.'
project = "GPTCache"
copyright = "2023, Zilliz Inc"
author = "Zilliz Inc."

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

html_title = project
html_last_updated_fmt = '%b %d, %Y'
html_last_updated_fmt = "%b %d, %Y"


# -- General configuration ---------------------------------------------------
Expand All @@ -49,29 +40,28 @@
# ones.

extensions = [
'myst_nb',
'sphinx.ext.autodoc',
'sphinx.ext.autodoc.typehints',
'sphinx.ext.autosummary',
'sphinx.ext.napoleon',
'sphinx.ext.viewcode',
'sphinxcontrib.autodoc_pydantic',
'sphinx_copybutton',
'sphinx_panels',
'sphinx_toolbox.collapse'
"myst_nb",
"sphinx.ext.autodoc",
"sphinx.ext.autodoc.typehints",
"sphinx.ext.autosummary",
"sphinx.ext.napoleon",
"sphinx.ext.viewcode",
"sphinx.ext.doctest",
"sphinx.ext.intersphinx",
"sphinx_copybutton",
"sphinx_panels",
"sphinx_toolbox.collapse",
"sphinxcontrib.autodoc_pydantic",
]


myst_enable_extensions = [
"dollarmath",
"amsmath",
"deflist",
"html_admonition",
"html_image",
"colon_fence",
"smartquotes",
"replacements"
]
intersphinx_mapping = {
"torch": ("https://pytorch.org/docs/stable/", None),
"numpy": ("https://numpy.org/devdocs/", None),
"python": ("https://docs.python.org/3", None),
}
autodoc_member_order = "bysource"
autodoc_mock_imports = ["httpx"]
autodoc_inherit_docstrings = False

autodoc_pydantic_model_show_json = False
autodoc_pydantic_field_list_validators = False
Expand All @@ -83,19 +73,19 @@
autodoc_pydantic_model_undoc_members = False

source_suffix = {
'.rst': 'restructuredtext',
'.ipynb': 'myst-nb',
'.md': 'myst-nb',
".rst": "restructuredtext",
".ipynb": "myst-nb",
".md": "myst-nb",
}

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
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']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store", "references/client*"]


# -- Options for HTML output -------------------------------------------------
Expand All @@ -105,28 +95,36 @@
#
# html_theme = 'alabaster'
# html_theme = 'python_docs_theme'
html_theme = 'sphinx_book_theme'
html_theme = "sphinx_book_theme"

html_theme_options = {
'path_to_docs': 'docs',
'repository_url': 'https://github.com/zilliztech/GPTCache',
'use_repository_button': True
"path_to_docs": "docs",
"repository_url": "https://github.com/zilliztech/GPTCache",
"use_repository_button": True,
}

html_context = {
'display_github': True, # Integrate GitHub
'github_user': 'zilliztech', # Username
'github_repo': 'GPTCache', # Repo name
'github_version': 'main', # Version
'conf_py_path': '/docs' # Path in the checkout to the docs root
"display_github": True, # Integrate GitHub
"github_user": "zilliztech", # Username
"github_repo": "GPTCache", # Repo name
"github_version": "main", # Version
"conf_py_path": "/docs/", # Path in the checkout to the docs root
}

html_show_sphinx = 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']
html_static_path = ["_static"]

nb_execution_mode = "off"
myst_enable_extensions = ["colon_fence"]

# -- Preactions --------------------------------------------------------------

# Prepare docs
docgen = DocGen(output_dir="references")
docgen.generate("gptcache")

nb_execution_mode = 'off'
myst_enable_extensions = ['colon_fence']
IndexCon("../README.md", "index.rst")
Loading

0 comments on commit 84a016b

Please sign in to comment.