Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Nitrokey Python SDK documentation #334

Merged
merged 1 commit into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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'