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

Uploaded Source

Built Distributions

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

Uploaded PyPy manylinux: glibc 2.28+ x86-64

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

Uploaded PyPy manylinux: glibc 2.28+ x86-64

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

Uploaded CPython 3.11 manylinux: glibc 2.28+ x86-64

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

Uploaded CPython 3.11 macOS 11.0+ ARM64

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

Uploaded CPython 3.10 manylinux: glibc 2.28+ x86-64

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

Uploaded CPython 3.10 macOS 11.0+ ARM64

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

Uploaded CPython 3.9 manylinux: glibc 2.28+ x86-64

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

Uploaded CPython 3.9 macOS 11.0+ ARM64

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

Uploaded CPython 3.8 manylinux: glibc 2.28+ x86-64

File details

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

File metadata

  • Download URL: mcai_worker_sdk-2.0.0.tar.gz
  • Upload date:
  • Size: 52.9 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.0.tar.gz
Algorithm Hash digest
SHA256 03a4321b17b08cc0aa419c63ebcca5e6a1a26ec542388529c4d1c4f7e4c75159
MD5 b66cfceeca756f8659138cc75294f18f
BLAKE2b-256 266a236126ce580c984b5e41c2c5fdf17d57166cd480ddacdd33386bcad48825

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcai_worker_sdk-2.0.0-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 4527491f689cac1db619cfca4192e0851548b06aa377c024ba49a5a647cfbfd0
MD5 d6f4c6d2a90f040d0facf37b06c497c9
BLAKE2b-256 f6e876b944d049a64aeef265ee61a31dcac7a32db1b76e0588a6ea94c68c792a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcai_worker_sdk-2.0.0-pp38-pypy38_pp73-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2dea52e1b03e7c70f30eaf47e5d48629d7d3a87b8a6fb804bfae86021fb92dbf
MD5 512d94a4fb4c4a0235be51ddc11e84f9
BLAKE2b-256 7c42a5e42db34aece70acd978b392264acc943fa6861c6d52366b37e7dd0864c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcai_worker_sdk-2.0.0-cp311-cp311-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 9.7 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.0-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 18473f5f5b0b4b2ee942c0bf26c8f4bf77ccf41621e74e1da2326c3431566c93
MD5 9c2640023eae554d10641530050501df
BLAKE2b-256 3292019157f1ce9a1f359c2974953606d52d9bf873515d8d86a3eb17daf0d682

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcai_worker_sdk-2.0.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 dc9c526bb977cd0dca823bab53a17d92acfa824a3a3df762c46adee882d4ba7e
MD5 38d06a51469dd10fd44ad1fc35010b06
BLAKE2b-256 0d7eab488eeb4a88a84e65d09c37d7ac966aa504d5f19607a87c839da9fd16c8

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcai_worker_sdk-2.0.0-cp310-cp310-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 9.7 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.0-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 14966b0b3edb8941823816ee428d368cc066d30bed231298924279d0965b7f65
MD5 2806adeb648de9e9e805f7f4280efac5
BLAKE2b-256 660de6a56db3a15ee75b5e4811a09b3849c19952c0dcaf999b1c13fb22660ae1

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcai_worker_sdk-2.0.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 9829f9f64fd5cb5f7b80fafe131253f1ea566bc7216f6cd22bcc503a50ca88c4
MD5 16e289e9db7b5be58ba85fbe5001199f
BLAKE2b-256 fd016e01393545b8d5aa5450dd42a809a270d5d8ffc4549e8703c62aa46232fa

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcai_worker_sdk-2.0.0-cp39-cp39-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 9.7 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.0-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 a79384d0e5bf06f5f93ebcd64a6c56ee78b00b8c361d15edecc3b43f05d8004e
MD5 18b54a79a997eaeaaaff5764cb242de5
BLAKE2b-256 0d28d2594dc57667c755b2a08302f4b51d181323ed8a71c94a9c9f3e4ccdb9fb

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcai_worker_sdk-2.0.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 49023be9a4054440a09cd581e67122d79e70b3d7bb4c187d6f0cc2e279a6f29b
MD5 53960ae8b66a3bbf9168fa9940fb6e42
BLAKE2b-256 7c9a049ca5fd52ed571e4ba2344802b6a67239438d8d909d135e200da616fb3d

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcai_worker_sdk-2.0.0-cp38-cp38-manylinux_2_28_x86_64.whl
  • Upload date:
  • Size: 9.7 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.0-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 79a93e38bef2ba9403d57666e603125e873c54d6b732778f8917942fdcbf6c69
MD5 30c22443e58b3004738107ff6260053a
BLAKE2b-256 951f6bfeeb801b051c854e204fd8ff001bd122c01fb64212e153e36a3b521a34

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