![Clarifai logo](https://www.clarifai.com/hs-fs/hubfs/logo/Clarifai/clarifai-740x150.png?width=240)
# clarifai-python-utils
This is the official Clarifai Python utilities project. This repo includes higher level convenience classes, functions, and scripts to make using our [API](https://docs.clarifai.com) easier. This is built on top of the [Clarifai Python gRPC Client](https://github.com/Clarifai/clarifai-python-grpc).
* Try the Clarifai demo at: https://clarifai.com/demo
* Sign up for a free account at: https://clarifai.com/signup
* Read the documentation at: https://docs.clarifai.com/
## Installation
```cmd
pip install -U clarifai-utils
```
## Installation from source (for development)
```cmd
python -m venv ~/virtualenv/clarifai-python-utils
source ~/virtualenv/clarifai-python-utils/bin/activate
cd clarifai-python-utils
python setup.py develop
```
## Versioning
This library doesn't use semantic versioning. The first two version numbers (`X.Y` out of `X.Y.Z`) follow the API (backend) versioning, and
whenever the API gets updated, this library follows it.
The third version number (`Z` out of `X.Y.Z`) is used by this library for any independent releases of library-specific improvements and bug fixes.
## Getting started
Here is a quick example of listing all the concepts in an application.
Set some env vars first
```cmd
export CLARIFAI_USER_ID={the user_id of the app_id of the app you want to access resources in}
export CLARIFAI_APP_ID={the app_id of the app you want to access resources in}
export CLARIFAI_PAT={your personal access token}
```
```python
from clarifai_utils.client import create_stub
from clarifai_utils.listing.lister import ClarifaiResourceLister
# Create a client with auth information from those env vars.
stub = create_stub()
# Create the resource lister.
lister = ClarifaiResourceLister(stub, auth.user_id, auth.app_id, page_size=16)
# List all the concepts in the app:
concepts = []
for c in lister.concepts_generator():
concepts.append(c)
```
# Testing
```bash
pip install tests/requirements.txt
pytest tests/
```
# Linting
The repo will be linted when changed in a github workflow.
To speed up development it's recommended to install pre-commit and tools
```shell
pip install -r requirements-dev.txt
pre-commit install
```
You could run all checks by
```shell
pre-commit run --all-files
```
Raw data
{
"_id": null,
"home_page": "https://github.com/Clarifai/clarifai-python-utils",
"name": "clarifai-utils",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "",
"author": "Clarifai",
"author_email": "support@clarifai.com",
"download_url": "https://files.pythonhosted.org/packages/1f/23/515431c6878f7ace76f97f2349275e9a2bd61fbfabe8442f5820c516df3b/clarifai-utils-0.1.20.tar.gz",
"platform": null,
"description": "![Clarifai logo](https://www.clarifai.com/hs-fs/hubfs/logo/Clarifai/clarifai-740x150.png?width=240)\n\n# clarifai-python-utils\n\n\nThis is the official Clarifai Python utilities project. This repo includes higher level convenience classes, functions, and scripts to make using our [API](https://docs.clarifai.com) easier. This is built on top of the [Clarifai Python gRPC Client](https://github.com/Clarifai/clarifai-python-grpc).\n\n* Try the Clarifai demo at: https://clarifai.com/demo\n* Sign up for a free account at: https://clarifai.com/signup\n* Read the documentation at: https://docs.clarifai.com/\n\n\n## Installation\n\n```cmd\npip install -U clarifai-utils\n```\n\n## Installation from source (for development)\n```cmd\npython -m venv ~/virtualenv/clarifai-python-utils\nsource ~/virtualenv/clarifai-python-utils/bin/activate\ncd clarifai-python-utils\npython setup.py develop\n```\n## Versioning\n\nThis library doesn't use semantic versioning. The first two version numbers (`X.Y` out of `X.Y.Z`) follow the API (backend) versioning, and\nwhenever the API gets updated, this library follows it.\n\nThe third version number (`Z` out of `X.Y.Z`) is used by this library for any independent releases of library-specific improvements and bug fixes.\n\n## Getting started\n\nHere is a quick example of listing all the concepts in an application.\n\nSet some env vars first\n```cmd\nexport CLARIFAI_USER_ID={the user_id of the app_id of the app you want to access resources in}\nexport CLARIFAI_APP_ID={the app_id of the app you want to access resources in}\nexport CLARIFAI_PAT={your personal access token}\n```\n\n```python\nfrom clarifai_utils.client import create_stub\nfrom clarifai_utils.listing.lister import ClarifaiResourceLister\n\n# Create a client with auth information from those env vars.\nstub = create_stub()\n\n# Create the resource lister.\nlister = ClarifaiResourceLister(stub, auth.user_id, auth.app_id, page_size=16)\n\n# List all the concepts in the app:\nconcepts = []\nfor c in lister.concepts_generator():\n concepts.append(c)\n```\n\n\n# Testing\n\n```bash\npip install tests/requirements.txt\npytest tests/\n```\n\n\n# Linting\nThe repo will be linted when changed in a github workflow.\nTo speed up development it's recommended to install pre-commit and tools\n```shell\npip install -r requirements-dev.txt\npre-commit install\n```\n\nYou could run all checks by\n```shell\npre-commit run --all-files\n```\n\n\n",
"bugtrack_url": null,
"license": "Apache 2.0",
"summary": "Clarifai Python Utilities",
"version": "0.1.20",
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"md5": "b267853c60bacb1f47cd666a8ec8257f",
"sha256": "509d607d53c49b0b52cd4a46eff1281b6879f02cb89b0322dc76c032ebc61687"
},
"downloads": -1,
"filename": "clarifai_utils-0.1.20-py3-none-any.whl",
"has_sig": false,
"md5_digest": "b267853c60bacb1f47cd666a8ec8257f",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 26197,
"upload_time": "2022-12-21T04:46:15",
"upload_time_iso_8601": "2022-12-21T04:46:15.340034Z",
"url": "https://files.pythonhosted.org/packages/5b/39/cbbcc3e624805db6ea0486933b9b27317984f1cbbf4e042cc08977385258/clarifai_utils-0.1.20-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"md5": "b9c4977faa7d4022e54dd65a6327ddfb",
"sha256": "d256e27be71cf94ec6bb2952e20890eb0af25b91c4b068e02d4ca5c8adba1dda"
},
"downloads": -1,
"filename": "clarifai-utils-0.1.20.tar.gz",
"has_sig": false,
"md5_digest": "b9c4977faa7d4022e54dd65a6327ddfb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 19481,
"upload_time": "2022-12-21T04:46:16",
"upload_time_iso_8601": "2022-12-21T04:46:16.947132Z",
"url": "https://files.pythonhosted.org/packages/1f/23/515431c6878f7ace76f97f2349275e9a2bd61fbfabe8442f5820c516df3b/clarifai-utils-0.1.20.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2022-12-21 04:46:16",
"github": true,
"gitlab": false,
"bitbucket": false,
"github_user": "Clarifai",
"github_project": "clarifai-python-utils",
"lcname": "clarifai-utils"
}