Skip to main content

Python SDK for Media Cloud AI workers

Based on mcai_worker_sdk, this SDK uses the PyO3 crate to export a compiled module compatible with CPython ABI.

Documentation

Please, check the docs here and here for the SDK with the media feature enabled.

Build

Before using the Python module you should build it as a CPython library. This will require a virtualenv (where the module will be installed) and maturin to compile the module.

virtualenv venv # Create your environment
source venv/bin/activate # Launch it

You can then either build the module in development mode (this will build and install the module in your virtualenv):

maturin develop --features extension-module # Build and install the module

Or build the wheel file and install it manually via pip:

maturin build --features extension-module # Build the wheel file to install the module
pip install path/to/generated/wheel/file

You will now be able to import the module in your Python's scripts by doing:

import mcai_worker_sdk as mcai

Check out maturin's docs for more information on building the module!

Supported version

We intempt to support as many distribution and architecture as we can, however if pip doesn't find any compatible version for your installation it will download the source and try to compile them directly.

This operation supposes that you have at least Rust 1.62.

We currently support the following version of Python implementations:

  • CPython 3.8 : manylinux
  • CPython 3.9 : manylinux, macosx x86_64
  • CPython 3.10 : manylinux, macosx x86_64, macosx arm64
  • CPython 3.11 : manylinux, macosx arm54
  • Pypy 3.8 : manylinux
  • Pypy 3.9 : manylinux

And the following core architectures:

  • x86_64

Test

To run tests you must have json-strong-typing installed:

pip install json-strong-typing

Then launch tests basically:

cargo test
cargo test --features media

Running examples

Build the Python module

In your virtual environment:

maturin develop

Simple worker

RUST_LOG=debug \
SOURCE_ORDERS="examples/message.json" \
PYTHON_WORKER_FILENAME="worker.py" \
SOURCE_PATH="README.md" \
DESTINATION_PATH="README.md.out" \
python worker.py

Media worker

First set the media filename:

export SOURCE_PATH="/folder/filename.ext"

Then run the SDK with these parameters:

RUST_LOG=debug \
SOURCE_ORDERS="examples/message.json" \
PYTHON_WORKER_FILENAME="media_worker.py" \
DESTINATION_PATH="results.json" \
cargo run --features media

Metadata

Release files for mcai-worker-sdk-media 2.1.1

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

Built distributions (wheels)

Table of built distributions (wheels) for mcai-worker-sdk-media 2.1.1
File Interpreter ABI Platform Actions
mcai_worker_sdk_media-2.1.1-cp311-cp311-manylinux_2_34_x86_64.whl CPython 3.11 CPython 3.11 Linux glibc 2.34+ x86-64 Details for mcai_worker_sdk_media-2.1.1-cp311-cp311-manylinux_2_34_x86_64.whl
mcai_worker_sdk_media-2.1.1-cp310-cp310-manylinux_2_34_x86_64.whl CPython 3.10 CPython 3.10 Linux glibc 2.34+ x86-64 Details for mcai_worker_sdk_media-2.1.1-cp310-cp310-manylinux_2_34_x86_64.whl

Total release size: 172.5 MB

Release files / mcai_worker_sdk_media-2.1.1-cp311-cp311-manylinux_2_34_x86_64.whl

Download URL mcai_worker_sdk_media-2.1.1-cp311-cp311-manylinux_2_34_x86_64.whl
Size 86.3 MB
Tags CPython 3.11 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
4e95b13aca8c96fcc168a4707cd84dc38db61b8bed465864df6c9eb01588e494
BLAKE2b-256 checksum
How to use checksums
d02ff3fbdbee7e2aec1d0d90dd3197d6b82b73c6fa74bdad49e9aa72f95295c3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Release files / mcai_worker_sdk_media-2.1.1-cp310-cp310-manylinux_2_34_x86_64.whl

Download URL mcai_worker_sdk_media-2.1.1-cp310-cp310-manylinux_2_34_x86_64.whl
Size 86.3 MB
Tags CPython 3.10 Linux glibc 2.34+ x86-64
SHA-256 checksum
How to use checksums
1de2954663b285e5d634a2f5b581b35a5299c074b42ae481e54b746ef66b3009
BLAKE2b-256 checksum
How to use checksums
94fad59a57d3a74b74c2f5c90f4a5edb247bb9249378911d08a44777e2fbc71d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.10.12

Security for mcai-worker-sdk-media 2.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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