File: upgrading.rst

package info (click to toggle)
cyclonedx-python-lib 9.1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,112 kB
  • sloc: xml: 14,752; python: 11,463; makefile: 21; sh: 16
file content (61 lines) | stat: -rw-r--r-- 2,023 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
Upgrading to v8
===============

Version 8 is not backwards compatible. Some behaviours and integrations changed.
This document covers all breaking changes and should give guidance how to migrate from previous versions.

This document is not a full :doc:`change log <changelog>`, but a migration path.

Add this library to Metadata Tools
----------------------------------

This library no longer adds itself to the metadata.

Downstream users SHOULD add the following to their BOM build processes, to keep track of the used library.

.. code-block:: python

    from cyclonedx.builder.this import this_component as cdx_lib_component
    from cyclonedx.model.bom import Bom

    bom = Bom()
    bom.metadata.tools.components.add(cdx_lib_component())

Import model Tool
-----------------

Class `cyclonedx.model.Tool` was moved to :class:`cyclonedx.model.tool.Tool`.
Therefore, the imports need to be migrated.

Old: ``from cyclonedx.model import Tool``

New: ``from cyclonedx.model.tool import Tool``

Alter Metadata Tools
--------------------

Property :attr:`cyclonedx.model.bom.BomMetaData.tools` is an instance of :class:`cyclonedx.model.tool.ToolRepository`, now.
Therefore, the process of adding new tools needs to be migrated.

Old: ``my_bom.metadata.tools.add(my_tool)``

New: ``my_bom.metadata.tools.tools.add(my_tool)``

Alter Vulnerability Tools
-------------------------

Property :attr:`cyclonedx.model.vulnerability.Vulnerability.tools` is an instance of :class:`cyclonedx.model.tool.ToolRepository`, now.
Therefore, the process of adding new tools needs to be migrated.

Old: ``my_vulnerability.tools.add(my_tool)``

New: ``my_vulnerability.tools.tools.add(my_tool)``

Set LicenseExpression Acknowledgement
-------------------------------------

:class:`cyclonedx.model.license.LicenseExpression()` no longer accepts optional arguments in a positional way, but in a key-word way.

Old: ``LicenseExpression(my_exp, my_acknowledgement)``

New: ``LicenseExpression(my_exp, acknowledgement=my_acknowledgement)``