Skip to content

Commit

Permalink
support sphinx doc
Browse files Browse the repository at this point in the history
  • Loading branch information
helloyongyang committed Jun 24, 2024
1 parent c9534f9 commit 6a8c5a2
Show file tree
Hide file tree
Showing 20 changed files with 559 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
.vscode/
.env
save*
*log*
.log
*pid*
*.ipynb*

17 changes: 17 additions & 0 deletions docs/en/.readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-20.04
tools:
python: "3.10"

formats:
- epub

sphinx:
configuration: docs/en/source/conf.py

python:
install:
- requirements: requirements/docs.txt
20 changes: 20 additions & 0 deletions docs/en/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions docs/en/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
71 changes: 71 additions & 0 deletions docs/en/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'llmc'
copyright = '2024, SenseTime-ToolChain'
author = 'SenseTime-ToolChain'
release = '1.0.0'

github_url = f'https://github.com/ModelTC/llmc'

html_context = {
'display_github': True,
'github_user': author,
'github_repo': "llmc",
'github_version': "main",
"conf_py_path": "/docs/en/source/", # Path in the checkout to the docs root
}
html_theme_options = {
'github_url': github_url,

'doc_items': {
'paper': 'https://arxiv.org/abs/2405.06001',
'institution': 'https://github.com/ModelTC',
},

'logo': 'images/logo/llmc.svg',
'logo_dark': 'images/logo/llmc.svg',
'logo_icon': 'images/logo/llmc.svg',
}


# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
'myst_parser',
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'sphinxcontrib.contentui',
'sphinx.ext.doctest',
'sphinx.ext.mathjax',
'sphinx.ext.ifconfig',
'sphinx-prompt',
'sphinxcontrib.jquery',
'sphinx.ext.autosectionlabel',
'sphinx.ext.githubpages',
'sphinx.ext.intersphinx',
'sphinxcontrib.katex',
'sphinx_copybutton',
]

templates_path = ['_templates']
exclude_patterns = []

language = 'en'

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output


html_theme = 'trojanzoo_sphinx_theme'

html_static_path = ['_static']

source_suffix = ['.rst', '.md']
2 changes: 2 additions & 0 deletions docs/en/source/configs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Design your custom configs

97 changes: 97 additions & 0 deletions docs/en/source/images/logo/llmc.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
20 changes: 20 additions & 0 deletions docs/en/source/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
.. llmc documentation master file, created by
sphinx-quickstart on Mon Jun 24 10:56:49 2024.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to llmc's documentation!
================================

.. toctree::
:maxdepth: 2
:caption: Quick Start

quickstart.md


.. toctree::
:maxdepth: 2
:caption: Configs

configs.md
2 changes: 2 additions & 0 deletions docs/en/source/quickstart.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Quick start to run llmc

17 changes: 17 additions & 0 deletions docs/zh_cn/.readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-20.04
tools:
python: "3.10"

formats:
- epub

sphinx:
configuration: docs/zh_cn/source/conf.py

python:
install:
- requirements: requirements/docs.txt
20 changes: 20 additions & 0 deletions docs/zh_cn/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
# Minimal makefile for Sphinx documentation
#

# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = source
BUILDDIR = build

# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

.PHONY: help Makefile

# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
35 changes: 35 additions & 0 deletions docs/zh_cn/make.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@ECHO OFF

pushd %~dp0

REM Command file for Sphinx documentation

if "%SPHINXBUILD%" == "" (
set SPHINXBUILD=sphinx-build
)
set SOURCEDIR=source
set BUILDDIR=build

%SPHINXBUILD% >NUL 2>NUL
if errorlevel 9009 (
echo.
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
echo.installed, then set the SPHINXBUILD environment variable to point
echo.to the full path of the 'sphinx-build' executable. Alternatively you
echo.may add the Sphinx directory to PATH.
echo.
echo.If you don't have Sphinx installed, grab it from
echo.https://www.sphinx-doc.org/
exit /b 1
)

if "%1" == "" goto help

%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
goto end

:help
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%

:end
popd
71 changes: 71 additions & 0 deletions docs/zh_cn/source/conf.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
# Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html

# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information

project = 'llmc'
copyright = '2024, SenseTime-ToolChain'
author = 'SenseTime-ToolChain'
release = '1.0.0'

github_url = f'https://github.com/ModelTC/llmc'

html_context = {
'display_github': True,
'github_user': author,
'github_repo': "llmc",
'github_version': "main",
"conf_py_path": "/docs/zh_cn/source/", # Path in the checkout to the docs root
}
html_theme_options = {
'github_url': github_url,

'doc_items': {
'paper': 'https://arxiv.org/abs/2405.06001',
'institution': 'https://github.com/ModelTC',
},

'logo': 'images/logo/llmc.svg',
'logo_dark': 'images/logo/llmc.svg',
'logo_icon': 'images/logo/llmc.svg',
}


# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration

extensions = [
'myst_parser',
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
'sphinx.ext.napoleon',
'sphinxcontrib.contentui',
'sphinx.ext.doctest',
'sphinx.ext.mathjax',
'sphinx.ext.ifconfig',
'sphinx-prompt',
'sphinxcontrib.jquery',
'sphinx.ext.autosectionlabel',
'sphinx.ext.githubpages',
'sphinx.ext.intersphinx',
'sphinxcontrib.katex',
'sphinx_copybutton',
]

templates_path = ['_templates']
exclude_patterns = []

language = 'cn'

# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output


html_theme = 'trojanzoo_sphinx_theme'

html_static_path = ['_static']

source_suffix = ['.rst', '.md']
2 changes: 2 additions & 0 deletions docs/zh_cn/source/configs.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# 设计自定义配置

Loading

0 comments on commit 6a8c5a2

Please sign in to comment.