-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #622 from lukpueh/rtd-docs
Automate Signer API docs for RTD
- Loading branch information
Showing
12 changed files
with
218 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,3 +15,6 @@ env/* | |
tests/htmlcov/* | ||
.DS_Store | ||
.python-version | ||
|
||
# Sphinx documentation | ||
docs/_build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# .readthedocs.yaml | ||
# Read the Docs configuration file | ||
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details | ||
|
||
version: 2 | ||
build: | ||
os: ubuntu-22.04 | ||
apt_packages: | ||
- swig | ||
- softhsm2 | ||
tools: | ||
python: "3.11" | ||
|
||
sphinx: | ||
builder: html | ||
configuration: docs/conf.py | ||
fail_on_warning: true | ||
|
||
python: | ||
install: | ||
- requirements: requirements-docs.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Configuration file for the Sphinx documentation builder. | ||
# | ||
# This file only contains a selection of the most common options. For a full | ||
# list see the documentation: | ||
# https://www.sphinx-doc.org/en/master/usage/configuration.html | ||
|
||
# -- Path setup -------------------------------------------------------------- | ||
|
||
# If extensions (or modules to document with autodoc) are in another directory, | ||
# add these directories to sys.path here. If the directory is relative to the | ||
# documentation root, use os.path.abspath to make it absolute, like shown here. | ||
# | ||
import os | ||
import sys | ||
|
||
sys.path.insert(0, os.path.abspath(os.path.join(".."))) | ||
|
||
import securesystemslib | ||
|
||
# -- Project information ----------------------------------------------------- | ||
|
||
project = "securesystemslib" | ||
copyright = "2023, New York University and the securesystemslib contributors" | ||
author = "New York University and the securesystemslib contributors" | ||
|
||
|
||
# -- General configuration --------------------------------------------------- | ||
|
||
master_doc = "index" | ||
|
||
# Add any Sphinx extension module names here, as strings. They can be | ||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom | ||
# ones. | ||
extensions = [ | ||
"sphinx.ext.napoleon", | ||
"sphinx.ext.autosummary", | ||
"sphinx.ext.autosectionlabel", | ||
] | ||
|
||
autosectionlabel_prefix_document = True | ||
|
||
|
||
# -- Options for HTML output ------------------------------------------------- | ||
|
||
# The theme to use for HTML and HTML Help pages. See the documentation for | ||
# a list of builtin themes. | ||
html_theme = "sphinx_rtd_theme" | ||
|
||
# -- Autodoc configuration --------------------------------------------------- | ||
# https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html | ||
|
||
# Shorten paths | ||
add_module_names = False | ||
python_use_unqualified_type_names = True | ||
|
||
# Show typehints in argument doc lines, but not in signatures | ||
autodoc_typehints = "description" | ||
|
||
autodoc_default_options = { | ||
"members": True, | ||
"inherited-members": "Exception", # excl. members inherited from 'Exception' | ||
} | ||
|
||
# Version | ||
version = securesystemslib.__version__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Welcome to ``securesystemslib`` | ||
=============================== | ||
|
||
A cryptography interface to sign and verify `TUF | ||
<https://theupdateframework.io>`_ and `in-toto <https://in-toto.io>`_ metadata. | ||
|
||
.. note:: | ||
This documentation is built for | ||
`securesystemslib (Python) <https://github.com/secure-systems-lab/securesystemslib>`_, used by | ||
`python-tuf <https://github.com/theupdateframework/python-tuf/>`_ and | ||
`in-toto (Python) <https://github.com/in-toto/in-toto>`_ reference implementations. | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
:caption: Contents | ||
|
||
signer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Signer API | ||
========== | ||
|
||
.. currentmodule:: securesystemslib.signer | ||
|
||
.. warning:: | ||
The API is experimental and may change without warning in versions ``<1.0.0``. | ||
|
||
See `'New Signer API' <https://theupdateframework.github.io/python-tuf/2023/01/24/securesystemslib-signer-api.html>`_ blog post | ||
for background infos. | ||
|
||
|
||
.. Autodoc cannot resolve docs for imported globals (sphinx-doc/sphinx#6495) | ||
.. As workaround we reference their original internal definition. | ||
.. autodata:: securesystemslib.signer._signer.SIGNER_FOR_URI_SCHEME | ||
:no-value: | ||
.. autodata:: securesystemslib.signer._key.KEY_FOR_TYPE_AND_SCHEME | ||
:no-value: | ||
.. autoclass:: securesystemslib.signer.Signer | ||
.. autoclass:: securesystemslib.signer.Key | ||
.. autoclass:: securesystemslib.signer.Signature |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,5 @@ tox | |
-r requirements.txt | ||
-r requirements-test.txt | ||
-r requirements-lint.txt | ||
-r requirements-docs.txt | ||
-e . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
-r requirements-pinned.txt | ||
|
||
# install sphinx and its extensions | ||
sphinx | ||
sphinx-rtd-theme |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters