mcai-worker-sdk-media


Namemcai-worker-sdk-media JSON
Version 2.1.1 PyPI version JSON
download
home_pagehttps://gitlab.com/media-cloud-ai/sdks/py_mcai_worker_sdk
SummaryMCAI SDK to develop Python worker
upload_time2024-12-03 12:07:41
maintainerNone
docs_urlNone
authorValentin NOEL <valentin.noel@media-io.com>, Marc-Antoine Arnaud <maarnaud@media-io.com>, Thibaud Le Graverend <thibaud.legraverend@luminvent.com>, Nicolas Pierre <nico.pierre@icloud.com>
requires_python>=3.8
licenseMIT
keywords amqp micro-service python
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Python SDK for Media Cloud AI workers

Based on [mcai_worker_sdk](https://gitlab.com/media-cloud-ai/sdks/rs_mcai_worker_sdk), this SDK uses the [PyO3 crate](https://github.com/PyO3/pyo3) to export a compiled module compatible with CPython ABI.

## Documentation

Please, check the docs [here](https://media-cloud-ai.gitlab.io/sdks/py_mcai_worker_sdk/mcai_worker_sdk/) and [here](https://media-cloud-ai.gitlab.io/sdks/py_mcai_worker_sdk/mcai_worker_sdk_media/) 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](https://github.com/PyO3/maturin) to compile the module.

```bash
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):

```bash
maturin develop --features extension-module # Build and install the module
```

Or build the wheel file and install it manually via `pip`:

```bash
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:

```python
import mcai_worker_sdk as mcai
```

Check out [maturin's docs](https://www.maturin.rs/distribution.html#build-wheels) 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:
- [x] CPython 3.8 : manylinux
- [x] CPython 3.9 : manylinux, macosx x86_64
- [x] CPython 3.10 : manylinux, macosx x86_64, macosx arm64
- [x] CPython 3.11 : manylinux, macosx arm54
- [x] Pypy 3.8 : manylinux
- [x] Pypy 3.9 : manylinux

And the following core architectures:
- [x] x86_64


## Test

To run tests you must have `json-strong-typing` installed:

```bash
pip install json-strong-typing
```

Then launch tests basically:

```bash
cargo test
cargo test --features media
```

### Running examples

#### Build the Python module

In your virtual environment:

```bash
maturin develop
```

#### Simple worker

```bash
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:

```bash
export SOURCE_PATH="/folder/filename.ext"
```

Then run the SDK with these parameters:

```bash
RUST_LOG=debug \
SOURCE_ORDERS="examples/message.json" \
PYTHON_WORKER_FILENAME="media_worker.py" \
DESTINATION_PATH="results.json" \
cargo run --features media
```


            

Raw data

            {
    "_id": null,
    "home_page": "https://gitlab.com/media-cloud-ai/sdks/py_mcai_worker_sdk",
    "name": "mcai-worker-sdk-media",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": null,
    "keywords": "AMQP, micro-service, python",
    "author": "Valentin NOEL <valentin.noel@media-io.com>, Marc-Antoine Arnaud <maarnaud@media-io.com>, Thibaud Le Graverend <thibaud.legraverend@luminvent.com>, Nicolas Pierre <nico.pierre@icloud.com>",
    "author_email": "Valentin NOEL <valentin.noel@media-io.com>, Marc-Antoine Arnaud <maarnaud@media-io.com>, Thibaud Le Graverend <thibaud.legraverend@luminvent.com>, Nicolas Pierre <nico.pierre@icloud.com>",
    "download_url": null,
    "platform": null,
    "description": "# Python SDK for Media Cloud AI workers\n\nBased on [mcai_worker_sdk](https://gitlab.com/media-cloud-ai/sdks/rs_mcai_worker_sdk), this SDK uses the [PyO3 crate](https://github.com/PyO3/pyo3) to export a compiled module compatible with CPython ABI.\n\n## Documentation\n\nPlease, check the docs [here](https://media-cloud-ai.gitlab.io/sdks/py_mcai_worker_sdk/mcai_worker_sdk/) and [here](https://media-cloud-ai.gitlab.io/sdks/py_mcai_worker_sdk/mcai_worker_sdk_media/) for the SDK with the media feature enabled.\n\n## Build\n\nBefore 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](https://github.com/PyO3/maturin) to compile the module.\n\n```bash\nvirtualenv venv # Create your environment\nsource venv/bin/activate # Launch it\n```\n\nYou can then either build the module in development mode (this will build and install the module in your virtualenv):\n\n```bash\nmaturin develop --features extension-module # Build and install the module\n```\n\nOr build the wheel file and install it manually via `pip`:\n\n```bash\nmaturin build --features extension-module # Build the wheel file to install the module\npip install path/to/generated/wheel/file\n```\n\nYou will now be able to import the module in your Python's scripts by doing:\n\n```python\nimport mcai_worker_sdk as mcai\n```\n\nCheck out [maturin's docs](https://www.maturin.rs/distribution.html#build-wheels) for more information on building the module!\n\n### Supported version\n\nWe 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.\n\nThis operation supposes that you have at least __Rust 1.62__.\n\nWe currently support the following version of Python implementations:\n- [x] CPython 3.8 : manylinux\n- [x] CPython 3.9 : manylinux, macosx x86_64\n- [x] CPython 3.10 : manylinux, macosx x86_64, macosx arm64\n- [x] CPython 3.11 : manylinux, macosx arm54\n- [x] Pypy 3.8 : manylinux\n- [x] Pypy 3.9 : manylinux\n\nAnd the following core architectures:\n- [x] x86_64\n\n\n## Test\n\nTo run tests you must have `json-strong-typing` installed:\n\n```bash\npip install json-strong-typing\n```\n\nThen launch tests basically:\n\n```bash\ncargo test\ncargo test --features media\n```\n\n### Running examples\n\n#### Build the Python module\n\nIn your virtual environment:\n\n```bash\nmaturin develop\n```\n\n#### Simple worker\n\n```bash\nRUST_LOG=debug \\\nSOURCE_ORDERS=\"examples/message.json\" \\\nPYTHON_WORKER_FILENAME=\"worker.py\" \\\nSOURCE_PATH=\"README.md\" \\\nDESTINATION_PATH=\"README.md.out\" \\\npython worker.py\n```\n\n#### Media worker\n\nFirst set the media filename:\n\n```bash\nexport SOURCE_PATH=\"/folder/filename.ext\"\n```\n\nThen run the SDK with these parameters:\n\n```bash\nRUST_LOG=debug \\\nSOURCE_ORDERS=\"examples/message.json\" \\\nPYTHON_WORKER_FILENAME=\"media_worker.py\" \\\nDESTINATION_PATH=\"results.json\" \\\ncargo run --features media\n```\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "MCAI SDK to develop Python worker",
    "version": "2.1.1",
    "project_urls": {
        "Documentation": "https://mcai-python-sdk-media.readthedocs.io/",
        "Homepage": "https://gitlab.com/media-cloud-ai/sdks/py_mcai_worker_sdk"
    },
    "split_keywords": [
        "amqp",
        " micro-service",
        " python"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "94fad59a57d3a74b74c2f5c90f4a5edb247bb9249378911d08a44777e2fbc71d",
                "md5": "a6bb32e82e2ab83abf236121f9589179",
                "sha256": "1de2954663b285e5d634a2f5b581b35a5299c074b42ae481e54b746ef66b3009"
            },
            "downloads": -1,
            "filename": "mcai_worker_sdk_media-2.1.1-cp310-cp310-manylinux_2_34_x86_64.whl",
            "has_sig": false,
            "md5_digest": "a6bb32e82e2ab83abf236121f9589179",
            "packagetype": "bdist_wheel",
            "python_version": "cp310",
            "requires_python": ">=3.8",
            "size": 86271841,
            "upload_time": "2024-12-03T12:07:41",
            "upload_time_iso_8601": "2024-12-03T12:07:41.493149Z",
            "url": "https://files.pythonhosted.org/packages/94/fa/d59a57d3a74b74c2f5c90f4a5edb247bb9249378911d08a44777e2fbc71d/mcai_worker_sdk_media-2.1.1-cp310-cp310-manylinux_2_34_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "d02ff3fbdbee7e2aec1d0d90dd3197d6b82b73c6fa74bdad49e9aa72f95295c3",
                "md5": "4ca366ec9859db1c8d6ffff7fd395ab6",
                "sha256": "4e95b13aca8c96fcc168a4707cd84dc38db61b8bed465864df6c9eb01588e494"
            },
            "downloads": -1,
            "filename": "mcai_worker_sdk_media-2.1.1-cp311-cp311-manylinux_2_34_x86_64.whl",
            "has_sig": false,
            "md5_digest": "4ca366ec9859db1c8d6ffff7fd395ab6",
            "packagetype": "bdist_wheel",
            "python_version": "cp311",
            "requires_python": ">=3.8",
            "size": 86272387,
            "upload_time": "2024-12-03T12:07:49",
            "upload_time_iso_8601": "2024-12-03T12:07:49.217934Z",
            "url": "https://files.pythonhosted.org/packages/d0/2f/f3fbdbee7e2aec1d0d90dd3197d6b82b73c6fa74bdad49e9aa72f95295c3/mcai_worker_sdk_media-2.1.1-cp311-cp311-manylinux_2_34_x86_64.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-03 12:07:41",
    "github": false,
    "gitlab": true,
    "bitbucket": false,
    "codeberg": false,
    "gitlab_user": "media-cloud-ai",
    "gitlab_project": "sdks",
    "lcname": "mcai-worker-sdk-media"
}
        
Elapsed time: 0.34866s