Skip to content

Read SPDX 3 by spdx-python-model#897

Open
bact wants to merge 6 commits into
spdx:mainfrom
bact:use-spdx-python-model
Open

Read SPDX 3 by spdx-python-model#897
bact wants to merge 6 commits into
spdx:mainfrom
bact:use-spdx-python-model

Conversation

@bact

@bact bact commented Jun 23, 2026

Copy link
Copy Markdown
Contributor
  • Implement a thin layer for SPDX 3 (any 3.x version) support
  • Using spdx-python-model as binding for SPDX 3 data model
  • Use function names and structure that follow existing public SPDX 2 API of tools-python

This PR is trying to be small, focusing on ground work (format detection, etc), and demonstrate one core functionality (reading a file).

--

A SpdxObjectSet Protocol structural type is introduced for convenience of type checking.
It will allow functions to have a type that is not specific to a SPDX 3.x minor version (spdx_python_.model.v3_0_1.SHACLObjectSet and spdx_python_.model.v3_1.SHACLObjectSet are considered different types).

The plan forward is to use the spdx_tools.spdx3.SpdxObjectSet (and spdx_tools.spdx3.SpdxObject, etc) protocol that derived directly from SPDX 3 RDF+SHACL (generated via spdx-python-model) as SPDX 3 data models' representation -- and remove the entire src/spdx_tools/spdx3/model to avoid maintenance of the multiple model versions (SPDX 3.0, SPDX 3.1, etc).

Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
@bact bact marked this pull request as draft June 23, 2026 15:28
bact added 3 commits June 23, 2026 16:41
Until official spdx-python-model 0.0.6 release

Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
@bact bact marked this pull request as ready for review June 23, 2026 20:14
bact added 2 commits June 23, 2026 21:29
SDPX 3 does not have tag:value format

Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
Signed-off-by: Arthit Suriyawongkul <arthit@gmail.com>
@bact bact marked this pull request as draft June 23, 2026 21:35
@bact bact marked this pull request as ready for review June 26, 2026 11:09
@bact

bact commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

Note: Alternatively, we can implement the SpdxObjectSetProtocol in spdx-python-model instead. (see full proposal at spdx/spdx-python-model#45; and PRs at JPEWdev/shacl2code#114 and spdx/spdx-python-model#52)

This will allow anyone, including the more complete SPDX 3 implementation like ones in PR #898, to use the abstraction and freed them from managing model versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant