Skip to main content

compatibility

Utilities for handling task compatibility with different SDK versions.

Module

Functions

check_task_compatibility

def check_task_compatibility(    task_data: Dict[str, Any],    config_class: Type,    context: Optional[Dict[str, Any]] = None,)> Tuple[bool, Optional[Any], Optional[str]]:

Check if a task is compatible with the current SDK version.

Arguments

  • task_data: The task data to check
  • config_class: The dataclass to use for validation
  • context: Optional context to pass to the schema

Returns Tuple of (is_compatible, parsed_task, error_message)

create_error_message

def create_error_message(    message: str,    validation_error: Optional[marshmallow.exceptions.ValidationError] = None,)> str:

Create an error message, logging the validation error if provided.

Arguments

  • message: The main error message
  • validation_error: Optional validation error to log

Returns The formatted error message

extract_version_changes

def extract_version_changes(from_version: str, to_version: str)> Tuple[List[str], bool]:

Extract changes between two versions from the version.py file.

Arguments

  • from_version: The source version
  • to_version: The target version

Returns Tuple of (list of change descriptions, is_complete_history): is_complete_history is False if the from_version is older than the oldest version in the changelog

get_compatible_versions_for_modeller

def get_compatible_versions_for_modeller()> List[str]:

Get compatible versions for the modeller role.

Returns List of compatible versions

parse_semver

def parse_semver(version: str)> Optional[semver.version.Version]:

Parse a semantic version string.

Arguments

  • version: The version string to parse

Returns Parsed VersionInfo object or None if parsing fails

validate_task_compatibility

def validate_task_compatibility(    task_data: Dict[str, Any],    config_class: Type,    context: Optional[Dict[str, Any]] = None,)> Any:

Validate task compatibility and return parsed task or raise informative error.

Arguments

  • task_data: The task data to validate
  • config_class: The dataclass to use for validation
  • context: Optional context to pass to the schema

Returns The parsed task if compatible

Raises

  • BitfountVersionError: If task is incompatible with detailed message