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
  • CPython 3.9
  • CPython 3.10
  • CPython 3.11
  • Pypy 3.8
  • Pypy 3.9

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

Uploaded Source

Built Distributions

mcai_worker_sdk-2.0.0rc8-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl (9.2 MB view details)

Uploaded PyPy manylinux: glibc 2.28+ x86-64

mcai_worker_sdk-2.0.0rc8-pp38-pypy38_pp73-manylinux_2_28_x86_64.whl (9.2 MB view details)

Uploaded PyPy manylinux: glibc 2.28+ x86-64

mcai_worker_sdk-2.0.0rc8-cp311-cp311-manylinux_2_28_x86_64.whl (9.2 MB view details)

Uploaded CPython 3.11 manylinux: glibc 2.28+ x86-64

mcai_worker_sdk-2.0.0rc8-cp311-cp311-macosx_11_0_arm64.whl (5.8 MB view details)

Uploaded CPython 3.11 macOS 11.0+ ARM64

mcai_worker_sdk-2.0.0rc8-cp310-cp310-manylinux_2_28_x86_64.whl (9.2 MB view details)

Uploaded CPython 3.10 manylinux: glibc 2.28+ x86-64

mcai_worker_sdk-2.0.0rc8-cp310-cp310-macosx_11_0_arm64.whl (5.8 MB view details)

Uploaded CPython 3.10 macOS 11.0+ ARM64

mcai_worker_sdk-2.0.0rc8-cp310-cp310-macosx_10_7_x86_64.whl (6.1 MB view details)

Uploaded CPython 3.10 macOS 10.7+ x86-64

