CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-apache-airflow-providers-common-compat

Common Compatibility Provider - providing compatibility code for previous Airflow versions

Pending

Quality

Pending

Does it follow best practices?

Impact

Pending

No eval scenarios have been run

Overview
Eval results
Files

provider-verification.mddocs/

Provider Verification

Decorators and utilities for enforcing minimum version requirements of provider packages and optional dependencies. These functions ensure that required provider versions are available before executing code that depends on them.

Capabilities

Provider Version Enforcement

Decorator that enforces minimum version requirements for Airflow provider packages.

def require_provider_version(provider_name: str, provider_min_version: str):
    """
    Decorator to enforce minimum provider version requirements.
    
    Args:
        provider_name (str): Full provider package name (e.g., "apache-airflow-providers-openlineage")
        provider_min_version (str): Minimum version requirement (e.g., "1.0.1")
    
    Returns:
        Decorator function that checks version before execution
        
    Raises:
        ValueError: If provider_name or provider_min_version is invalid
        TypeError: If arguments are not strings
        AirflowOptionalProviderFeatureException: If provider version requirement not met
    """

OpenLineage Version Enforcement

Specialized decorator for enforcing OpenLineage provider and client version requirements.

def require_openlineage_version(
    provider_min_version: str | None = None, 
    client_min_version: str | None = None
):
    """
    Decorator to enforce minimum OpenLineage version requirements.
    
    Args:
        provider_min_version (str, optional): Minimum version for apache-airflow-providers-openlineage
        client_min_version (str, optional): Minimum version for openlineage-python client
    
    Returns:
        Decorator function that checks versions before execution
        
    Raises:
        ValueError: If version strings are invalid
        TypeError: If arguments are not strings or None
        AirflowOptionalProviderFeatureException: If version requirements not met
    """

Usage Examples

from airflow.providers.common.compat.check import require_provider_version
from airflow.providers.common.compat.openlineage.check import require_openlineage_version

# Require specific provider version
@require_provider_version("apache-airflow-providers-postgres", "5.0.0")
def use_postgres_features():
    from airflow.providers.postgres.operators.postgres import PostgresOperator
    # Code that requires PostgreSQL provider v5.0.0+
    return PostgresOperator(...)

# Require OpenLineage provider version
@require_openlineage_version(provider_min_version="1.2.0")
def use_openlineage_features():
    from airflow.providers.openlineage.extractors import BaseExtractor
    # Code that requires OpenLineage provider v1.2.0+
    return BaseExtractor()

# Require both provider and client versions
@require_openlineage_version(
    provider_min_version="1.2.0",
    client_min_version="0.28.0"
)
def use_advanced_openlineage():
    from openlineage.client import OpenLineageClient
    from airflow.providers.openlineage.plugins.listener import OpenLineageListener
    # Code requiring both provider and client versions
    pass

# Use in operator classes
class MyCustomOperator(BaseOperator):
    @require_provider_version("apache-airflow-providers-http", "4.0.0")
    def execute(self, context):
        from airflow.providers.http.operators.http import HttpOperator
        # Implementation using HTTP provider features
        pass

# Chain multiple version requirements
@require_provider_version("apache-airflow-providers-postgres", "5.0.0")
@require_openlineage_version(provider_min_version="1.0.0")
def complex_data_pipeline():
    # Code that needs both providers
    pass

Install with Tessl CLI

npx tessl i tessl/pypi-apache-airflow-providers-common-compat

docs

asset-management.md

index.md

lineage-entities.md

notifier-compatibility.md

openlineage-integration.md

provider-verification.md

security-permissions.md

standard-components.md

version-compatibility.md

tile.json