Automated deployment library for IBM WatsonX AI services with LangGraph support
Project description
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 dependenciesprefix(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 versionenvironment_name(str, optional): Name for the environmentbase_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 specificationspec_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 functionservice_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 deploymentexamples/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
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Run the test suite
- 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file watsonx_autodeploy-0.1.2.tar.gz.
File metadata
- Download URL: watsonx_autodeploy-0.1.2.tar.gz
- Upload date:
- Size: 8.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
007ea1b14cfddd6a3235a20dba6de9a6bdd3d2a2b1fc9a665f5c1709f9c7ee5b
|
|
| MD5 |
71e1199bd209a606383173774720d4c2
|
|
| BLAKE2b-256 |
60201642352cc75f2773c8d56cf063e4285eda0c94d2044e1455150c9a9f478e
|
File details
Details for the file watsonx_autodeploy-0.1.2-py3-none-any.whl.
File metadata
- Download URL: watsonx_autodeploy-0.1.2-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1b1af5c61f9405fc2748ec7125849c3997328170530c098442cea744a6746476
|
|
| MD5 |
603187a30c8ce66de4845dffd6af0795
|
|
| BLAKE2b-256 |
a9380b4f0fb3b32ab7b3b0fbfb0d390d2f4efd52461ecc0cef393e573da3158b
|