From 19ca2addeb7e3badee64f12c45535fa587af9d6c Mon Sep 17 00:00:00 2001 From: Arthit Suriyawongkul Date: Tue, 3 Mar 2026 13:29:05 +0700 Subject: [PATCH 1/6] Publish API docs Signed-off-by: Arthit Suriyawongkul --- .github/workflows/docs.yaml | 73 +++++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 .github/workflows/docs.yaml diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml new file mode 100644 index 0000000..970c097 --- /dev/null +++ b/.github/workflows/docs.yaml @@ -0,0 +1,73 @@ +--- +name: Publish API documentation to GitHub Pages + +on: + push: + branches: + - main + release: + types: [published] + workflow_dispatch: + +permissions: + contents: read + pages: write + id-token: write + +jobs: + deploy-docs: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v6 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v6 + with: + python-version: "3.14" + + - name: Install dependencies + run: pip install . + + - name: Install pdoc + run: pip install pdoc + + - name: Get version + id: get_version + run: | + if [[ "${{ github.event_name }}" == "release" ]]; then + VERSION_RAW="${{ github.event.release.tag_name }}" + echo "VERSION=${VERSION_RAW#v}" >> $GITHUB_ENV + else + echo "VERSION=dev" >> $GITHUB_ENV + fi + + - name: Build docs + env: + VERSION: ${{ env.VERSION }} + run: | + pdoc --html src/spdx_python_model -o docs + # Copy files to versioned/dev directory + mkdir -p "pages/${{ env.VERSION }}" + cp -r docs/* "pages/${{ env.VERSION }}/" + # Create an index.html to redirect to the dev docs + if [[ "${{ env.VERSION }}" == "dev" ]]; then + echo '' > pages/index.html + fi + + - name: Setup Pages + uses: actions/configure-pages@v5 + + - name: Upload artifact + uses: actions/upload-pages-artifact@v4 + with: + path: pages + + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 From 6e42a33bd92ed5c240b6bb5f307de5ab5af93714 Mon Sep 17 00:00:00 2001 From: Arthit Suriyawongkul Date: Tue, 3 Mar 2026 13:32:18 +0700 Subject: [PATCH 2/6] typo: README Signed-off-by: Arthit Suriyawongkul --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6c78b1c..6772bcc 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # spdx-python-model -Generated Python code for SPDX Spec version 3 +Generated Python code for SPDX spec version 3. All bindings in this repository are generated using [shacl2code](https://github.com/JPEWdev/shacl2code) at the time the package is From ced8890cb346456bfe86763ec45ed4c3bdca0c7b Mon Sep 17 00:00:00 2001 From: Arthit Suriyawongkul Date: Tue, 3 Mar 2026 13:34:25 +0700 Subject: [PATCH 3/6] Fix pdoc command Signed-off-by: Arthit Suriyawongkul --- .github/workflows/docs.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs.yaml b/.github/workflows/docs.yaml index 970c097..9a8564b 100644 --- a/.github/workflows/docs.yaml +++ b/.github/workflows/docs.yaml @@ -51,7 +51,7 @@ jobs: env: VERSION: ${{ env.VERSION }} run: | - pdoc --html src/spdx_python_model -o docs + pdoc src/spdx_python_model -o docs # Copy files to versioned/dev directory mkdir -p "pages/${{ env.VERSION }}" cp -r docs/* "pages/${{ env.VERSION }}/" From 0588df1b51a1867a9aafacc0bfe013208e5bba91 Mon Sep 17 00:00:00 2001 From: Arthit Suriyawongkul Date: Tue, 3 Mar 2026 13:47:03 +0700 Subject: [PATCH 4/6] Include README Signed-off-by: Arthit Suriyawongkul --- README.md | 4 +++- src/spdx_python_model/__init__.py | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 6c78b1c..7dbd3e1 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # spdx-python-model -Generated Python code for SPDX Spec version 3 +Generated Python code for [SPDX specification version 3][spdx-spec]. All bindings in this repository are generated using [shacl2code](https://github.com/JPEWdev/shacl2code) at the time the package is @@ -79,3 +79,5 @@ matches the version number specified in `version.py` (e.g. `v1.0.0`). After this, GitHub actions will do the rest to build the package and publish it to PyPi + +[spdx-spec]: https://spdx.org/specifications diff --git a/src/spdx_python_model/__init__.py b/src/spdx_python_model/__init__.py index c3918ed..bab0d2b 100644 --- a/src/spdx_python_model/__init__.py +++ b/src/spdx_python_model/__init__.py @@ -1,6 +1,9 @@ # # SPDX-License-Identifier: Apache-2.0 # +""" +.. include:: ../../README.md +""" from .bindings import * from .version import VERSION From b48c7db07a047917dc4520924135cf454a0ac22c Mon Sep 17 00:00:00 2001 From: Arthit Suriyawongkul Date: Tue, 3 Mar 2026 13:53:20 +0700 Subject: [PATCH 5/6] Do not include dev info in front page Signed-off-by: Arthit Suriyawongkul --- src/spdx_python_model/__init__.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/spdx_python_model/__init__.py b/src/spdx_python_model/__init__.py index bab0d2b..f6e8bbb 100644 --- a/src/spdx_python_model/__init__.py +++ b/src/spdx_python_model/__init__.py @@ -3,6 +3,7 @@ # """ .. include:: ../../README.md + :end-before: Testing """ from .bindings import * From 0ca68cca460004cd6a6bd774aab075759ea3ac09 Mon Sep 17 00:00:00 2001 From: Arthit Suriyawongkul Date: Tue, 3 Mar 2026 13:56:18 +0700 Subject: [PATCH 6/6] Fix link Signed-off-by: Arthit Suriyawongkul --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 7dbd3e1..068a89e 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,9 @@ higher level approach, please see the [SPDX Python Tools](https://github.com/spdx/tools-python) (however this repo doesn't yet support SPDX 3) -## Installation (PyPi) +[spdx-spec]: https://spdx.org/specifications + +## Installation (PyPI) ```shell python3 -m pip install spdx-python-model @@ -22,7 +24,7 @@ python3 -m pip install spdx-python-model ## Installation (Git) If you would like to pull the bindings directly from Git instead of using a -released version from PyPi, the following command can be used: +released version from PyPI, the following command can be used: ```shell python3 -m pip install git+https://github.com/spdx/spdx-python-model.git@main @@ -78,6 +80,4 @@ make a new release in GitHub with the name `v` + *VERSION*, where *VERSION* matches the version number specified in `version.py` (e.g. `v1.0.0`). After this, GitHub actions will do the rest to build the package and publish it -to PyPi - -[spdx-spec]: https://spdx.org/specifications +to PyPI.