Registry / azure / azure-ml-component

azure-ml-component

JSON →
library0.9.18.post2pypypiunverified

The `azure-ml-component` library is a low-level Python SDK providing core functionalities and base classes for defining and managing components within Azure Machine Learning. It is primarily an internal dependency of the higher-level `azure-ai-ml` SDK, which is the recommended package for most end-user interactions. This package is actively maintained with frequent updates, currently at version 0.9.18.post2, usually released in sync with the `azure-ai-ml` ecosystem.

pip install azure-ml-component
INSTALL
IMPORT
SIG · AZURE-ML-COMPONENT
A
azure-ml-component
azurepythonv0.9.18.post2
Install
17.8s avg
Import
9987ms
Disk
359MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.9.18.post2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.940 runs
installs and imports cleanly · install 0.0s · import 10.379s · 305.9MB
glibc
py 3.103.940 runs
installs and imports cleanly · install 17.8s · import 9.594s · 377MB
359MB installed
● package 359MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

CommandComponent
from azure.ml.component import CommandComponent
from azure.ml.component import CommandComponent

This quickstart demonstrates defining a basic command component using the `azure.ai.ml` SDK, which is the recommended way to interact with Azure Machine Learning components. Although `azure-ml-component` provides underlying classes, direct usage is uncommon. This example defines a component that takes a string input and writes a processed string to an output file. To actually register and run this component, an `MLClient` connected to an Azure ML Workspace would be required (commented out for quickstart runnability).

import os from azure.ai.ml import command, Input, Output from azure.ai.ml.entities import CommandComponent # Define a simple command component using the recommended azure.ai.ml SDK # This component takes an input string and produces an output string. # For this example, we'll define a simple Python script as the command source component_script_content = """ import argparse parser = argparse.ArgumentParser() parser.add_argument("--input_data", type=str) parser.add_argument("--output_data", type=str) args = parser.parse_args() print(f"Received input: {args.input_data}") with open(args.output_data, "w") as f: f.write(f"Processed: {args.input_data.upper()}") print(f"Wrote output to {args.output_data}") """ # Create a temporary directory and save the script import tempfile import shutil with tempfile.TemporaryDirectory() as temp_dir: script_path = os.path.join(temp_dir, "process.py") with open(script_path, "w") as f: f.write(component_script_content) # Define the command component hello_world_component = command( name="hello_world_component", display_name="Hello World Component Example", description="A simple component that processes input text.", inputs={ "input_data": Input(type="string", description="Input string for processing") }, outputs={ "output_data": Output(type="uri_file", description="Processed output string") }, command=f"python {{inputs.script_path}}/process.py --input_data {{inputs.input_data}} --output_data {{outputs.output_data}}", environment=dict( conda_file=os.path.join(temp_dir, "conda_env.yml"), image="mcr.microsoft.com/azureml/openmpi4.1.0-ubuntu20.04:latest" ), code=temp_dir ) print("\n--- Component Definition ---") print(hello_world_component.as_dict()) # To actually run this, you would need an MLClient connected to an Azure ML workspace. # from azure.ai.ml import MLClient # from azure.identity import DefaultAzureCredential # ml_client = MLClient( # DefaultAzureCredential(), # subscription_id=os.environ.get("AZURE_SUBSCRIPTION_ID", ""), # resource_group_name=os.environ.get("AZURE_RESOURCE_GROUP", ""), # workspace_name=os.environ.get("AZURE_WORKSPACE_NAME", "") # ) # registered_component = ml_client.components.create_or_update(hello_world_component) # print(f"Component registered with name: {registered_component.name}, version: {registered_component.version}")
Debug
Known issues
gotchaThe `azure-ml-component` library is a low-level dependency of the `azure-ai-ml` SDK and is generally not intended for direct end-user interaction for defining or managing components. For these tasks, the `azure.ai.ml` package (the main Azure Machine Learning Python SDK) is the recommended and stable entry point.
fix
Always use `azure.ai.ml` for creating, registering, and managing components. Refer to official Azure ML documentation for examples using `from azure.ai.ml import command` or `from azure.ai.ml.entities import CommandComponent`.
affects: All
breakingVersions of `azure-ml-component` are tightly coupled with `azure-ai-ml` versions. Direct upgrades of `azure-ml-component` without upgrading `azure-ai-ml` can lead to version conflicts, unexpected behavior, or API incompatibilities.
fix
Manage `azure-ai-ml` as your primary dependency. Let `pip` resolve `azure-ml-component` as a sub-dependency when installing or upgrading `azure-ai-ml`. Avoid manually pinning `azure-ml-component` unless explicitly instructed for specific advanced scenarios.
affects: All
Upgrade
Version history
0.9.18.post2latest on PyPI · released May 12, 2023
Audit
Dependencies
azure-corerequiredCore Azure SDK functionalities
azure-storage-blobrequiredBlob storage interactions for component assets
pyyamlrequiredYAML parsing for component definitions
Agent activity
26 hits · last 30 days
node
23
OpenAI (training)
1
Resources
azure-ml-component — pip install azure-ml-component · libregistry