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 Jan 28, 2025
1 parent 50c3362 commit 40dc51f
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 2 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*
22 changes: 20 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
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: docs
docs: 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)

.PHONY: check
check: venv
Expand All @@ -23,9 +31,19 @@ pkg: venv docs


clean:
rm -rf dist build
rm -rf dist build nitrokey-sdk-py* $(NITROKEY_SDK_PY_LINK)

cleaner: clean
rm -rf venv

.PHONY: docs check pkg

$(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
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 @@ -40,6 +40,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 @@ -413,3 +414,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 40dc51f

Please sign in to comment.