Skip to content

Migration from ods-utils-py

Guide for migrating from the archived ods-utils-py package to huwise-utils-py.

Overview

The ods-utils-py repository has been archived and replaced by huwise-utils-py. This guide covers the changes needed to migrate your code.

Breaking Changes

Python Version

huwise-utils-py requires Python 3.12 or higher.

# Check your Python version
python --version

Package Name

The package has been renamed:

# Old
from ods_utils_py import get_dataset_title

# New
from huwise_utils_py import get_dataset_title

Environment Variables

Environment variable names have changed:

Old New
ODS_API_KEY HUWISE_API_KEY
ODS_DOMAIN HUWISE_DOMAIN
ODS_API_TYPE HUWISE_API_TYPE

Configuration Validation

Configuration is now validated at runtime using Pydantic. Invalid or missing configuration will raise AppConfigError instead of silently failing.

Migration Steps

Step 1: Update Python

Ensure you're running Python 3.12+:

python --version
# Python 3.12.x

Step 2: Update Environment Variables

Rename your environment variables:

# Old
export ODS_API_KEY="key"
export ODS_DOMAIN="domain"

# New
export HUWISE_API_KEY="key"
export HUWISE_DOMAIN="domain"
export HUWISE_API_TYPE="automation/v1.0"  # Optional

Step 3: Update Package

# Remove old package
pip uninstall ods-utils-py

# Install new package
pip install huwise-utils-py

Step 4: Update Imports

Update your imports:

# Old
from ods_utils_py import get_dataset_title, set_dataset_title

# New
from huwise_utils_py import get_dataset_title, set_dataset_title

New Features

While migrating, consider taking advantage of new features:

HuwiseDataset Class

Object-oriented interface with method chaining:

from huwise_utils_py import HuwiseDataset

dataset = HuwiseDataset.from_id("100123")

# Method chaining for efficient updates
dataset.set_title("Title", publish=False) \
       .set_description("Desc", publish=False) \
       .publish()

Async Bulk Operations

For better performance when working with many datasets:

import asyncio
from huwise_utils_py import bulk_get_metadata_async

metadata = asyncio.run(bulk_get_metadata_async(dataset_ids=["100123", "100456"]))

Logging

Airflow-friendly stdlib logging with context fields:

from huwise_utils_py import init_logger, get_logger

init_logger()
logger = get_logger(__name__)
logger.info("Processing dataset", dataset_id="100123")

Backwards Compatibility

All function names from the old package are preserved:

from huwise_utils_py import (
    get_dataset_title,
    get_dataset_description,
    set_dataset_title,
    set_dataset_description,
    # ... all other functions
)

Getting Help

If you encounter issues during migration:

  1. Check the API Reference for updated function signatures
  2. Review Examples for usage patterns
  3. Open an issue on GitHub