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

Uploaded Source

Built Distributions

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

File metadata

  • Download URL: mcai_worker_sdk-2.0.0rc14.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.0rc14.tar.gz
Algorithm Hash digest
SHA256 e1b99c91adbbc930a50c47665f1fc5deddd74d9a5e6277a6d213337653b4007b
MD5 7dce14d2d5aea79c5a86f0b0016484b9
BLAKE2b-256 21d6b158e242c454b4594ce0e1a9512074debe1ab011fda63c80752fd386c42c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcai_worker_sdk-2.0.0rc14-pp39-pypy39_pp73-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cfc76a100a48b65c0d58c707adfe3580533424bdf67719a47541899fcff61390
MD5 ad2fc6e1b59a76422cc001fad1cea804
BLAKE2b-256 f79a08e86df79131d590ed987a1a0621d250fa55f29617252acf235c48dbf7f5

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for mcai_worker_sdk-2.0.0rc14-pp38-pypy38_pp73-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 3ee24481b250dc4326713bb62b29b2441701b262238fb5c1758e9fabf4e286a9
MD5 2e8d9c440161454fb4479e14a9e2a82f
BLAKE2b-256 7d3ecd727c4ea2b280b7953aca5ba7d1ac009e03886ac3ef358c5d9d228e0a41

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcai_worker_sdk-2.0.0rc14-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.0rc14-cp311-cp311-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 460f22b0f990276c319748b630f0ffa42c4426de3d005312197c08672cccac14
MD5 7e4159e148ca5ad079a124b86ac06fc8
BLAKE2b-256 70dae61b71b7bb77a04ca5be8b2885ac61edc9f6152cf5a3c9ec0d9ab5305001

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcai_worker_sdk-2.0.0rc14-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.0rc14-cp310-cp310-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 cf9a047cf9f7a8e79ce5070db20f71743d04d97db64a287386720c9a01f48884
MD5 1c760eb3b258e068dc2db48280e6606b
BLAKE2b-256 34321b2ae97585579ad9f0a2b7e7d44576694db91118ea85f8a8597ff9464e7b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcai_worker_sdk-2.0.0rc14-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.0rc14-cp39-cp39-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2a0e8e82ee9392f41dad6c3cdb18eaac68c41013f51c1c4695c6fba86db63bc2
MD5 70e95393dfe7c2e575e0d2182f23719c
BLAKE2b-256 b8984987a9505462cac057e15a1e8f6a2262157afdbde79dc21701e561786335

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mcai_worker_sdk-2.0.0rc14-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.0rc14-cp38-cp38-manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 e90339ebb039544c2d6c697859863f34363a3ab6dcf9ad775c62650127cb2da4
MD5 46aa32256cfbaf7364631fa1a7e4ee10
BLAKE2b-256 36844202bab1f2cc2dbeb644e89e2f405d1f0f99f32900b965e33613526ede0b

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