Skip to content
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
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
8 changes: 5 additions & 3 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 @@ -10,9 +10,11 @@ built.
manipulating SPDX files. While they are fully functions, they lack higher level
helper functions that may be useful for creating SPDX documents. If you want a
higher level approach, please see the
[SPDX Python Tools](https://github.com/spdx/tools-python) (however this repo
[SPDX Python Tools](https://github.com/spdx/tools-python) (however, it
doesn't yet support SPDX 3)

[spdx-spec]: https://spdx.org/specifications

## Installation

### Install from PyPI
Expand All @@ -31,7 +33,7 @@ python3 -m pip install git+https://github.com/spdx/spdx-python-model.git@main
```

Note that this will pull the latest version from the `main` branch. If you want
a specific commit, replace `main` with the git commit SHA
a specific commit, replace `main` with the git commit SHA.

### Install/build using local SPDX model files

Expand Down
7 changes: 6 additions & 1 deletion src/spdx_python_model/__init__.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# SPDX-FileType: SOURCE
# SPDX-License-Identifier: Apache-2.0
#
"""SPDX 3 model."""
"""
SPDX 3 model.

.. include:: ../../README.md
:end-before: Testing
"""

import importlib
import json
Expand Down