# Mitosis Python SDK
This is the Python client SDK to interact with the Mitosis API. It provides a convenient way to access Mitosis services and manage your resources programmatically.
See the [Mitosis documentation](https://docs.stack.rs/mitosis) and [Mitosis repository](https://github.com/stack-rs/mitosis) for more details.
## Usage
Install the package with pip
```bash
pip install pynetmito
```
Or if you are using [uv](https://docs.astral.sh/uv/), you can add it to your project with:
```bash
uv add pynetmito
```
Now let's see a simple example of how to use the SDK:
```python
from pynetmito import MitoHttpClient
coordinator_addr = "http://127.0.0.1:5000" # The coordinator address of the mitosis backend service
c = MitoHttpClient(coordinator_addr)
c.connect(user="your-user-name", password="your-password")
# Now you can use the client to submit tasks
with open("orig.txt", "w") as f:
f.write("hello world")
c.upload_attachment(Path("orig.txt"), key="some-remote-text-file/in-object-storage/log.txt")
# Specify the task with attachment
attachment = RemoteResourceDownload(
remote_file=RemoteResource.attachment("some-remote-text-file/in-object-storage/log.txt"), local_path=Path("test.txt")
)
task_spec = TaskSpec(args=["echo", "$MITO_RESOURCE/test.txt"], resources=[attachment], terminal_output=True)
args = SubmitTaskReq(group_name=c.username, task_spec=task_spec)
r = c.user_submit_task(args) # This will return a SubmitTaskResp object (with uuid to identify the task)
res = c.get_task_by_uuid(r.uuid) # You can use the uuid to get the task status and result
print(res)
# To download the terminal output of the task
c.download_artifact(
r.uuid,
content_type=ArtifactContentType.STD_LOG,
local_path=Path("new.txt"),
)
```
## Mitosis API support table
| **Mitosis** | **pynetmito** |
| :---------: | :-----------: |
| 0.6.5 | 0.2.5 |
| 0.6.4 | 0.2.4 |
| 0.6.3 | 0.2.4 |
| 0.6.2 | 0.2.4 |
| 0.6.2 | 0.2.3 |
| 0.6.1 | 0.2.2 |
| 0.6.0 | 0.2.1 |
| 0.6.0 | 0.2.0 |
| 0.5.3 | 0.1.3 |
Raw data
{
"_id": null,
"home_page": null,
"name": "pynetmito",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.10",
"maintainer_email": null,
"keywords": "API, Async, Client, Distributed, HTTP, REST, SDK, evaluation, mitosis",
"author": null,
"author_email": "BobAnkh <bobankhshen@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/5f/50/332cd523f6be288e2bb56743c22c40955f5f08ff11b397234cdff754fe29/pynetmito-0.2.5.tar.gz",
"platform": null,
"description": "# Mitosis Python SDK\n\nThis is the Python client SDK to interact with the Mitosis API. It provides a convenient way to access Mitosis services and manage your resources programmatically.\n\nSee the [Mitosis documentation](https://docs.stack.rs/mitosis) and [Mitosis repository](https://github.com/stack-rs/mitosis) for more details.\n\n## Usage\n\nInstall the package with pip\n\n```bash\npip install pynetmito\n```\n\nOr if you are using [uv](https://docs.astral.sh/uv/), you can add it to your project with:\n\n```bash\nuv add pynetmito\n```\n\nNow let's see a simple example of how to use the SDK:\n\n```python\nfrom pynetmito import MitoHttpClient\ncoordinator_addr = \"http://127.0.0.1:5000\" # The coordinator address of the mitosis backend service\nc = MitoHttpClient(coordinator_addr)\nc.connect(user=\"your-user-name\", password=\"your-password\")\n\n# Now you can use the client to submit tasks\nwith open(\"orig.txt\", \"w\") as f:\n f.write(\"hello world\")\nc.upload_attachment(Path(\"orig.txt\"), key=\"some-remote-text-file/in-object-storage/log.txt\")\n\n# Specify the task with attachment\nattachment = RemoteResourceDownload(\n remote_file=RemoteResource.attachment(\"some-remote-text-file/in-object-storage/log.txt\"), local_path=Path(\"test.txt\")\n)\ntask_spec = TaskSpec(args=[\"echo\", \"$MITO_RESOURCE/test.txt\"], resources=[attachment], terminal_output=True)\nargs = SubmitTaskReq(group_name=c.username, task_spec=task_spec)\nr = c.user_submit_task(args) # This will return a SubmitTaskResp object (with uuid to identify the task)\nres = c.get_task_by_uuid(r.uuid) # You can use the uuid to get the task status and result\nprint(res)\n\n# To download the terminal output of the task\nc.download_artifact(\n r.uuid,\n content_type=ArtifactContentType.STD_LOG,\n local_path=Path(\"new.txt\"),\n)\n\n```\n\n## Mitosis API support table\n\n| **Mitosis** | **pynetmito** |\n| :---------: | :-----------: |\n| 0.6.5 | 0.2.5 |\n| 0.6.4 | 0.2.4 |\n| 0.6.3 | 0.2.4 |\n| 0.6.2 | 0.2.4 |\n| 0.6.2 | 0.2.3 |\n| 0.6.1 | 0.2.2 |\n| 0.6.0 | 0.2.1 |\n| 0.6.0 | 0.2.0 |\n| 0.5.3 | 0.1.3 |\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Python Client SDK for mitosis",
"version": "0.2.5",
"project_urls": {
"Documentation": "https://docs.stack.rs/mitosis/",
"Homepage": "https://github.com/stack-rs/mitosis-python-sdk",
"Source": "https://github.com/stack-rs/mitosis-python-sdk"
},
"split_keywords": [
"api",
" async",
" client",
" distributed",
" http",
" rest",
" sdk",
" evaluation",
" mitosis"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "c383fc10b339fe1e32077c1203bb28b0e609e1d844a8529a5cc22b8d43fe0373",
"md5": "5113ee50c5db598ec6c707f712c28c70",
"sha256": "ea88f47264774d2edd1de585aa5e7323d1074dc8486d886dcf735e06e059742d"
},
"downloads": -1,
"filename": "pynetmito-0.2.5-py3-none-any.whl",
"has_sig": false,
"md5_digest": "5113ee50c5db598ec6c707f712c28c70",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.10",
"size": 18286,
"upload_time": "2025-11-02T07:20:21",
"upload_time_iso_8601": "2025-11-02T07:20:21.064616Z",
"url": "https://files.pythonhosted.org/packages/c3/83/fc10b339fe1e32077c1203bb28b0e609e1d844a8529a5cc22b8d43fe0373/pynetmito-0.2.5-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "5f50332cd523f6be288e2bb56743c22c40955f5f08ff11b397234cdff754fe29",
"md5": "13053760fd53dbf87c00a570f791606b",
"sha256": "2b440d86dbcd659b36faf1f67015d7564f293dc659720c780af1f86bfb013e9c"
},
"downloads": -1,
"filename": "pynetmito-0.2.5.tar.gz",
"has_sig": false,
"md5_digest": "13053760fd53dbf87c00a570f791606b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.10",
"size": 18129,
"upload_time": "2025-11-02T07:20:22",
"upload_time_iso_8601": "2025-11-02T07:20:22.912225Z",
"url": "https://files.pythonhosted.org/packages/5f/50/332cd523f6be288e2bb56743c22c40955f5f08ff11b397234cdff754fe29/pynetmito-0.2.5.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-11-02 07:20:22",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "stack-rs",
"github_project": "mitosis-python-sdk",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "pynetmito"
}