pymoai


Namepymoai JSON
Version 0.3.2 PyPI version JSON
download
home_pagehttps://www.montops.ai/
SummaryMontOps AI Python Client
upload_time2023-04-02 14:03:56
maintainer
docs_urlNone
authormontops.ai
requires_python>=3.8.1,<3.10
licenseApache-2.0
keywords aiops mlops ml model registry ml model store ml monitoring
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 🧰  pymoai - MontOps moai client for Python

[![PyPI](https://img.shields.io/pypi/v/pymoai?style=flat-square)](https://pypi.org/project/pymoai/)
[![Interrogate](https://raw.githubusercontent.com/MontOpsInc/pymoai/main/assets/interrogate_badge.svg)](https://github.com/MontOpsInc/pymoai)

This repository contains the source code for MontOps AI's official python client. This client is currently in pre-alpha version, so feedback is always welcome!

You are welcome to file an issue here for general use cases. You can also contact MontOps Support [here](help.montops.ai).

## Requirements

Python 3.8 or above is required.

## Documentation

For the latest documentation, see

- [MontOps AI](https://www.montops.ai)

## Quickstart

Install the library with `pip install pymoai`

Note: Don't hard-code authentication secrets into your Python. Use environment variables

email/Password Authentication:

```bash
export MOAI_USERNAME=*************
export MOAI_PASSWORD=*************
```

If you already have a token, use that instead:

```bash
export MOAI_TOKEN=*****************************************
```

Example usage:
```python
import os
import pandas as pd
from pymoai.client import MoaiClient

# If no credentials are supplied, then environment variables are required.
email = "tech@montops.ai"
password = "$montops123"

# ...or try using an active token.
# This may fail, see exception handling below.
token = None

# First create client with active token or credentials
moai = MoaiClient(
    # ...using email/password
    email=email,
    password=password,
    # ...or if using token, token will take priority
    token=token
)

# Check the health of your server
health = moai.health().dict()

print("Health: ", health)

assert health is not None and health['status'] == 'live'

# Add a dataset to your moai system

# From a DataFrame
path = "/path/to/dataset/data.csv"
df = pd.DataFrame(path)
result = moai.datasets.add(df=df)

# Or pass in a string path to read from fs directly
result = moai.datasets.add(path=path)

if result.ok:
    print("DataFrame uploaded: ", result.details)
else
    print("Upload failed: ", result.error)
```

Exception handling:
```python
from pymoai.client import MoaiClient
from pymoai.exceptions import ApiResponseError, InvalidTokenError

try:
    try:
        # An InvalidToken error is raised if the token is expired or incorrect
        moai = MoaiClient(
            token=token
        )
    except InvalidTokenError:
        print(f"Token invalid, logging in instead.")
        # Catch all other errors using ApiResponseErrors
        moai = MoaiClient(
            email=email,
            password=password
        )
except ApiResponseError as e:
    print(f"Could not create moai client: {e.error}")
    return
```

## Contributing

We will allow contributing soon!

## License

[Apache License 2.0](LICENSE)


            

Raw data

            {
    "_id": null,
    "home_page": "https://www.montops.ai/",
    "name": "pymoai",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8.1,<3.10",
    "maintainer_email": "",
    "keywords": "AIOps,MLOps,ML Model Registry,ML Model Store,ML Monitoring",
    "author": "montops.ai",
    "author_email": "info@montops.ai",
    "download_url": "https://files.pythonhosted.org/packages/cf/e1/613b5af306cf9c6402651c3004660878beed49a4fca2e8d6df66e1322cc1/pymoai-0.3.2.tar.gz",
    "platform": null,
    "description": "# \ud83e\uddf0  pymoai - MontOps moai client for Python\n\n[![PyPI](https://img.shields.io/pypi/v/pymoai?style=flat-square)](https://pypi.org/project/pymoai/)\n[![Interrogate](https://raw.githubusercontent.com/MontOpsInc/pymoai/main/assets/interrogate_badge.svg)](https://github.com/MontOpsInc/pymoai)\n\nThis repository contains the source code for MontOps AI's official python client. This client is currently in pre-alpha version, so feedback is always welcome!\n\nYou are welcome to file an issue here for general use cases. You can also contact MontOps Support [here](help.montops.ai).\n\n## Requirements\n\nPython 3.8 or above is required.\n\n## Documentation\n\nFor the latest documentation, see\n\n- [MontOps AI](https://www.montops.ai)\n\n## Quickstart\n\nInstall the library with `pip install pymoai`\n\nNote: Don't hard-code authentication secrets into your Python. Use environment variables\n\nemail/Password Authentication:\n\n```bash\nexport MOAI_USERNAME=*************\nexport MOAI_PASSWORD=*************\n```\n\nIf you already have a token, use that instead:\n\n```bash\nexport MOAI_TOKEN=*****************************************\n```\n\nExample usage:\n```python\nimport os\nimport pandas as pd\nfrom pymoai.client import MoaiClient\n\n# If no credentials are supplied, then environment variables are required.\nemail = \"tech@montops.ai\"\npassword = \"$montops123\"\n\n# ...or try using an active token.\n# This may fail, see exception handling below.\ntoken = None\n\n# First create client with active token or credentials\nmoai = MoaiClient(\n    # ...using email/password\n    email=email,\n    password=password,\n    # ...or if using token, token will take priority\n    token=token\n)\n\n# Check the health of your server\nhealth = moai.health().dict()\n\nprint(\"Health: \", health)\n\nassert health is not None and health['status'] == 'live'\n\n# Add a dataset to your moai system\n\n# From a DataFrame\npath = \"/path/to/dataset/data.csv\"\ndf = pd.DataFrame(path)\nresult = moai.datasets.add(df=df)\n\n# Or pass in a string path to read from fs directly\nresult = moai.datasets.add(path=path)\n\nif result.ok:\n    print(\"DataFrame uploaded: \", result.details)\nelse\n    print(\"Upload failed: \", result.error)\n```\n\nException handling:\n```python\nfrom pymoai.client import MoaiClient\nfrom pymoai.exceptions import ApiResponseError, InvalidTokenError\n\ntry:\n    try:\n        # An InvalidToken error is raised if the token is expired or incorrect\n        moai = MoaiClient(\n            token=token\n        )\n    except InvalidTokenError:\n        print(f\"Token invalid, logging in instead.\")\n        # Catch all other errors using ApiResponseErrors\n        moai = MoaiClient(\n            email=email,\n            password=password\n        )\nexcept ApiResponseError as e:\n    print(f\"Could not create moai client: {e.error}\")\n    return\n```\n\n## Contributing\n\nWe will allow contributing soon!\n\n## License\n\n[Apache License 2.0](LICENSE)\n\n",
    "bugtrack_url": null,
    "license": "Apache-2.0",
    "summary": "MontOps AI Python Client",
    "version": "0.3.2",
    "split_keywords": [
        "aiops",
        "mlops",
        "ml model registry",
        "ml model store",
        "ml monitoring"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0f93eb63b17372720af7e99c6cd6720b2f0fd93e7c91c704985e4f0cba18496e",
                "md5": "233921796ecc3d9b1ca1cac739f7d754",
                "sha256": "a0c83e1cd70ff749b2d7e53c9ab6fb239a9fe8002fa3b35f26b3e2c002ce77a2"
            },
            "downloads": -1,
            "filename": "pymoai-0.3.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "233921796ecc3d9b1ca1cac739f7d754",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8.1,<3.10",
            "size": 15156,
            "upload_time": "2023-04-02T14:03:55",
            "upload_time_iso_8601": "2023-04-02T14:03:55.557412Z",
            "url": "https://files.pythonhosted.org/packages/0f/93/eb63b17372720af7e99c6cd6720b2f0fd93e7c91c704985e4f0cba18496e/pymoai-0.3.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cfe1613b5af306cf9c6402651c3004660878beed49a4fca2e8d6df66e1322cc1",
                "md5": "85d50f44c6a246b37874494aacb32731",
                "sha256": "107523ee85c43e42d2c2348c45dfb44a957061d6533f0bf61454f2458f28547f"
            },
            "downloads": -1,
            "filename": "pymoai-0.3.2.tar.gz",
            "has_sig": false,
            "md5_digest": "85d50f44c6a246b37874494aacb32731",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8.1,<3.10",
            "size": 14133,
            "upload_time": "2023-04-02T14:03:56",
            "upload_time_iso_8601": "2023-04-02T14:03:56.692069Z",
            "url": "https://files.pythonhosted.org/packages/cf/e1/613b5af306cf9c6402651c3004660878beed49a4fca2e8d6df66e1322cc1/pymoai-0.3.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-04-02 14:03:56",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "pymoai"
}
        
Elapsed time: 0.05030s