1{
2 lib,
3 buildPythonPackage,
4 ddt,
5 fetchFromGitHub,
6 importlib-metadata,
7 jsonschema,
8 license-expression,
9 lxml,
10 packageurl-python,
11 py-serializable,
12 poetry-core,
13 pytestCheckHook,
14 pythonOlder,
15 requirements-parser,
16 sortedcontainers,
17 setuptools,
18 toml,
19 types-setuptools,
20 types-toml,
21 xmldiff,
22}:
23
24buildPythonPackage rec {
25 pname = "cyclonedx-python-lib";
26 version = "11.1.0";
27 pyproject = true;
28
29 disabled = pythonOlder "3.9";
30
31 src = fetchFromGitHub {
32 owner = "CycloneDX";
33 repo = "cyclonedx-python-lib";
34 tag = "v${version}";
35 hash = "sha256-XlsVJTyAeqYex5q/07mFLXfMc9vnS5X+stP77i4IbVc=";
36 };
37
38 pythonRelaxDeps = [ "py-serializable" ];
39
40 build-system = [ poetry-core ];
41
42 dependencies = [
43 importlib-metadata
44 license-expression
45 packageurl-python
46 requirements-parser
47 setuptools
48 sortedcontainers
49 toml
50 py-serializable
51 types-setuptools
52 types-toml
53 ];
54
55 optional-dependencies = {
56 validation = [
57 jsonschema
58 lxml
59 ];
60 json-validation = [
61 jsonschema
62 ];
63 xml-validation = [
64 lxml
65 ];
66 };
67
68 nativeCheckInputs = [
69 ddt
70 pytestCheckHook
71 xmldiff
72 ]
73 ++ lib.flatten (builtins.attrValues optional-dependencies);
74
75 pythonImportsCheck = [ "cyclonedx" ];
76
77 preCheck = ''
78 export PYTHONPATH=tests''${PYTHONPATH+:$PYTHONPATH}
79 '';
80
81 enabledTestPaths = [ "tests/" ];
82
83 disabledTests = [
84 # These tests require network access
85 "test_bom_v1_3_with_metadata_component"
86 "test_bom_v1_4_with_metadata_component"
87 # AssertionError: <ValidationError: "{'algorithm': 'ES256', ...
88 "TestJson"
89 ];
90
91 disabledTestPaths = [
92 # Test failures seem py-serializable related
93 "tests/test_output_xml.py"
94 ];
95
96 meta = with lib; {
97 description = "Python library for generating CycloneDX SBOMs";
98 homepage = "https://github.com/CycloneDX/cyclonedx-python-lib";
99 changelog = "https://github.com/CycloneDX/cyclonedx-python-lib/releases/tag/${src.tag}";
100 license = with licenses; [ asl20 ];
101 maintainers = with maintainers; [ fab ];
102 };
103}