From 0814b98464286c161f0083134bbd737e19b5e945 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Thu, 25 Jul 2024 13:05:01 +0200 Subject: [PATCH] Add Nitrokey Python SDK documentation Fixes: https://github.com/Nitrokey/nitrokey-documentation/issues/329 --- .github/workflows/build.yml | 5 +++++ .github/workflows/ci.yml | 10 ++++++++-- .gitmodules | 3 +++ Makefile | 1 + nitrokey-sdk-py | 1 + source/components/software/index.rst | 1 + source/components/software/nitrokey-sdk-py | 1 + source/conf.py | 9 ++++++++- 8 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 .gitmodules create mode 160000 nitrokey-sdk-py create mode 120000 source/components/software/nitrokey-sdk-py diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8cc2993b6d..63ac89658d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -26,9 +26,14 @@ jobs: - name: Checkout uses: actions/checkout@v4 + with: + submodules: true - name: Install additional python packages run: pip3 install -r requirements.txt + + - name: Install Nitrokey Python SDK + run: pip3 install ./nitrokey-sdk-py - name: Quick build docs run: | diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 59e3e2e2ce..81e30c349d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,15 +6,18 @@ jobs: syntax-check: name: Check syntax runs-on: ubuntu-latest - container: python:3.11-slim + container: python:3.11 continue-on-error: true steps: - name: Checkout repository uses: actions/checkout@v3 + with: + submodules: true - name: Create virtual environment run: | python -m venv venv venv/bin/pip3 install -r requirements.txt + venv/bin/pip3 install ./nitrokey-sdk-py - name: Syntax check run: | . venv/bin/activate @@ -23,14 +26,17 @@ jobs: build-error-check: name: Check build error runs-on: ubuntu-latest - container: python:3.11-slim + container: python:3.11 steps: - name: Checkout repository uses: actions/checkout@v3 + with: + submodules: true - name: Create virtual environment run: | python -m venv venv venv/bin/pip3 install -r requirements.txt + venv/bin/pip3 install ./nitrokey-sdk-py - name: Build documentation run: | . venv/bin/activate diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000000..7554761a5c --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "nitrokey-sdk-py"] + path = nitrokey-sdk-py + url = https://github.com/Nitrokey/nitrokey-sdk-py.git diff --git a/Makefile b/Makefile index 2d144c4e82..0560621ca2 100644 --- a/Makefile +++ b/Makefile @@ -7,6 +7,7 @@ all: venv venv: python -m venv venv venv/bin/pip3 install -r requirements.txt + venv/bin/pip3 install ./nitrokey-sdk-py clean: rm -rf dist build venv diff --git a/nitrokey-sdk-py b/nitrokey-sdk-py new file mode 160000 index 0000000000..4fa7307b95 --- /dev/null +++ b/nitrokey-sdk-py @@ -0,0 +1 @@ +Subproject commit 4fa7307b956715c6c3120f22b13ed8a13f422093 diff --git a/source/components/software/index.rst b/source/components/software/index.rst index 2fc32150d5..86736050ca 100644 --- a/source/components/software/index.rst +++ b/source/components/software/index.rst @@ -7,3 +7,4 @@ Software nk-app2/index nitropy/index + nitrokey-sdk-py/index diff --git a/source/components/software/nitrokey-sdk-py b/source/components/software/nitrokey-sdk-py new file mode 120000 index 0000000000..1acb0b2809 --- /dev/null +++ b/source/components/software/nitrokey-sdk-py @@ -0,0 +1 @@ +../../../nitrokey-sdk-py/docs/ \ No newline at end of file diff --git a/source/conf.py b/source/conf.py index 3165f8f854..bd97dd48c8 100644 --- a/source/conf.py +++ b/source/conf.py @@ -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', @@ -71,7 +72,7 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. -exclude_patterns = ['venv/*', 'components/nethsm/_*.rst', 'components/to-be-integrated.rst'] +exclude_patterns = ['venv/*', 'components/nethsm/_*.rst', 'components/to-be-integrated.rst', 'nitrokey-sdk-py/*'] # The name of the Pygments (syntax highlighting) style to use. #pygments_style = "solarizeddark" @@ -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'