diff --git a/.readthedocs.yaml b/.readthedocs.yaml new file mode 100644 index 0000000..3ab9713 --- /dev/null +++ b/.readthedocs.yaml @@ -0,0 +1,16 @@ +version: 2 +formats: + - epub + - pdf +build: + os: ubuntu-lts-latest + tools: + python: "3.12" +sphinx: + configuration: docs/conf.py +python: + install: + - method: pip + path: . + extra_requirements: + - docs diff --git a/docs/Makefile b/docs/Makefile new file mode 100644 index 0000000..d4bb2cb --- /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 = . +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/conf.py b/docs/conf.py new file mode 100644 index 0000000..d9eab65 --- /dev/null +++ b/docs/conf.py @@ -0,0 +1,45 @@ +# 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 os, sys + +# -- Project information ----------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information + +project = 'netauth' +copyright = '2024, classabbyamp' +author = 'classabbyamp' +release = '0.0.1' + +# -- General configuration --------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration + +extensions = [ + 'sphinx.ext.autodoc', + 'sphinx_autodoc_typehints', + 'enum_tools.autoenum', +] + +templates_path = ['_templates'] +exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] + +autodoc_member_order = 'bysource' +autodoc_type_aliases = { + 'KVDict': 'dict[str, list[str]]', +} + +sys.path.insert(0, os.path.abspath('..')) + +# -- Options for HTML output ------------------------------------------------- +# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output + +html_theme = 'sphinx_rtd_theme' +html_static_path = ['_static'] + +html_logo = "https://www.netauth.org/img/NetAuthLock.png" +html_theme_options = { + 'collapse_navigation': False, + 'navigation_depth': 2, +} diff --git a/docs/index.rst b/docs/index.rst new file mode 100644 index 0000000..5439483 --- /dev/null +++ b/docs/index.rst @@ -0,0 +1,91 @@ +NetAuth for Python +================== + +A `NetAuth `_ client library for Python. + +.. currentmodule:: netauth + +.. autoclass:: NetAuth + :members: + +Data Types +~~~~~~~~~~ + +.. autoclass:: EntityMeta + :members: + +.. autoclass:: Entity + :members: + +.. autoclass:: Group + :members: + +.. currentmodule:: netauth.v2 + +.. autoclass:: SubSystemStatus + :members: + +.. autoclass:: ServerStatus + :members: + +Enumerations +~~~~~~~~~~~~ + +.. currentmodule:: netauth + +.. autoenum:: Capability + +.. autoenum:: ExpansionMode + +.. currentmodule:: netauth.v2 + +.. autoenum:: Action + +.. autoenum:: RuleAction + +Token Cache +~~~~~~~~~~~ + +.. currentmodule:: netauth.cache + +.. autoclass:: TokenCache + :members: + +.. autoclass:: FSTokenCache + :members: + +.. autoclass:: MemoryTokenCache + :members: + + +Exceptions +~~~~~~~~~~ + +.. currentmodule:: netauth.error + +.. autoclass:: NetAuthException + :members: + +.. autoclass:: NetAuthRpcError + :members: + +.. autoclass:: RequestorUnqualifiedError + :members: + +.. autoclass:: MalformedRequestError + :members: + +.. autoclass:: InternalError + :members: + +.. autoclass:: UnauthenticatedError + :members: + +.. autoclass:: ReadOnlyError + :members: + +.. autoclass:: ExistsError + :members: + +.. autoclass:: DoesNotExistError + :members: diff --git a/docs/make.bat b/docs/make.bat new file mode 100644 index 0000000..32bb245 --- /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=. +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/pyproject.toml b/pyproject.toml index 7e77a45..95625ba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -27,6 +27,13 @@ dependencies = [ dev = [ "grpcio-tools", ] +docs = [ + "sphinx", + "sphinx-rtd-theme", + "sphinx-toolbox", + "sphinx-autodoc-typehints", + "enum-tools", +] ci = [ "ruff", ]