Skip to main content

WatsonX AutoDeploy

Automated deployment library for IBM WatsonX AI services with LangGraph support.

Overview

WatsonX AutoDeploy simplifies the process of deploying AI services to IBM WatsonX by providing a clean, pythonic interface for:

  • Creating custom environments with specified dependencies
  • Building software specifications
  • Storing and deploying AI services
  • Managing the entire deployment lifecycle

Installation

From PyPI (when published)

pip install watsonx-autodeploy

From Source

git clone https://github.com/nicknochnack/watsonx-autodeploy.git
cd watsonx-autodeploy
pip install -e .

Development Installation

git clone https://github.com/nicknochnack/watsonx-autodeploy.git
cd watsonx-autodeploy
pip install -e ".[dev]"

Quick Start

Environment Setup

First, set up your environment variables:

# .env file
WATSONX_URL=your_watsonx_url
WATSONX_APIKEY=your_api_key
WATSONX_SPACEID=your_space_id
MODEL_ID=your_model_id

Basic Usage

import os
from dotenv import load_dotenv
from autodeploy import Deployer

load_dotenv()

def my_ai_service(context, **kwargs):
    # Your AI service implementation
    def generate(context):
        return {"body": {"message": "Hello from WatsonX!"}}
    
    def generate_stream(context):
        pass
        
    return generate, generate_stream

# Deploy with one line
deployer = Deployer()
deployer.autodeploy(my_ai_service)

Advanced Usage

from autodeploy import Deployer

deployer = Deployer()

# Step-by-step deployment with custom parameters
deployer.export_config(
    python_version="3.11",
    channels="conda-forge",
    dependencies=["custom-package==1.0.0"],
    prefix="/opt/anaconda3/envs/custom"
)

deployer.build_environment(
    environment_name="my-custom-env",
    base_runtime="runtime-24.1-py3.11"
)

deployer.build_software_spec(
    spec_name="my-spec",
    spec_description="Custom specification"
)

deployer.store_service(
    deployable_ai_service=my_ai_service,
    service_name="my-service"
)

deployer.deploy_service(deployment_name="production-deployment")

API Reference

Deployer Class

The main class for managing WatsonX deployments.

__init__()

Initializes the deployer with WatsonX credentials from environment variables.

autodeploy(deployable_function)

One-step deployment method that handles the entire deployment pipeline.

Parameters:

  • deployable_function: The AI service function to deploy

export_config(python_version=None, channels=None, dependencies=None, prefix=None)

Creates a conda environment configuration file.

Parameters:

  • python_version (str, optional): Python version (default: "3.11")
  • channels (str, optional): Conda channels (default: "empty")
  • dependencies (list, optional): List of pip dependencies
  • prefix (str, optional): Environment prefix path

build_environment(python_version=None, environment_name=None, base_runtime=None)

Creates a package extension for the environment.

Parameters:

  • python_version (str, optional): Python version
  • environment_name (str, optional): Name for the environment
  • base_runtime (str, optional): Base runtime specification

build_software_spec(spec_name=None, spec_description=None)

Creates a software specification.

Parameters:

  • spec_name (str, optional): Name for the software specification
  • spec_description (str, optional): Description of the specification

store_service(deployable_ai_service, service_name=None)

Stores the AI service in WatsonX repository.

Parameters:

  • deployable_ai_service: The AI service function
  • service_name (str, optional): Name for the service

deploy_service(deployment_name=None)

Deploys the stored AI service.

Parameters:

  • deployment_name (str, optional): Name for the deployment

Examples

See the examples/ directory for complete usage examples:

  • examples/basic_usage.py - Simple one-line deployment
  • examples/advanced_usage.py - Step-by-step deployment with custom parameters

Requirements

  • Python 3.11+
  • IBM WatsonX AI account and credentials
  • Required dependencies (automatically installed):
    • ibm-watsonx-ai>=1.3.34
    • langchain>=0.3.27
    • langchain-ibm>=0.3.15
    • langgraph>=0.6.5
    • python-dotenv>=1.1.1

Development

Running Tests

pytest

Code Formatting

black src/ examples/

Type Checking

mypy src/

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests if applicable
  5. Run the test suite
  6. Submit a pull request

License

MIT License. See LICENSE file for details.

Support

For issues and questions:

  • Open an issue on GitHub

Changelog

v0.1.0

  • Initial release
  • Basic deployment functionality
  • Support for custom environments and dependencies
  • One-step autodeploy feature

Metadata

Release files for watsonx-autodeploy 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for watsonx-autodeploy 0.1.2
File Size Uploaded
watsonx_autodeploy-0.1.2.tar.gz 8.5 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for watsonx-autodeploy 0.1.2
File Interpreter ABI Platform
watsonx_autodeploy-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 14.5 kB

Release files / watsonx_autodeploy-0.1.2.tar.gz

Download URL watsonx_autodeploy-0.1.2.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
007ea1b14cfddd6a3235a20dba6de9a6bdd3d2a2b1fc9a665f5c1709f9c7ee5b
BLAKE2b-256 checksum
How to use checksums
60201642352cc75f2773c8d56cf063e4285eda0c94d2044e1455150c9a9f478e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release files / watsonx_autodeploy-0.1.2-py3-none-any.whl

Download URL watsonx_autodeploy-0.1.2-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1b1af5c61f9405fc2748ec7125849c3997328170530c098442cea744a6746476
BLAKE2b-256 checksum
How to use checksums
a9380b4f0fb3b32ab7b3b0fbfb0d390d2f4efd52461ecc0cef393e573da3158b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page