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

Uploaded Source

Built Distributions

mcai_worker_sdk-2.0.0rc9-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.0rc9-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.0rc9-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.0rc9-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.0rc9-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.0rc9-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.0rc9.tar.gz.

File metadata

  • Download URL: mcai_worker_sdk-2.0.0rc9.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.0rc9.tar.gz
Algorithm Hash digest
SHA256 3c94f708d4b89ce7c919d470119fa5a62c82e3ee358d055d22858404fccc1234
MD5 da6fbb3d593a2acac274512503836a3c
BLAKE2b-256 7d60e94853260b297a46fde380ad788356734c0efb8bf9ac15b23a02fd09dd14

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcai_worker_sdk-2.0.0rc9-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a8a702807975ea29a5e37fbf0b5c04962e7c989e95298a67cf9cfe97edd31184
MD5 08b74fa80412d462baa998e2c6af3054
BLAKE2b-256 e1d2ef35513398742e945433c46c68be932c549536b535a31553578e9d83b58a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcai_worker_sdk-2.0.0rc9-pp38-pypy38_pp73-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d098ed82e146bee4e5ccd39fa20944550c166f0c783932e65131045721fa006d
MD5 3c29f7d79ff60375851e829f914ab157
BLAKE2b-256 aa2f11fae47073a127ad0a4db0f795fb2411c2e4a634c679c23ab5e5525763b3

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcai_worker_sdk-2.0.0rc9-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.0rc9-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 d048c47d747006605c22143412d2d0ffcc27ae3305691235026bf4f2aeb3e2a6
MD5 4afcc97a46b387255dd6a25d9d60844b
BLAKE2b-256 07ab41d51005e7dfcb64545a4e0b6919de1ca625958f7a0fce04c79239829f6d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcai_worker_sdk-2.0.0rc9-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.0rc9-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 7876c32dc9bc58f0ed7583b55590aa43526faed8e7ecc7070548b85ce9579dfb
MD5 09addc1cc3bcdae2e8c497f7252ed9e5
BLAKE2b-256 da35dff34453a12cf7811f83bce30c862793c77200d2ae1876e7e4e07eeb7e22

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcai_worker_sdk-2.0.0rc9-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.0rc9-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 611a8b897139fe7af00567f57072328318afe76ee82caa7e035734ddbb1c07fa
MD5 decad99d26ce19c203134710e29677c5
BLAKE2b-256 99c5229bed3a4b1fa686d821583afd31984437eaf0431673d2948867ff17b910

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcai_worker_sdk-2.0.0rc9-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.0rc9-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c4ed42b2cd4066cadb28b934f21aee586d557a6eb4ecceddf06b5796bd91b8ef
MD5 a8aa41a25a61a7978f48503b083f9a89
BLAKE2b-256 0dfbc783dd232902c06dc3906c4c9f4e4649529c1e9989052b5c7048d12616f6

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