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.0.0rc11.tar.gz (51.8 kB view details)

Uploaded Source

Built Distributions

mcai_worker_sdk-2.0.0rc11-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl (9.5 MB view details)

Uploaded PyPy manylinux: glibc 2.28+ x86-64

mcai_worker_sdk-2.0.0rc11-pp38-pypy38_pp73-manylinux_2_28_x86_64.whl (9.5 MB view details)

Uploaded PyPy manylinux: glibc 2.28+ x86-64

mcai_worker_sdk-2.0.0rc11-cp311-cp311-manylinux_2_28_x86_64.whl (9.5 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.28+ x86-64

mcai_worker_sdk-2.0.0rc11-cp310-cp310-manylinux_2_28_x86_64.whl (9.5 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.28+ x86-64

mcai_worker_sdk-2.0.0rc11-cp39-cp39-manylinux_2_28_x86_64.whl (9.5 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.28+ x86-64

mcai_worker_sdk-2.0.0rc11-cp38-cp38-manylinux_2_28_x86_64.whl (9.5 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.28+ x86-64

File details

Details for the file mcai_worker_sdk-2.0.0rc11.tar.gz.

File metadata

  • Download URL: mcai_worker_sdk-2.0.0rc11.tar.gz
  • Upload date:
  • Size: 51.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/39.2.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.6.8

File hashes

Hashes for mcai_worker_sdk-2.0.0rc11.tar.gz
Algorithm Hash digest
SHA256 9c9d9279b256f90974e324e429d7527a43a0deca8a01be88abfaade375c3912b
MD5 ac1079b5c58c507453fd61562d58887b
BLAKE2b-256 5a7075258d1dcdeec242a101ad01edaa808f80016af06191013f51611a33dac3

See more details on using hashes here.

File details

Details for the file mcai_worker_sdk-2.0.0rc11-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mcai_worker_sdk-2.0.0rc11-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 17732025eb26c18b611f293876fd4e551c7221df32d2926fdaf35c2fe4aca435
MD5 9ee2bf6a23889418b637a88fd13ab96f
BLAKE2b-256 a264a54f5ef0cc92d9a94162d82c4150022c91fde1ffb1a83fb61180addca2e1

See more details on using hashes here.

File details

Details for the file mcai_worker_sdk-2.0.0rc11-pp38-pypy38_pp73-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mcai_worker_sdk-2.0.0rc11-pp38-pypy38_pp73-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 6831d2e5df2b9542fe6d4f7c491ebdee3d3e5f196a63e28eb072cbcb3b29c8ba
MD5 8734411c84781ce16aeb0d02f941fee3
BLAKE2b-256 e6920476022c0045dc546997e5c2915f0815d6b049a0ae5ddb3185ecd6384789

See more details on using hashes here.

File details

Details for the file mcai_worker_sdk-2.0.0rc11-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

  • Download URL: mcai_worker_sdk-2.0.0rc11-cp311-cp311-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 9.5 MB
  • Tags: CPython 3.11, manylinux: glibc 2.28+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/39.2.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.6.8

File hashes

Hashes for mcai_worker_sdk-2.0.0rc11-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 f98588bd2df063e3ee58472bede58b5752cbe2e3976cf94274e3b30fc1dae0ad
MD5 cc4f4c7dc3981c8dee7a51d56b5dbe42
BLAKE2b-256 84e133e2c2117b7d5ce5b39657f568e7f471361f2227261e71799b96f3df064c

See more details on using hashes here.

File details

Details for the file mcai_worker_sdk-2.0.0rc11-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

  • Download URL: mcai_worker_sdk-2.0.0rc11-cp310-cp310-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 9.5 MB
  • Tags: CPython 3.10, manylinux: glibc 2.28+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/39.2.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.6.8

File hashes

Hashes for mcai_worker_sdk-2.0.0rc11-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b7d15c1d97b0d83c84bcdf0a911ca7b6fee3cff9f3e825e8b04832e23da4e556
MD5 c3ef39545651c07512a0f79676c97f76
BLAKE2b-256 3c75006bc7e1a45392801eb090d05db403e765b095528814c21dc036a43bf4c8

See more details on using hashes here.

File details

Details for the file mcai_worker_sdk-2.0.0rc11-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

  • Download URL: mcai_worker_sdk-2.0.0rc11-cp39-cp39-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 9.5 MB
  • Tags: CPython 3.9, manylinux: glibc 2.28+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/39.2.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.6.8

File hashes

Hashes for mcai_worker_sdk-2.0.0rc11-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ebe1e7b776786c595ac1ff269f5f6c68d94fa591c3cff61ea1ac7dbb1fb2f35d
MD5 d8716e146ebec7838b38ebf4f286c593
BLAKE2b-256 2a50bd74e31e8e866a2ea52f3917bc471245136d1b5d72cee47a5266bd0cf06f

See more details on using hashes here.

File details

Details for the file mcai_worker_sdk-2.0.0rc11-cp38-cp38-manylinux_2_28_x86_64.whl.

File metadata

  • Download URL: mcai_worker_sdk-2.0.0rc11-cp38-cp38-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 9.5 MB
  • Tags: CPython 3.8, manylinux: glibc 2.28+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.20.0 setuptools/39.2.0 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.6.8

File hashes

Hashes for mcai_worker_sdk-2.0.0rc11-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7b551a35c86b9094f9a26225be1db2f31fef0639387c9bfec615d5fc4a284fe8
MD5 6ac6a2a8ac1c4dbc91d27f9a5911ec2e
BLAKE2b-256 46166b278d49dba7f14fe25b77efee9096a1c804f73d185e797dd97ee203bec3

See more details on using hashes here.

Supported by

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