Skip to main content

Python bindings for the Windows AI Machine Learning EP Catalog API

Project description

windowsml

Python bindings for the Windows AI Machine Learning API.

This package provides a ctypes-based wrapper around the WinML flat C API, enabling Python applications to discover and manage execution providers and model catalogs for ONNX Runtime on Windows.

Installation

pip install windowsml

ONNX Runtime dependency

To automatically install a matching version of ONNX Runtime, use the with-ort extra:

pip install windowsml[with-ort]

If you choose not to use [with-ort], you must install a compatible version of onnxruntime separately and ensure it matches the version expected by this package.

Quick Start

EP Catalog — discover execution providers

from windowsml import EpCatalog

with EpCatalog() as catalog:
    for ep in catalog.find_all_providers():
        print(f"{ep.name} v{ep.version} - {ep.ready_state.name}")

        # Ensure the provider is ready (downloads/installs if needed)
        ep.ensure_ready()

Model Catalog — discover and download models

from windowsml import ModelCatalogSource, ModelCatalog

with ModelCatalogSource.create_from_uri("https://example.com/catalog.json") as source:
    with ModelCatalog([source]) as catalog:
        for model in catalog.find_all_models():
            print(f"{model.name} v{model.version} by {model.publisher}")
            print(f"  Size: {model.model_size_in_bytes} bytes")
            print(f"  EPs:  {model.execution_providers}")

API Reference

Enums

  • EpReadyStateReady, NotReady, NotPresent
  • EpCertificationUnknown, Certified, Uncertified
  • CatalogModelStatusReady, NotReady
  • CatalogModelInstanceStatusAvailable, InProgress, Unavailable

Classes

EpCatalog()

Context manager for the EP catalog.

Method Description
find_all_providers() Returns list[ExecutionProvider]
close() Release the catalog

ExecutionProvider

Handle to a discovered EP (owned by the catalog).

Property / Method Type
name str
version str
package_family_name str
library_path str
package_root_path str
ready_state EpReadyState
certification EpCertification
ensure_ready() Blocks until ready
ensure_ready_async(on_complete, on_progress) Returns AsyncOperation

ModelCatalogSource

Represents a catalog source endpoint. Create via static factory methods.

Method / Property Description
create_from_uri(uri) Create from a URI or local path (blocking)
create_from_uri_async(uri, ...) Create from a URI (async)
create_from_uri_with_headers(uri, headers) Create with custom HTTP headers (blocking)
create_from_uri_with_headers_async(uri, headers, ...) Create with custom HTTP headers (async)
id str — source identifier
uri str — source URI
close() Release the source

ModelCatalog(sources)

Context manager for the model catalog. Created from a list of ModelCatalogSource.

Method / Property Description
execution_providers list[str] — configured EPs
set_execution_providers(providers) Set EP filter for queries
get_available_model(id_or_name) Returns CatalogModelInfo
get_available_models() Returns list[CatalogModelInfo]
find_model(id_or_name) Find a model (blocking)
find_model_async(id_or_name, ...) Find a model (async)
find_all_models() Find all models (blocking)
find_all_models_async(...) Find all models (async)
close() Release the catalog

CatalogModelInfo

Metadata about a model in the catalog.

Property / Method Type
id str
name str
publisher str
source_id str
version str
license str
license_uri str
license_text str
uri str
model_size_in_bytes int
execution_providers list[str]
status CatalogModelStatus
get_instance_async(...) Returns AsyncOperationCatalogModelInstance
get_instance_with_headers_async(headers, ...) Returns AsyncOperationCatalogModelInstance
close() Release the model info

CatalogModelInstance

A downloaded or local instance of a catalog model.

Property / Method Type
model_paths list[str] — local file paths
model_info CatalogModelInfo
close() Release the instance

AsyncOperation

Returned by async methods. Supports context-manager usage.

Method Description
wait() Block until complete
get_status(wait=False) Poll or wait for status
get_result() Extract the typed result (if applicable)
cancel() Request cancellation
close() Release async resources

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

windowsml-2.1.71-py3-none-win_arm64.whl (426.5 kB view details)

Uploaded Python 3Windows ARM64

windowsml-2.1.71-py3-none-win_amd64.whl (423.4 kB view details)

Uploaded Python 3Windows x86-64

File details

Details for the file windowsml-2.1.71-py3-none-win_arm64.whl.

File metadata

  • Download URL: windowsml-2.1.71-py3-none-win_arm64.whl
  • Upload date:
  • Size: 426.5 kB
  • Tags: Python 3, Windows ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: RestSharp/106.13.0.0

File hashes

Hashes for windowsml-2.1.71-py3-none-win_arm64.whl
Algorithm Hash digest
SHA256 5755e1c228b3c665aee7ec9178deeb2d1a2821a54cd0f28ee49c6dff50ac5b33
MD5 2b9cf599c35618eac10fe7e3cf694e20
BLAKE2b-256 626d098c3a07231f22eb7991abf58c411586d6d560382e1c8de02ad48b4bce48

See more details on using hashes here.

File details

Details for the file windowsml-2.1.71-py3-none-win_amd64.whl.

File metadata

  • Download URL: windowsml-2.1.71-py3-none-win_amd64.whl
  • Upload date:
  • Size: 423.4 kB
  • Tags: Python 3, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: RestSharp/106.13.0.0

File hashes

Hashes for windowsml-2.1.71-py3-none-win_amd64.whl
Algorithm Hash digest
SHA256 2859e6ae41706526553395444f8d5d249a546e52b83621d58e8607c158ddecc0
MD5 3d9487415d2898729e25fcadc48f9c15
BLAKE2b-256 36374336a475a7c39b1b77aaeba175d6a262907da4f7c682147397e291848c09

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page