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

Uploaded Source

Built Distributions

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

File metadata

  • Download URL: mcai_worker_sdk-2.0.0rc12.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.0rc12.tar.gz
Algorithm Hash digest
SHA256 6159b6acee2c07afa66e6a0a4f71503e78bf325cc4ea6a01ca89f2870505001e
MD5 60b8fc147f0b12f39e8321e994ddf5d8
BLAKE2b-256 5c49753167071f88a9c81e4c1ee7f09d32ec3909effdb55086e92f6531f00e09

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcai_worker_sdk-2.0.0rc12-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 b36e5011dc1c13cc24c065181557c9ad2704a490fcf3cd97477c53342de5d65e
MD5 a25c3a3e20b3421bbbf8ad82ebc45579
BLAKE2b-256 c9115f34a96b60f659dad8ff4e2d08dde57ae16f3121e4cd06dee2caa71072c0

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcai_worker_sdk-2.0.0rc12-pp38-pypy38_pp73-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 811275f0e9ad1b9181f5024ce7ed9327a52910ecc80821d5bd59454c355e8d2e
MD5 bae51ac4a0049c5627f0581e8886a0af
BLAKE2b-256 69baf5db76fbc81b9227cd5dfbf607f443a02ddc5c2c4149bdd1e7339d1cc0ff

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcai_worker_sdk-2.0.0rc12-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.0rc12-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 27c37a85b2f6e11d35a595b165ef937df60689e9ef58ee41153f00d4acf7a264
MD5 4e05fd09706276ac27007c1da05a089f
BLAKE2b-256 64ca1377c7fac4a5f52269ed75d8acb127e098724a6278de4ed5a67f2b287739

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcai_worker_sdk-2.0.0rc12-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.0rc12-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 0e2076632b06456ada82b247b0c3f7131095ef7be5659a31838a193682b27a44
MD5 b908550610afa861d71454b8574da892
BLAKE2b-256 a762dfc16a152e792c9880973dd27a6f8867bfeb229e0597486f6ae44c7551ec

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcai_worker_sdk-2.0.0rc12-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.0rc12-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 00553915aa2066f9aa0eeab2d491da74a2162e517e11ff94dd6421030eefbf21
MD5 ca2b74ebf0d512a45a72a9a5bdccecc9
BLAKE2b-256 f0cafbc7315f62ef644021a5b4486af6a526dfbe2489c53bc8e12824e8fea4e0

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcai_worker_sdk-2.0.0rc12-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.0rc12-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 146e283f45c24b6c16f42ec29e1d91e3942a9142ad4e56c9cbdce5a88913974c
MD5 aaa6032ffc832079a58d6ec0a781c272
BLAKE2b-256 5116ddd4211c53ec194818b6855640d0e87e01d3699b0a778581aa924fe371e9

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