Skip to content

Commit

Permalink
docs: add sphinx docs
Browse files Browse the repository at this point in the history
  • Loading branch information
classabbyamp committed Aug 3, 2024
1 parent ee2949e commit 73759e3
Show file tree
Hide file tree
Showing 6 changed files with 214 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -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
20 changes: 20 additions & 0 deletions docs/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 = .
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)
45 changes: 45 additions & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
@@ -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,
}
91 changes: 91 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
NetAuth for Python
==================

A `NetAuth <https://netauth.org>`_ 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:
35 changes: 35 additions & 0 deletions docs/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=.
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
7 changes: 7 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,13 @@ dependencies = [
dev = [
"grpcio-tools",
]
docs = [
"sphinx",
"sphinx-rtd-theme",
"sphinx-toolbox",
"sphinx-autodoc-typehints",
"enum-tools",
]
ci = [
"ruff",
]
Expand Down

0 comments on commit 73759e3

Please sign in to comment.