@@ -37,17 +37,22 @@ dependencies = [
3737 " pyyaml" ,
3838 " rdflib" ,
3939 " semantic_version" ,
40- " spdx-python-model @ git+https://github.com/spdx/spdx-python-model.git@main" ,
4140 " uritools" ,
4241 " xmltodict" ,
4342]
4443dynamic = [" version" ]
4544
4645[project .optional-dependencies ]
4746test = [" pyshacl" , " pytest" , " tzdata" ]
48- code_style = [" black" , " flake8" , " isort" ]
47+ code_style = [" black" , " flake8" , " isort" , " mypy " ]
4948graph_generation = [" networkx" , " pygraphviz" ]
50- development = [" black" , " flake8" , " isort" , " networkx" , " pyshacl" , " pytest" ]
49+ # Experimental SPDX 3.0 support is built on the spdx-python-model bindings.
50+ # It is an optional extra (not a core dependency) because the bindings are not
51+ # yet published to PyPI and must be built from git, where the build-time code
52+ # generation does not currently work on Windows. Keeping it optional ensures the
53+ # core package installs on all platforms. Install with: pip install ".[spdx3]"
54+ spdx3 = [" spdx-python-model @ git+https://github.com/spdx/spdx-python-model.git@main" ]
55+ development = [" black" , " flake8" , " isort" , " mypy" , " networkx" , " pyshacl" , " pytest" ]
5156
5257[project .scripts ]
5358pyspdxtools = " spdx_tools.spdx.clitools.pyspdxtools:main"
@@ -60,6 +65,31 @@ Repository = "https://github.com/spdx/tools-python.git"
6065Issues = " https://github.com/spdx/tools-python/issues"
6166Changelog = " https://github.com/spdx/tools-python/blob/main/CHANGELOG.md"
6267
68+ [tool .mypy ]
69+ python_version = " 3.10"
70+ strict = true
71+ mypy_path = " src"
72+ explicit_package_bases = true
73+ # The new SPDX 3 code is fully typed and checked under --strict.
74+ # The legacy SPDX 2 modules are not strict-clean yet and are out of scope here;
75+ # they are excluded below so they don't mask issues in the new code.
76+ files = [
77+ " src/spdx_tools/spdx3/formats.py" ,
78+ " src/spdx_tools/spdx3/parser" ,
79+ ]
80+
81+ # spdx-python-model ships a py.typed marker but its generated bindings expose
82+ # many attributes as Any; this keeps strict checks meaningful without noise.
83+ [[tool .mypy .overrides ]]
84+ module = [" spdx_python_model.*" ]
85+ ignore_missing_imports = true
86+
87+ # Pre-existing SPDX 2 code imported by the new modules (e.g. SPDXParsingError)
88+ # is not yet strict-typed; do not fail the new-code check on it.
89+ [[tool .mypy .overrides ]]
90+ module = [" spdx_tools.spdx.*" ]
91+ ignore_errors = true
92+
6393[tool .setuptools ]
6494include-package-data = true
6595
0 commit comments