# Superblocks Python SDK
[![Python version](https://img.shields.io/badge/python-%3E=_3.10-teal.svg)](https://www.python.org/downloads/)
[![PyPi Version](https://img.shields.io/pypi/v/superblocks-agent)](https://pypi.org/project/superblocks-agent/)
## Installation
Use the package manager [pip](https://pip.pypa.io/en/stable/) to install.
```sh
pip install superblocks-agent
```
## Quickstart
### Run an API
```python3
from superblocks_agent.api import Api
from superblocks_agent.client import Client, Config
from superblocks_agent.testing.step import on, Params
# configure client
client = Client(config=Config(token="my-token"))
# specify api to run
api = Api("my-api-id")
# run with client in context manager
with client as c:
# run api
result = api.run(client=c, inputs={"input1": "foo", "input2": 5})
# create a mock for any step named "Step1" and have it return {"im": "mocked"}
mock = on(params=Params(step_name="Step1")).return_({"im": "mocked"})
result_with_mock = api.run(client=c, mocks=[mock])
# get api output
print(result.get_result())
# get block output by name
print(result_with_mock.get_block_result("Step1")) # {"im": "mocked"}
```
Raw data
{
"_id": null,
"home_page": "https://github.com/superblocksteam/orchestrator/tree/main/clients/python",
"name": "superblocks-agent",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "superblocks api sdk",
"author": "Joey Greco",
"author_email": "joeyagreco@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/62/9b/8f2d014eca623ead3799e15d51a17c735edb77a2780366f5cfb00685e467/superblocks-agent-0.0.21.tar.gz",
"platform": null,
"description": "# Superblocks Python SDK\n\n[![Python version](https://img.shields.io/badge/python-%3E=_3.10-teal.svg)](https://www.python.org/downloads/)\n[![PyPi Version](https://img.shields.io/pypi/v/superblocks-agent)](https://pypi.org/project/superblocks-agent/)\n\n## Installation\n\nUse the package manager [pip](https://pip.pypa.io/en/stable/) to install.\n\n```sh\npip install superblocks-agent\n```\n\n## Quickstart\n\n### Run an API\n\n```python3\nfrom superblocks_agent.api import Api\nfrom superblocks_agent.client import Client, Config\nfrom superblocks_agent.testing.step import on, Params\n\n\n# configure client\nclient = Client(config=Config(token=\"my-token\"))\n\n# specify api to run\napi = Api(\"my-api-id\")\n\n# run with client in context manager\nwith client as c:\n # run api\n result = api.run(client=c, inputs={\"input1\": \"foo\", \"input2\": 5})\n # create a mock for any step named \"Step1\" and have it return {\"im\": \"mocked\"}\n mock = on(params=Params(step_name=\"Step1\")).return_({\"im\": \"mocked\"})\n result_with_mock = api.run(client=c, mocks=[mock])\n\n# get api output\nprint(result.get_result())\n# get block output by name\nprint(result_with_mock.get_block_result(\"Step1\")) # {\"im\": \"mocked\"}\n\n```\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "The Official Python SDK for Superblocks",
"version": "0.0.21",
"project_urls": {
"Homepage": "https://github.com/superblocksteam/orchestrator/tree/main/clients/python"
},
"split_keywords": [
"superblocks",
"api",
"sdk"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1d968a23aab995560973f01848c759169c0b9c0f71549d30406153cdebf6302a",
"md5": "05b7ec3430d66e20067eda3bcb426636",
"sha256": "1da3aee7ae262301f74462ff25cc782672bb3fbdac11aca76c0317f13109f5b7"
},
"downloads": -1,
"filename": "superblocks_agent-0.0.21-py3-none-any.whl",
"has_sig": false,
"md5_digest": "05b7ec3430d66e20067eda3bcb426636",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 172748,
"upload_time": "2024-06-07T16:32:23",
"upload_time_iso_8601": "2024-06-07T16:32:23.993579Z",
"url": "https://files.pythonhosted.org/packages/1d/96/8a23aab995560973f01848c759169c0b9c0f71549d30406153cdebf6302a/superblocks_agent-0.0.21-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "629b8f2d014eca623ead3799e15d51a17c735edb77a2780366f5cfb00685e467",
"md5": "6bb9c6c53b33d479c56d6db4d8a80b21",
"sha256": "c3e2fcc4ca83d13650180b68d9e7be9f09aa2b41b3d5fd6b2ac467c4a81c14a3"
},
"downloads": -1,
"filename": "superblocks-agent-0.0.21.tar.gz",
"has_sig": false,
"md5_digest": "6bb9c6c53b33d479c56d6db4d8a80b21",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 90022,
"upload_time": "2024-06-07T16:32:25",
"upload_time_iso_8601": "2024-06-07T16:32:25.463670Z",
"url": "https://files.pythonhosted.org/packages/62/9b/8f2d014eca623ead3799e15d51a17c735edb77a2780366f5cfb00685e467/superblocks-agent-0.0.21.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-06-07 16:32:25",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "superblocksteam",
"github_project": "orchestrator",
"github_not_found": true,
"lcname": "superblocks-agent"
}