Skip to content
Open
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
73 changes: 73 additions & 0 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
@@ -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 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 '<meta http-equiv="refresh" content="0; url=dev/" />' > 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
10 changes: 6 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -78,4 +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
to PyPI.
4 changes: 4 additions & 0 deletions src/spdx_python_model/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#
# SPDX-License-Identifier: Apache-2.0
#
"""
.. include:: ../../README.md
:end-before: Testing
"""

from .bindings import *
from .version import VERSION