Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: migrate to v8.0.0 #684

Merged
merged 6 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,4 @@ If you're looking for a CycloneDX tool to run to generate (SBOM) software bill-o
contributing
support
changelog
upgrading
62 changes: 62 additions & 0 deletions docs/upgrading.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
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 used libraries during the build process.

.. 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.ToolsRepository`, now.
Therefore, the process of adding new tools needs to be migrated changed.

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.ToolsRepository`, now.
Therefore, the process of adding new tools needs to be migrated changed.

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)``
3 changes: 3 additions & 0 deletions examples/complex_serialize.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

from packageurl import PackageURL

from cyclonedx.builder.this import this_component as cdx_lib_component
from cyclonedx.exception import MissingOptionalDependencyException
from cyclonedx.factory.license import LicenseFactory
from cyclonedx.model import XsUri
Expand All @@ -43,6 +44,8 @@
# region build the BOM

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

bom.metadata.component = root_component = Component(
name='myApp',
type=ComponentType.APPLICATION,
Expand Down