Skip to main content

Python Client SDK for mitosis

Project description

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 and Mitosis repository for more details.

Usage

Install the package with pip

pip install pynetmito

Or if you are using uv, you can add it to your project with:

uv add pynetmito

Now let's see a simple example of how to use the SDK:

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.0 0.2.1
0.6.0 0.2.0
0.5.3 0.1.3

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pynetmito-0.2.1.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pynetmito-0.2.1-py3-none-any.whl (16.4 kB view details)

Uploaded Python 3

File details

Details for the file pynetmito-0.2.1.tar.gz.

File metadata

  • Download URL: pynetmito-0.2.1.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pynetmito-0.2.1.tar.gz
Algorithm Hash digest
SHA256 0c88d2030423744b5a7e219b7939d5adcc69700c19ed3e22dd0a8349b297bba3
MD5 afa19ff4566b1067a65feb21921a9ffa
BLAKE2b-256 c3dfacf5afc7a513cdca70ce6acc0820ccf1c5536e0c1de5d9defd0f8169e7da

See more details on using hashes here.

Provenance

The following attestation bundles were made for pynetmito-0.2.1.tar.gz:

Publisher: publish.yml on stack-rs/mitosis-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pynetmito-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: pynetmito-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 16.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pynetmito-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ff3f668cf300b3984c53fb151bbdddea9a6c238f4b7c834444dc65b8801f4430
MD5 0fe15f35520893512031aaeeb5da0b23
BLAKE2b-256 c109a70fdd7f2853c79355ef2a74e09cf54de788633955cdde61222d746268ca

See more details on using hashes here.

Provenance

The following attestation bundles were made for pynetmito-0.2.1-py3-none-any.whl:

Publisher: publish.yml on stack-rs/mitosis-python-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page