From 62d0036df66c3b12c148482c318e566a44ef4bc8 Mon Sep 17 00:00:00 2001 From: Alkid Date: Tue, 5 Mar 2024 15:41:20 +0100 Subject: [PATCH] added sphinx extensions --- docs/conf.py | 52 +++++++++++++++++++++++++++++++++++++++++++++- docs/index.rst | 10 ++------- docs/usage/main.md | 4 +--- requirements.txt | 7 ++++++- 4 files changed, 60 insertions(+), 13 deletions(-) diff --git a/docs/conf.py b/docs/conf.py index 1849de94..86bd1d69 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -22,8 +22,13 @@ extensions = ["autoapi.extension", "sphinx.ext.githubpages", "sphinx.ext.todo", + "sphinx.ext.napoleon", "sphinx.ext.viewcode", - "sphinx.ext.autodoc"] + "sphinx.ext.autodoc", + "sphinxcontrib.plantuml", + "myst_parser", + "sphinx_rtd_theme", + ] # autoapi for dicee. autoapi_dirs = ['../dicee'] @@ -35,14 +40,56 @@ # this is set to false, so we can add it manually in index.rst together with the other .md files of the documentation. autoapi_add_toctree_entry = False +inheritance_graph_attrs = dict(rankdir="TB") + +myst_enable_extensions = [ + 'colon_fence', + 'deflist', +] + +myst_heading_anchors = 3 + templates_path = ['_templates'] exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] # -- Options for HTML output ------------------------------------------------- # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output +pygments_style = 'rainbow_dash' + +plantuml_output_format = 'svg_img' +plantuml_latex_output_format = 'pdf' + +stanford_theme_mod = True +html_theme_options = { + 'navigation_depth': 6, +} + html_static_path = ['_static'] +if stanford_theme_mod: + html_theme = 'sphinx_rtd_theme' + + def _import_theme(): + import os + import shutil + import sphinx_theme + html_theme = 'stanford_theme' + for _type in ['fonts']: + shutil.copytree( + os.path.join(sphinx_theme.get_html_theme_path(html_theme), + html_theme, 'static', _type), + os.path.join('_static_gen', _type), + dirs_exist_ok=True) + shutil.copy2( + os.path.join(sphinx_theme.get_html_theme_path(html_theme), + html_theme, 'static', 'css', 'theme.css'), + os.path.join('_static_gen', 'theme.css'), + ) + + _import_theme() + html_static_path = ['_static_gen'] + html_static_path + # -- Options for LaTeX output ------------------------------------------------ latex_engine = 'xelatex' @@ -62,4 +109,7 @@ def setup(app): # -- Options for HTML output --------------------------------------------- + if stanford_theme_mod: + app.add_css_file('theme.css') app.add_css_file('theme_tweak.css') + app.add_css_file('pygments.css') diff --git a/docs/index.rst b/docs/index.rst index 09b9bec0..8a67a6f0 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -3,11 +3,11 @@ You can adapt this file completely to your liking, but it should at least contain the root `toctree` directive. -Welcome to DICE Embeddings documentation! +Welcome to DICE Embeddings! =========================================== `DICE Embeddings `_: Hardware-agnostic Framework for Large-scale Knowledge Graph Embeddings: -======= + .. toctree:: :maxdepth: 2 @@ -16,9 +16,3 @@ Welcome to DICE Embeddings documentation! usage/main autoapi/dicee/index -Indices and tables -------- - -* :ref:`genindex` -* :ref:`modindex` -* :ref:`search` diff --git a/docs/usage/main.md b/docs/usage/main.md index de2fbefc..9f89c45d 100644 --- a/docs/usage/main.md +++ b/docs/usage/main.md @@ -1,4 +1,4 @@ -## Dice Embeddings! +## Dicee Manual **Version:** dicee 0.1.3.2 @@ -313,8 +313,6 @@ from dicee import KGE KGE(path='...').deploy(share=True,top_k=10) ``` -Italian Trulli - ## Docker To build the Docker image: ``` diff --git a/requirements.txt b/requirements.txt index 0ca198b2..c267a2aa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -14,4 +14,9 @@ rdflib>=7.0.0 tiktoken>=0.5.1 matplotlib>=3.8.2 sphinx-autoapi>=3.0.0 -sphinx>=7.2.6 \ No newline at end of file +sphinx>=7.2.6 +myst-parser>=2.0.0 +sphinx_rtd_theme>=2.0.0 +sphinx-theme>=1.0 +sphinxcontrib-plantuml>=0.27 +plantuml-local-client>=1.2022.6 \ No newline at end of file