From e40f718a34b4a37aa6b4d89dbac5162057f5c4e7 Mon Sep 17 00:00:00 2001 From: tazlin Date: Tue, 11 Jul 2023 12:35:51 -0400 Subject: [PATCH] feat: sphinx + readthedocs integration --- .readthedocs.yaml | 35 +++++++++++ docs/Makefile | 20 ++++++ docs/make.bat | 35 +++++++++++ docs/source/conf.py | 42 +++++++++++++ ...de_sdk.ai_horde_api.apimodels.generate.rst | 10 +++ .../horde_sdk.ai_horde_api.apimodels.rst | 29 +++++++++ docs/source/horde_sdk.ai_horde_api.rst | 61 +++++++++++++++++++ .../horde_sdk.ai_horde_worker.locale_info.rst | 21 +++++++ docs/source/horde_sdk.ai_horde_worker.rst | 37 +++++++++++ docs/source/horde_sdk.generic_api.rst | 45 ++++++++++++++ docs/source/horde_sdk.ratings_api.rst | 45 ++++++++++++++ docs/source/horde_sdk.rst | 48 +++++++++++++++ docs/source/index.rst | 31 ++++++++++ docs/source/modules.rst | 7 +++ docs/source/usage.rst | 13 ++++ 15 files changed, 479 insertions(+) create mode 100644 .readthedocs.yaml create mode 100644 docs/Makefile create mode 100644 docs/make.bat create mode 100644 docs/source/conf.py create mode 100644 docs/source/horde_sdk.ai_horde_api.apimodels.generate.rst create mode 100644 docs/source/horde_sdk.ai_horde_api.apimodels.rst create mode 100644 docs/source/horde_sdk.ai_horde_api.rst create mode 100644 docs/source/horde_sdk.ai_horde_worker.locale_info.rst create mode 100644 docs/source/horde_sdk.ai_horde_worker.rst create mode 100644 docs/source/horde_sdk.generic_api.rst create mode 100644 docs/source/horde_sdk.ratings_api.rst create mode 100644 docs/source/horde_sdk.rst create mode 100644 docs/source/index.rst create mode 100644 docs/source/modules.rst create mode 100644 docs/source/usage.rst diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..a9c87ab --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,35 @@ +# Read the Docs configuration file for Sphinx projects +# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details + +# Required +version: 2 + +# Set the OS, Python version and other tools you might need +build: + os: ubuntu-22.04 + tools: + python: "3.10" + # You can also specify other tool versions: + # nodejs: "20" + # rust: "1.70" + # golang: "1.20" + +# Build documentation in the "docs/" directory with Sphinx +sphinx: + configuration: docs/source/conf.py + # You can configure Sphinx to use a different builder, for instance use the dirhtml builder for simpler URLs + # builder: "dirhtml" + # Fail on all warnings to avoid broken references + # fail_on_warning: true + +# Optionally build your docs in additional formats such as PDF and ePub +# formats: +# - pdf +# - epub + +# Optional but recommended, declare the Python requirements required +# to build your documentation +# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html +python: + install: + - requirements: docs/requirements.txt diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..d0c3cbf --- /dev/null +++ b/docs/Makefile @@ -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) diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..dc1312a --- /dev/null +++ b/docs/make.bat @@ -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 diff --git a/docs/source/conf.py b/docs/source/conf.py new file mode 100644 index 0000000..7c85ac3 --- /dev/null +++ b/docs/source/conf.py @@ -0,0 +1,42 @@ +# 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 + + +import pathlib +import sys + +# -- Path setup -------------------------------------------------------------- +sys.path.insert(0, str(pathlib.Path(__file__).parent.parent.parent / "src")) + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + +project = "horde_sdk" +copyright = "2023, hairda-org" # noqa: A001 +author = "tazlin, db0" +release = "0.1.x" + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = ["sphinx.ext.autodoc", "sphinx.ext.napoleon"] + +templates_path = ["_templates"] +exclude_patterns: list[str] = [] + +autodoc_default_options = { + "members": True, + "member-order": "bysource", + "undoc-members": "__init__", + "exclude-members": "__weakref__,model_fields,model_config", +} + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = "sphinx_rtd_theme" +# html_theme = "groundwork" + +html_static_path = ["_static"] diff --git a/docs/source/horde_sdk.ai_horde_api.apimodels.generate.rst b/docs/source/horde_sdk.ai_horde_api.apimodels.generate.rst new file mode 100644 index 0000000..5af2111 --- /dev/null +++ b/docs/source/horde_sdk.ai_horde_api.apimodels.generate.rst @@ -0,0 +1,10 @@ +horde\_sdk.ai\_horde\_api.apimodels.generate package +==================================================== + +Module contents +--------------- + +.. automodule:: horde_sdk.ai_horde_api.apimodels.generate + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/horde_sdk.ai_horde_api.apimodels.rst b/docs/source/horde_sdk.ai_horde_api.apimodels.rst new file mode 100644 index 0000000..899d551 --- /dev/null +++ b/docs/source/horde_sdk.ai_horde_api.apimodels.rst @@ -0,0 +1,29 @@ +horde\_sdk.ai\_horde\_api.apimodels package +=========================================== + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + horde_sdk.ai_horde_api.apimodels.generate + +Submodules +---------- + +horde\_sdk.ai\_horde\_api.apimodels.base module +----------------------------------------------- + +.. automodule:: horde_sdk.ai_horde_api.apimodels.base + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: horde_sdk.ai_horde_api.apimodels + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/horde_sdk.ai_horde_api.rst b/docs/source/horde_sdk.ai_horde_api.rst new file mode 100644 index 0000000..4ea7570 --- /dev/null +++ b/docs/source/horde_sdk.ai_horde_api.rst @@ -0,0 +1,61 @@ +horde\_sdk.ai\_horde\_api package +================================= + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + horde_sdk.ai_horde_api.apimodels + +Submodules +---------- + +horde\_sdk.ai\_horde\_api.ai\_horde\_client module +-------------------------------------------------- + +.. automodule:: horde_sdk.ai_horde_api.ai_horde_client + :members: + :undoc-members: + :show-inheritance: + +horde\_sdk.ai\_horde\_api.consts module +--------------------------------------- + +.. automodule:: horde_sdk.ai_horde_api.consts + :members: + :undoc-members: + :show-inheritance: + +horde\_sdk.ai\_horde\_api.endpoints module +------------------------------------------ + +.. automodule:: horde_sdk.ai_horde_api.endpoints + :members: + :undoc-members: + :show-inheritance: + +horde\_sdk.ai\_horde\_api.fields module +--------------------------------------- + +.. automodule:: horde_sdk.ai_horde_api.fields + :members: + :undoc-members: + :show-inheritance: + +horde\_sdk.ai\_horde\_api.metadata module +----------------------------------------- + +.. automodule:: horde_sdk.ai_horde_api.metadata + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: horde_sdk.ai_horde_api + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/horde_sdk.ai_horde_worker.locale_info.rst b/docs/source/horde_sdk.ai_horde_worker.locale_info.rst new file mode 100644 index 0000000..9df9dd0 --- /dev/null +++ b/docs/source/horde_sdk.ai_horde_worker.locale_info.rst @@ -0,0 +1,21 @@ +horde\_sdk.ai\_horde\_worker.locale\_info package +================================================= + +Submodules +---------- + +horde\_sdk.ai\_horde\_worker.locale\_info.bridge\_data\_fields module +--------------------------------------------------------------------- + +.. automodule:: horde_sdk.ai_horde_worker.locale_info.bridge_data_fields + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: horde_sdk.ai_horde_worker.locale_info + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/horde_sdk.ai_horde_worker.rst b/docs/source/horde_sdk.ai_horde_worker.rst new file mode 100644 index 0000000..34daaf7 --- /dev/null +++ b/docs/source/horde_sdk.ai_horde_worker.rst @@ -0,0 +1,37 @@ +horde\_sdk.ai\_horde\_worker package +==================================== + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + horde_sdk.ai_horde_worker.locale_info + +Submodules +---------- + +horde\_sdk.ai\_horde\_worker.bridge\_data module +------------------------------------------------ + +.. automodule:: horde_sdk.ai_horde_worker.bridge_data + :members: + :undoc-members: + :show-inheritance: + +horde\_sdk.ai\_horde\_worker.kudos module +----------------------------------------- + +.. automodule:: horde_sdk.ai_horde_worker.kudos + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: horde_sdk.ai_horde_worker + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/horde_sdk.generic_api.rst b/docs/source/horde_sdk.generic_api.rst new file mode 100644 index 0000000..37f9d5a --- /dev/null +++ b/docs/source/horde_sdk.generic_api.rst @@ -0,0 +1,45 @@ +horde\_sdk.generic\_api package +=============================== + +Submodules +---------- + +horde\_sdk.generic\_api.apimodels module +---------------------------------------- + +.. automodule:: horde_sdk.generic_api.apimodels + :members: + :undoc-members: + :show-inheritance: + +horde\_sdk.generic\_api.endpoints module +---------------------------------------- + +.. automodule:: horde_sdk.generic_api.endpoints + :members: + :undoc-members: + :show-inheritance: + +horde\_sdk.generic\_api.generic\_client module +---------------------------------------------- + +.. automodule:: horde_sdk.generic_api.generic_client + :members: + :undoc-members: + :show-inheritance: + +horde\_sdk.generic\_api.metadata module +--------------------------------------- + +.. automodule:: horde_sdk.generic_api.metadata + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: horde_sdk.generic_api + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/horde_sdk.ratings_api.rst b/docs/source/horde_sdk.ratings_api.rst new file mode 100644 index 0000000..f6ddb26 --- /dev/null +++ b/docs/source/horde_sdk.ratings_api.rst @@ -0,0 +1,45 @@ +horde\_sdk.ratings\_api package +=============================== + +Submodules +---------- + +horde\_sdk.ratings\_api.apimodels module +---------------------------------------- + +.. automodule:: horde_sdk.ratings_api.apimodels + :members: + :undoc-members: + :show-inheritance: + +horde\_sdk.ratings\_api.endpoints module +---------------------------------------- + +.. automodule:: horde_sdk.ratings_api.endpoints + :members: + :undoc-members: + :show-inheritance: + +horde\_sdk.ratings\_api.metadata module +--------------------------------------- + +.. automodule:: horde_sdk.ratings_api.metadata + :members: + :undoc-members: + :show-inheritance: + +horde\_sdk.ratings\_api.ratings\_client module +---------------------------------------------- + +.. automodule:: horde_sdk.ratings_api.ratings_client + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: horde_sdk.ratings_api + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/horde_sdk.rst b/docs/source/horde_sdk.rst new file mode 100644 index 0000000..e92bd71 --- /dev/null +++ b/docs/source/horde_sdk.rst @@ -0,0 +1,48 @@ +horde\_sdk package +================== + +Subpackages +----------- + +.. toctree:: + :maxdepth: 4 + + horde_sdk.ai_horde_api + horde_sdk.ai_horde_worker + horde_sdk.generic_api + horde_sdk.ratings_api + +Submodules +---------- + +horde\_sdk.consts module +------------------------ + +.. automodule:: horde_sdk.consts + :members: + :undoc-members: + :show-inheritance: + +horde\_sdk.localize module +-------------------------- + +.. automodule:: horde_sdk.localize + :members: + :undoc-members: + :show-inheritance: + +horde\_sdk.utils module +----------------------- + +.. automodule:: horde_sdk.utils + :members: + :undoc-members: + :show-inheritance: + +Module contents +--------------- + +.. automodule:: horde_sdk + :members: + :undoc-members: + :show-inheritance: diff --git a/docs/source/index.rst b/docs/source/index.rst new file mode 100644 index 0000000..6d47163 --- /dev/null +++ b/docs/source/index.rst @@ -0,0 +1,31 @@ +.. horde_sdk documentation master file, created by + sphinx-quickstart on Fri Jul 7 10:37:15 2023. + You can adapt this file completely to your liking, but it should at least + contain the root `toctree` directive. + +Welcome to horde_sdk's documentation! +===================================== + +**horde_sdk** is a Python library for interacting with the AI-Horde API and for working in its ecosystem. + +.. note:: + **horde_sdk** is currently in alpha. Everything is subject to change. + +To get started, check out the :ref:`Installation` section. + +.. toctree:: + :maxdepth: 2 + + modules + horde_sdk + horde_sdk.ai_horde_api + horde_sdk.generic_api + + + +Indices and tables +================== + +* :ref:`genindex` +* :ref:`modindex` +* :ref:`search` diff --git a/docs/source/modules.rst b/docs/source/modules.rst new file mode 100644 index 0000000..8f5299e --- /dev/null +++ b/docs/source/modules.rst @@ -0,0 +1,7 @@ +src +=== + +.. toctree:: + :maxdepth: 4 + + horde_sdk diff --git a/docs/source/usage.rst b/docs/source/usage.rst new file mode 100644 index 0000000..e3628b6 --- /dev/null +++ b/docs/source/usage.rst @@ -0,0 +1,13 @@ +Usage +===== + +Installation +------------ + +To get started, you need to install the package into your project: + +.. code-block:: console + + pip install horde_sdk + +Note that this package requires 3.10 or higher.