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_media-2.0.0.tar.gz (53.0 kB view details)

Uploaded Source

Built Distributions

mcai_worker_sdk_media-2.0.0-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl (38.9 MB view details)

Uploaded PyPy manylinux: glibc 2.28+ x86-64

mcai_worker_sdk_media-2.0.0-pp38-pypy38_pp73-manylinux_2_28_x86_64.whl (38.9 MB view details)

Uploaded PyPy manylinux: glibc 2.28+ x86-64

mcai_worker_sdk_media-2.0.0-cp311-cp311-manylinux_2_28_x86_64.whl (38.9 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.28+ x86-64

mcai_worker_sdk_media-2.0.0-cp311-cp311-macosx_11_0_arm64.whl (6.8 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

mcai_worker_sdk_media-2.0.0-cp310-cp310-manylinux_2_28_x86_64.whl (38.9 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.28+ x86-64

mcai_worker_sdk_media-2.0.0-cp310-cp310-macosx_11_0_arm64.whl (6.8 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

mcai_worker_sdk_media-2.0.0-cp39-cp39-manylinux_2_28_x86_64.whl (38.9 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.28+ x86-64

mcai_worker_sdk_media-2.0.0-cp39-cp39-macosx_11_0_arm64.whl (6.8 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

mcai_worker_sdk_media-2.0.0-cp38-cp38-manylinux_2_28_x86_64.whl (38.9 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.28+ x86-64

File details

Details for the file mcai_worker_sdk_media-2.0.0.tar.gz.

File metadata

  • Download URL: mcai_worker_sdk_media-2.0.0.tar.gz
  • Upload date:
  • Size: 53.0 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_media-2.0.0.tar.gz
Algorithm Hash digest
SHA256 e67e6f1ef99c5d85d12ace8be825e30b093e36fad119bb2909918968be01ba53
MD5 1ae32c1ec9a3fe9f67ab96e299ee95ae
BLAKE2b-256 3240eb58e1c34b27f3cbc525e1230fb5bff31c4120a03c6c5bc67fce145fe538

See more details on using hashes here.

File details

Details for the file mcai_worker_sdk_media-2.0.0-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mcai_worker_sdk_media-2.0.0-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ef7cc48f1d27662436a46d4561c4bc2676e9f5047a99486596f24997fceb7e7a
MD5 1ceda4e1d256df49bc0709fb995bea7d
BLAKE2b-256 c227419aa58048889dfcb7c6789fbb52dfc7d0e94030ca3560651a0317ca16c1

See more details on using hashes here.

File details

Details for the file mcai_worker_sdk_media-2.0.0-pp38-pypy38_pp73-manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for mcai_worker_sdk_media-2.0.0-pp38-pypy38_pp73-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 ba5271b43aaab6acf8c7ca4b6985c75dcd1c127d014fd76d7d58c4054d1ad218
MD5 0d050419e7d7c941d5da5911fdea75e5
BLAKE2b-256 285664cee27208171297da4fa3363243ad9da9be8e3bc6d7812ed55f315b8173

See more details on using hashes here.

File details

Details for the file mcai_worker_sdk_media-2.0.0-cp311-cp311-manylinux_2_28_x86_64.whl.

File metadata

  • Download URL: mcai_worker_sdk_media-2.0.0-cp311-cp311-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 38.9 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_media-2.0.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 203d003c8d9b092cf19ccfe5190bccbca70f6996a37587cad5e4c1b14c0a5132
MD5 5fb7ef427a1a4c241e96b647997ff6f4
BLAKE2b-256 dd0ddda7a6c8129eb7d1e93520e31cba5feeaae722aea18d9e07e3f4dc3a0a63

See more details on using hashes here.

File details

Details for the file mcai_worker_sdk_media-2.0.0-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mcai_worker_sdk_media-2.0.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 2b8bbee95561b3880f9c88da964bb4bee32d8863810b13b90c2ae9a87ef20e9b
MD5 53d75b72d5b2e96dd5aeaed215749920
BLAKE2b-256 3d57985e4990288e5cbbc1de744a0e99e27e5c519afaaba55df5ce5a9f9adce5

See more details on using hashes here.

File details

Details for the file mcai_worker_sdk_media-2.0.0-cp310-cp310-manylinux_2_28_x86_64.whl.

File metadata

  • Download URL: mcai_worker_sdk_media-2.0.0-cp310-cp310-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 38.9 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_media-2.0.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 306bad17aa099d1670f9f2c50ee4aa7db83fa45dfeaecf25aa1e85d05799c337
MD5 0c58535bfe28208baaa207d7d7f1deac
BLAKE2b-256 cd44f159635f2a987115b0eae7593f6295c6b798a515b5778d358d5149ef6a97

See more details on using hashes here.

File details

Details for the file mcai_worker_sdk_media-2.0.0-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mcai_worker_sdk_media-2.0.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 be8ffad7536c4f45a0c13a450c36eddb380f5698c65df82b9fe69f9df657bc2b
MD5 c2fa9ffd7ec2a7b9c83a4b3c6716781e
BLAKE2b-256 b13cd29c1d2a730c46280ac8e1a97f0c62d6318e7fb3536e7af61164ae22c288

See more details on using hashes here.

File details

Details for the file mcai_worker_sdk_media-2.0.0-cp39-cp39-manylinux_2_28_x86_64.whl.

File metadata

  • Download URL: mcai_worker_sdk_media-2.0.0-cp39-cp39-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 38.9 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_media-2.0.0-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4c8e6c3a90ceed48f05eb500202e05d32ba0234452f5dacefdd378d1e684d9b2
MD5 b71f63ff3fd304f27cd2067eaeeaca26
BLAKE2b-256 28df22955c3eb3313253a6577432536fd0a9b6291fb58e54ed833391552e3747

See more details on using hashes here.

File details

Details for the file mcai_worker_sdk_media-2.0.0-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mcai_worker_sdk_media-2.0.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 4727f8079e105b354eed32df4255faef2b760df1b53f8b8cce38b7069c8d1573
MD5 de160cf8a3160beac202e89e9984b47c
BLAKE2b-256 ff890ce16ad3d5f27351315a772e41e8e46077bb38dba9c00f9911fc42444063

See more details on using hashes here.

File details

Details for the file mcai_worker_sdk_media-2.0.0-cp38-cp38-manylinux_2_28_x86_64.whl.

File metadata

  • Download URL: mcai_worker_sdk_media-2.0.0-cp38-cp38-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 38.9 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_media-2.0.0-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9f4efa5937f3194577a446d9e5f5d74a2667f1c141761ff818834c0543bd72de
MD5 d3e226b141fd47a749b0274c9ae35d04
BLAKE2b-256 d7757368190676b67d54de751f25a3868e4362198deed7ab0be936e4cca9adb2

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