mcai_worker_sdk-2.0.0rc8-cp39-cp39-manylinux_2_28_x86_64.whl (9.2 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.28+ x86-64

mcai_worker_sdk-2.0.0rc8-cp39-cp39-macosx_11_0_arm64.whl (5.8 MB view details)

Uploaded CPython 3.9 macOS 11.0+ ARM64

mcai_worker_sdk-2.0.0rc8-cp39-cp39-macosx_10_7_x86_64.whl (6.1 MB view details)

Uploaded CPython 3.9 macOS 10.7+ x86-64

mcai_worker_sdk-2.0.0rc8-cp38-cp38-manylinux_2_28_x86_64.whl (9.2 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.28+ x86-64

File details

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

File metadata

  • Download URL: mcai_worker_sdk-2.0.0rc8.tar.gz
  • Upload date:
  • Size: 51.2 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.0rc8.tar.gz
Algorithm Hash digest
SHA256 08084b78a6dc46963107dd87559db918aca43314c7fc3e14cc939f29ca5fec9e
MD5 54a56adbe4e91281311c80d8996134eb
BLAKE2b-256 4034d1fa382d18a93b94f7d69b726ba13e79396f29cd0665f622278c6999ac81

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcai_worker_sdk-2.0.0rc8-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9b0e7d0ccdfe35720c83ecaea0fb38f637eb71696e2d5691a67470726024e3c5
MD5 be0b02cd906fd779e8299ef4c41bfad2
BLAKE2b-256 0454a3da54d990dd31ec505e7c114b98c51c6d2a88c5a9b954e9ba3be3d965f6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcai_worker_sdk-2.0.0rc8-pp38-pypy38_pp73-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 9d728165bf593521c141c5dab3716c0fb6d7a92e5da964524f4f2756477fb9cf
MD5 2185fe8810bbec14c7c3ec42443dee6c
BLAKE2b-256 1540ab3273080713c78d92f5a9b49d7886a0edc6ab77a78b19c2fc9211e5cd35

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcai_worker_sdk-2.0.0rc8-cp311-cp311-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 9.2 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.0rc8-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 c66404564032e0bf405cddf7403cb4b2a5c33e0c0e47ae20ca33c245aea4e932
MD5 c7b3ee8847a15943e4136265b89b766c
BLAKE2b-256 23e532e9d1846b27c39bf8389c75054abe291583dcba701e672fb81e8789369a

See more details on using hashes here.

File details

Details for the file mcai_worker_sdk-2.0.0rc8-cp311-cp311-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mcai_worker_sdk-2.0.0rc8-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 12369320beb299076b457e115322acba8298c95c3855b72ff2f630f0bb7a68e8
MD5 4827a4a3196a4e5c7cf5c16de2e305a6
BLAKE2b-256 e851fc8aa1aa21f5f261562eda327fd82ee75ffac6b8ed645adb56efb66b0b82

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcai_worker_sdk-2.0.0rc8-cp310-cp310-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 9.2 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.0rc8-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 1a37cb381237870e3361cc6569d8048ce5fe0e54dfc7c907c889472960ab03f0
MD5 3d18dcd8fc499aef481758d7d00ad163
BLAKE2b-256 65a7e339330431ef25d9481dfbad6eff65e369e4877add0270e926e624ffb05c

See more details on using hashes here.

File details

Details for the file mcai_worker_sdk-2.0.0rc8-cp310-cp310-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mcai_worker_sdk-2.0.0rc8-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 ae86ffd37aff02eeee0ffe3a57c1e26b40b89e142c64a0e5d2ef961a2870548b
MD5 3d51fa411b3ec95cd7374d2964a7acb8
BLAKE2b-256 17f59a12b1bc1d655b3e7fd157d7e83ab5a8fdce8d4d4eed5e7a6dab0e7e4b34

See more details on using hashes here.

File details

Details for the file mcai_worker_sdk-2.0.0rc8-cp310-cp310-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for mcai_worker_sdk-2.0.0rc8-cp310-cp310-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 fe7e9d5271180a06799cf13c1e67739f9b3d1d2b2eda9dee44ad5a1f0cf62009
MD5 a1907ebe8643ac818f13118732a8dd13
BLAKE2b-256 e3bff0a709060de974f02e910c342623e8b92a1d33e7d69fc2b0e93fce8c035b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcai_worker_sdk-2.0.0rc8-cp39-cp39-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 9.2 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.0rc8-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4123d7caeca63760beea7e8ee989f8c867d44f01365c7730527ea6c403a5b84e
MD5 e0d2d5046e6cee8930e74ccc197b3d02
BLAKE2b-256 3854c591dd2f79b8fde5935660c91f43721f79f9938be70896192468a6364c5f

See more details on using hashes here.

File details

Details for the file mcai_worker_sdk-2.0.0rc8-cp39-cp39-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for mcai_worker_sdk-2.0.0rc8-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 48ad3cbf3edfc9bf37fa23b849f5c1c31bc2460c0bf16919b28f07ce9369e42d
MD5 284c51f86d0e3cf5ffeb8a2513dbc06b
BLAKE2b-256 7c954fd7ed5033beb7b407d78ee21390edb555185dec84c70d7070a051c04381

See more details on using hashes here.

File details

Details for the file mcai_worker_sdk-2.0.0rc8-cp39-cp39-macosx_10_7_x86_64.whl.

File metadata

File hashes

Hashes for mcai_worker_sdk-2.0.0rc8-cp39-cp39-macosx_10_7_x86_64.whl
Algorithm Hash digest
SHA256 4d89a9be1e25dc0c8094a2639a78b80a894ac6df184f28fd752ee9ae55a650e3
MD5 21299e78f77ac9b8afb9f2c739b7e9e9
BLAKE2b-256 210867f6e3fd567d3ba4277980d1f964a8ecc3ac698b7114a01765e3b34c8a87

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcai_worker_sdk-2.0.0rc8-cp38-cp38-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 9.2 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.0rc8-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 8bf417171821b3695bb9b66cf79c357c00c6008f6b99d2327bbd767cb7754a22
MD5 705c08c23622f0168a1684acb816f49b
BLAKE2b-256 a4f4545e41059cfd61dcf4bc4323e8d1e048d7b9bbae641208febf74f7f765a7

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