Skip to content

Commit

Permalink
Add Nitrokey Python SDK documentation
Browse files Browse the repository at this point in the history
Fixes: #329
  • Loading branch information
robin-nitrokey committed Nov 29, 2024
1 parent a6297ee commit 72fffb2
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
build
dist
venv
nitrokey-sdk-py*
25 changes: 22 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,31 @@
NITROKEY_SDK_PY_VERSION ?= v0.2.3
NITROKEY_SDK_PY_CHECKSUM ?= b0547efe0bce6907f831a80297baf5393825037d3996edd6cf9f1ccc796e736e

NITROKEY_SDK_PY_URL := https://github.com/Nitrokey/nitrokey-sdk-py/archive/refs/tags/$(NITROKEY_SDK_PY_VERSION).tar.gz
NITROKEY_SDK_PY := nitrokey-sdk-py-$(NITROKEY_SDK_PY_VERSION)
NITROKEY_SDK_PY_ARCHIVE := $(NITROKEY_SDK_PY).tar.gz
NITROKEY_SDK_PY_LINK := source/components/software/nitrokey-sdk-py


.PHONY: all
all: venv
venv/bin/sphinx-build -j auto -b html -D language=en -d build/en/doctrees source dist/en

venv:
.PHONY: venv
venv: $(NITROKEY_SDK_PY)
python -m venv venv
venv/bin/pip3 install -r requirements.txt
venv/bin/pip3 install ./$(NITROKEY_SDK_PY)

$(NITROKEY_SDK_PY): $(NITROKEY_SDK_PY_ARCHIVE)
mkdir "$@"
tar --directory "$@" --extract --strip-components 1 --file "$<"
rm -f $(NITROKEY_SDK_PY_LINK)
ln -s ../../../$(NITROKEY_SDK_PY)/docs $(NITROKEY_SDK_PY_LINK)

$(NITROKEY_SDK_PY_ARCHIVE):
curl "$(NITROKEY_SDK_PY_URL)" --location --output "$@"
echo "$(NITROKEY_SDK_PY_CHECKSUM) $@" | sha256sum -c

.PHONY: clean
clean:
rm -rf dist build venv
rm -rf dist build venv nitrokey-sdk-py* $(NITROKEY_SDK_PY_LINK)
1 change: 1 addition & 0 deletions source/components/software/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ Software

nk-app2/index
nitropy/index
nitrokey-sdk-py/index
7 changes: 7 additions & 0 deletions source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.todo',
'sphinx.ext.coverage',
#'sphinx_copybutton',
Expand Down Expand Up @@ -434,3 +435,9 @@

# Disables the closing of tabs if clicked on the currently active tab
sphinx_tabs_disable_tab_closing = True

# -- Options for autodoc extension -------------------------------------------

autodoc_class_signature = 'separated'
autodoc_member_order = 'groupwise'
autodoc_typehints = 'description'

0 comments on commit 72fffb2

Please sign in to comment.