cyclonedx.schema.deprecation

This module provides warning classes for deprecated features in CycloneDX schemas. Each warning class corresponds to a specific schema version, enabling downstream code to catch, filter, or otherwise handle schema-specific deprecation warnings.

Intended Usage

Downstream consumers can manage warnings using Python’s warnings module. Common scenarios include:

  • Filtering by schema version

  • Suppressing warnings in tests or batch processing

  • Logging or reporting deprecation warnings without raising exceptions

Example

import warnings
from cyclonedx.schema.deprecation import (
    BaseSchemaDeprecationWarning,
    SchemaDeprecationWarning1Dot7,
)

# Suppress all CycloneDX schema deprecation warnings
warnings.filterwarnings("ignore", category=BaseSchemaDeprecationWarning)

# Suppress only warnings specific to schema version 1.7
warnings.filterwarnings("ignore", category=SchemaDeprecationWarning1Dot7)

Notes

  • All deprecation warnings inherit from BaseSchemaDeprecationWarning.

  • The SCHEMA_VERSION class variable indicates the CycloneDX schema version where the feature became deprecated.

  • These warning classes are designed for downstream filtering and logging, not for raising exceptions.

Module Contents

exception cyclonedx.schema.deprecation.BaseSchemaDeprecationWarning

Bases: DeprecationWarning, abc.ABC

Base class for warnings about deprecated schema features.

class args
SCHEMA_VERSION :ClassVar[cyclonedx.schema.SchemaVersion]
add_note()

Exception.add_note(note) – add a note to the exception

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception cyclonedx.schema.deprecation.SchemaDeprecationWarning1Dot7

Bases: BaseSchemaDeprecationWarning

Class for warnings about deprecated schema features in CycloneDX 1.7

class args
SCHEMA_VERSION :ClassVar[Literal[cyclonedx.schema.SchemaVersion.V1_7]]
add_note()

Exception.add_note(note) – add a note to the exception

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception cyclonedx.schema.deprecation.SchemaDeprecationWarning1Dot6

Bases: BaseSchemaDeprecationWarning

Class for warnings about deprecated schema features in CycloneDX 1.6

class args
SCHEMA_VERSION :ClassVar[Literal[cyclonedx.schema.SchemaVersion.V1_6]]
add_note()

Exception.add_note(note) – add a note to the exception

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception cyclonedx.schema.deprecation.SchemaDeprecationWarning1Dot5

Bases: BaseSchemaDeprecationWarning

Class for warnings about deprecated schema features in CycloneDX 1.5

class args
SCHEMA_VERSION :ClassVar[Literal[cyclonedx.schema.SchemaVersion.V1_5]]
add_note()

Exception.add_note(note) – add a note to the exception

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception cyclonedx.schema.deprecation.SchemaDeprecationWarning1Dot4

Bases: BaseSchemaDeprecationWarning

Class for warnings about deprecated schema features in CycloneDX 1.4

class args
SCHEMA_VERSION :ClassVar[Literal[cyclonedx.schema.SchemaVersion.V1_4]]
add_note()

Exception.add_note(note) – add a note to the exception

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception cyclonedx.schema.deprecation.SchemaDeprecationWarning1Dot3

Bases: BaseSchemaDeprecationWarning

Class for warnings about deprecated schema features in CycloneDX 1.3

class args
SCHEMA_VERSION :ClassVar[Literal[cyclonedx.schema.SchemaVersion.V1_3]]
add_note()

Exception.add_note(note) – add a note to the exception

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception cyclonedx.schema.deprecation.SchemaDeprecationWarning1Dot2

Bases: BaseSchemaDeprecationWarning

Class for warnings about deprecated schema features in CycloneDX 1.2

class args
SCHEMA_VERSION :ClassVar[Literal[cyclonedx.schema.SchemaVersion.V1_2]]
add_note()

Exception.add_note(note) – add a note to the exception

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.

exception cyclonedx.schema.deprecation.SchemaDeprecationWarning1Dot1

Bases: BaseSchemaDeprecationWarning

Class for warnings about deprecated schema features in CycloneDX 1.1

class args
SCHEMA_VERSION :ClassVar[Literal[cyclonedx.schema.SchemaVersion.V1_1]]
add_note()

Exception.add_note(note) – add a note to the exception

with_traceback()

Exception.with_traceback(tb) – set self.__traceback__ to tb and return self.