spdx-python-model 0.0.4__tar.gz → 0.0.5__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (24) hide show
  1. {spdx_python_model-0.0.4 → spdx_python_model-0.0.5}/.github/workflows/test.yaml +4 -2
  2. {spdx_python_model-0.0.4 → spdx_python_model-0.0.5}/.gitignore +1 -0
  3. {spdx_python_model-0.0.4 → spdx_python_model-0.0.5}/PKG-INFO +3 -1
  4. spdx_python_model-0.0.5/gen/generate-bindings +35 -0
  5. spdx_python_model-0.0.5/gen/v3_0_1/__init__.py +13 -0
  6. spdx_python_model-0.0.5/gen/v3_0_1/__main__.py +12 -0
  7. spdx_python_model-0.0.5/gen/v3_0_1/cmd.py +75 -0
  8. spdx_python_model-0.0.4/src/spdx_python_model/bindings/v3_0_1.py → spdx_python_model-0.0.5/gen/v3_0_1/model.py +3126 -2663
  9. spdx_python_model-0.0.5/gen/v3_0_1/model.pyi +2755 -0
  10. {spdx_python_model-0.0.4 → spdx_python_model-0.0.5}/pyproject.toml +7 -4
  11. spdx_python_model-0.0.5/src/spdx_python_model/bindings/v3_0_1/__init__.py +13 -0
  12. spdx_python_model-0.0.5/src/spdx_python_model/bindings/v3_0_1/__main__.py +12 -0
  13. spdx_python_model-0.0.5/src/spdx_python_model/bindings/v3_0_1/cmd.py +75 -0
  14. spdx_python_model-0.0.5/src/spdx_python_model/bindings/v3_0_1/model.py +6751 -0
  15. spdx_python_model-0.0.5/src/spdx_python_model/bindings/v3_0_1/model.pyi +2755 -0
  16. spdx_python_model-0.0.5/src/spdx_python_model/py.typed +0 -0
  17. {spdx_python_model-0.0.4 → spdx_python_model-0.0.5}/src/spdx_python_model/version.py +1 -1
  18. spdx_python_model-0.0.4/gen/generate-bindings +0 -25
  19. {spdx_python_model-0.0.4 → spdx_python_model-0.0.5}/.github/workflows/publish.yaml +0 -0
  20. {spdx_python_model-0.0.4 → spdx_python_model-0.0.5}/LICENSE +0 -0
  21. {spdx_python_model-0.0.4 → spdx_python_model-0.0.5}/README.md +0 -0
  22. {spdx_python_model-0.0.4 → spdx_python_model-0.0.5}/src/spdx_python_model/__init__.py +0 -0
  23. {spdx_python_model-0.0.4 → spdx_python_model-0.0.5}/src/spdx_python_model/bindings/__init__.py +0 -0
  24. {spdx_python_model-0.0.4 → spdx_python_model-0.0.5}/tests/test_import.py +0 -0
@@ -15,10 +15,12 @@ jobs:
15
15
  - "3.10"
16
16
  - "3.11"
17
17
  - "3.12"
18
+ - "3.13"
19
+ - "3.14"
18
20
  steps:
19
- - uses: actions/checkout@v4
21
+ - uses: actions/checkout@v6
20
22
  - name: Setup Python ${{ matrix.python-version }}
21
- uses: actions/setup-python@v4
23
+ uses: actions/setup-python@v6
22
24
  with:
23
25
  python-version: ${{ matrix.python-version }}
24
26
  - name: Install dependencies
@@ -162,3 +162,4 @@ cython_debug/
162
162
 
163
163
  src/spdx_python_model/bindings/
