Skip to main content

MCAI SDK to develop Python worker

Project description

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

Project details


Download files

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

Source Distribution

mcai_worker_sdk-2.1.1.tar.gz (54.6 kB view details)

Uploaded Source

Built Distributions

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

mcai_worker_sdk-2.1.1-pp310-pypy310_pp73-manylinux_2_28_x86_64.whl (9.0 MB view details)

Uploaded PyPymanylinux: glibc 2.28+ x86-64

mcai_worker_sdk-2.1.1-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl (9.0 MB view details)

Uploaded PyPymanylinux: glibc 2.28+ x86-64

mcai_worker_sdk-2.1.1-cp312-cp312-manylinux_2_28_x86_64.whl (9.0 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.28+ x86-64

mcai_worker_sdk-2.1.1-cp311-cp311-manylinux_2_28_x86_64.whl (9.0 MB view details)

Uploaded CPython 3.11manylinux: glibc 2.28+ x86-64

mcai_worker_sdk-2.1.1-cp310-cp310-manylinux_2_28_x86_64.whl (9.0 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.28+ x86-64

mcai_worker_sdk-2.1.1-cp39-cp39-manylinux_2_28_x86_64.whl (9.0 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.28+ x86-64

mcai_worker_sdk-2.1.1-cp38-cp38-manylinux_2_28_x86_64.whl (9.0 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.28+ x86-64

File details

Details for the file mcai_worker_sdk-2.1.1.tar.gz.

File metadata

  • Download URL: mcai_worker_sdk-2.1.1.tar.gz
  • Upload date:
  • Size: 54.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.15

File hashes

Hashes for mcai_worker_sdk-2.1.1.tar.gz
Algorithm Hash digest
SHA256 5892f825e9e96c1c5834b6aad992b99d28228d7b210b707e097ed81676db7707
MD5 3adcae963eeb27cc2b55c5d90d65d138
BLAKE2b-256 30b4627fc77d076420ca0dce973c0682b4f323e7e4a313476bf6624170854ee1

See more details on using hashes here.

File details

Details for the file mcai_worker_sdk-2.1.1-pp310-pypy310_pp73-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mcai_worker_sdk-2.1.1-pp310-pypy310_pp73-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 468c4d87100a58f01fee0bd373a4890dd9870ed7c4ce5fb2390935165db52ff1
MD5 f2f2dfcb590122feb16165bef2f1f024
BLAKE2b-256 9716b81d4b56189fcba34903b40a65d4c2faf8a17e917466903b29502ff43f67

See more details on using hashes here.

File details

Details for the file mcai_worker_sdk-2.1.1-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mcai_worker_sdk-2.1.1-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 fa9c480fe9361be4f95caf882b3e6cb65e3e0975d33960d59fb072188f6ed4fb
MD5 5a538afcc96bbba40086980764d038fb
BLAKE2b-256 ce495a059a14fd882c41c3a74592b3c1af36bba2cee923c31923bc254b32bd88

See more details on using hashes here.

File details

Details for the file mcai_worker_sdk-2.1.1-cp312-cp312-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mcai_worker_sdk-2.1.1-cp312-cp312-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e7d178acf6f38307e85135e9044e08a1d42f70617a17b0cc18d79c6a28660f6d
MD5 74009277cdcfcb2baf0709ee45d5fe4d
BLAKE2b-256 b4296cda4e6a9159d2c7b5acc7d3608b4faffdfeb7cfb5e14771b5c589c8e78c

See more details on using hashes here.

File details

Details for the file mcai_worker_sdk-2.1.1-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mcai_worker_sdk-2.1.1-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cb0fa8cd24118f9533ed2bfc335802051228802556ba34dd63f51cc0a4ddc044
MD5 26cbb1020bbea076d69b3162715489b0
BLAKE2b-256 fc64ef6ffd07afad2f8887b4aa8f2a310b9642f9498237c2904be978eed32472

See more details on using hashes here.

File details

Details for the file mcai_worker_sdk-2.1.1-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mcai_worker_sdk-2.1.1-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 06f1837012d22bf3ddb465c9b97b5633c6ad2af0f3687cc5cc23840000d0ac10
MD5 7078332b56d2c8893b0f329b01f5c1bc
BLAKE2b-256 e44f15c0763f77f0f7dbeaf9898591168244596e49f16229942ace3a8b389a14

See more details on using hashes here.

File details

Details for the file mcai_worker_sdk-2.1.1-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mcai_worker_sdk-2.1.1-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2cd50c8072e5f57764dc93a602cc27266e071a92e042024961f1adf0563d4690
MD5 8d64201fc4ba6b84a97988b7b7c2ee33
BLAKE2b-256 4147db87b9bddb9236208357421b2e22b43e3db2e7ac9590d0bdbbfb3ad3afbb

See more details on using hashes here.

File details

Details for the file mcai_worker_sdk-2.1.1-cp38-cp38-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mcai_worker_sdk-2.1.1-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 843cb612efd9387382273040e1100891684e6826aa715540b5a0fedc1ea5baab
MD5 1b4b9186c099940d03b95262f455de63
BLAKE2b-256 fa24a82b284cffd5608b81311d4d1182e959bd5d5b09de49c42ac478335fc46d

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