164
164
  gen/*.py
165
+ gen/*.pyi
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: spdx_python_model
3
- Version: 0.0.4
3
+ Version: 0.0.5
4
4
  Summary: SPDX Model Python Bindings
5
5
  Project-URL: Homepage, https://github.com/spdx/spdx-python-model
6
6
  Project-URL: Repository, https://github.com/spdx/spdx-python-model.git
@@ -15,6 +15,8 @@ Classifier: Programming Language :: Python :: 3.9
15
15
  Classifier: Programming Language :: Python :: 3.10
16
16
  Classifier: Programming Language :: Python :: 3.11
17
17
  Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
18
20
  Classifier: Topic :: Software Development :: Libraries :: Python Modules
19
21
  Requires-Python: >=3.9
20
22
  Provides-Extra: dev
@@ -0,0 +1,35 @@
1
+ #! /bin/sh
2
+ #
3
+ # SPDX-License-Identifier: Apache-2.0
4
+
5
+ set -e
6
+
7
+ # SPDX versions to generate
8
+ SPDX_VERSIONS="3.0.1"
9
+
10
+ mkdir -p "gen"
11
+
12
+ echo "# Import all versions" > __init__.py
13
+
14
+ for v in $SPDX_VERSIONS; do
15
+ MODNAME="v$(echo "$v" | sed 's/[^a-zA-Z0-9_]/_/g')"
16
+
17
+ if [ -n "${SHACL2CODE_SPDX_DIR}" ] && [ -d "${SHACL2CODE_SPDX_DIR}/$v" ]
18
+ then
19
+ shacl2code generate --input "file://${SHACL2CODE_SPDX_DIR}/$v/spdx-model.ttl" \
20
+ --input "file://${SHACL2CODE_SPDX_DIR}/$v/spdx-json-serialize-annotations.ttl" \
21
+ --context-url "file://${SHACL2CODE_SPDX_DIR}/$v/spdx-context.jsonld" https://spdx.org/rdf/$v/spdx-context.jsonld \
22
+ --license Apache-2.0 \
23
+ python \
24
+ --output "$MODNAME"
25
+ else
26
+ shacl2code generate --input https://spdx.org/rdf/$v/spdx-model.ttl \
27
+ --input https://spdx.org/rdf/$v/spdx-json-serialize-annotations.ttl \
28
+ --context https://spdx.org/rdf/$v/spdx-context.jsonld \
29
+ --license Apache-2.0 \
30
+ python \
31
+ --output "$MODNAME"
32
+ fi
33
+
34
+ echo "from . import $MODNAME" >> __init__.py
35
+ done
@@ -0,0 +1,13 @@
1
+ #! /usr/bin/env python3
2
+ #
3
+ # This file was auto-generated by shacl2code 1.0.1. DO NOT MANUALLY MODIFY IT
4
+ #
5
+ # SPDX-License-Identifier: Apache-2.0
6
+
7
+ from .model import * # noqa: F401, F403
8
+
9
+ # fmt: off
10
+ """Format Guard"""
11
+ from .cmd import main # noqa: F401, I100, I202
12
+ """Format Guard"""
13
+ # fmt on
@@ -0,0 +1,12 @@
1
+ #! /usr/bin/env python3
2
+ #
3
+ # This file was auto-generated by shacl2code 1.0.1. DO NOT MANUALLY MODIFY IT
4
+ #
5
+ # SPDX-License-Identifier: Apache-2.0
6
+
7
+ import sys
8
+
9
+ from .cmd import main
10
+
11
+ if __name__ == "__main__":
12
+ sys.exit(main())
@@ -0,0 +1,75 @@
1
+ #! /usr/bin/env python3
2
+ #
3
+ # This file was auto-generated by shacl2code 1.0.1. DO NOT MANUALLY MODIFY IT
4
+ #
5
+ # SPDX-License-Identifier: Apache-2.0
6
+
7
+ import argparse
8
+ from pathlib import Path
9
+ from typing import Any, Iterable, List
10
+
11
+ from .model import (
12
+ JSONLDDeserializer,
13
+ JSONLDSerializer,
14
+ ListProxy,
15
+ SHACLObject,
16
+ SHACLObjectSet,
17
+ )
18
+
19
+
20
+ def print_tree(objects: Iterable[SHACLObject], all_fields: bool = False) -> None:
21
+ """
22
+ Print object tree
23
+ """
24
+ seen = set()
25
+
26
+ def callback(value: Any, path: List[str]) -> bool:
27
+ s = (" " * (len(path) - 1)) + f"{path[-1]}"
28
+ if isinstance(value, SHACLObject):
29
+ s += f" {value} ({id(value)})"
30
+ is_empty = False
31
+ elif isinstance(value, ListProxy):
32
+ is_empty = len(value) == 0
33
+ if is_empty:
34
+ s += " []"
35
+ else:
36
+ s += f" {value!r}"
37
+ is_empty = value is None
38
+
39
+ if all_fields or not is_empty:
40
+ print(s)
41
+
42
+ if isinstance(value, SHACLObject):
43
+ if value in seen:
44
+ return False
45
+ seen.add(value)
46
+ return True
47
+
48
+ return True
49
+
50
+ for o in objects:
51
+ o.walk(callback)
52
+
53
+
54
+ def main() -> int:
55
+ parser = argparse.ArgumentParser(description="Python SHACL model test")
56
+ parser.add_argument("infile", type=Path, help="Input file")
57
+ parser.add_argument("--print", action="store_true", help="Print object tree")
58
+ parser.add_argument("--outfile", type=Path, help="Output file")
59
+
60
+ args = parser.parse_args()
61
+
62
+ objectset = SHACLObjectSet()
63
+ with args.infile.open("r") as f:
64
+ d = JSONLDDeserializer()
65
+ d.read(f, objectset)
66
+
67
+ if args.print:
68
+ print_tree(objectset.objects)
69
+
70
+ if args.outfile:
71
+ with args.outfile.open("wb") as f:
72
+ s = JSONLDSerializer()
73
+ s.write(objectset, f)
74
+
75
+ return 0