Skip to main content

Opentrons Python API

Simple (and currently incomplete) Python wrapper around the Opentrons HTTP API. Like https://github.com/Opentrons/opentrons/tree/edge/api-client, but in Python. This API is atomic and interactive.

This project is created for use with PyLabRobot, but can be used however you like.

Installation

  • from pip
pip install opentrons-http-api-client
  • from source
git clone http://github.com/rickwierenga/opentrons-python-api

Usage

Minimal example for simple liquid handling:

import ot_api
ot_api.set_host("x.x.x.x") # find in OT app
ot_api.set_port(31950)     # default, so not really necessary

# Creating a run
run_id = ot_api.runs.create()
ot_api.set_run(run_id) # set run globally, alternative to `run_id` parameter for functions

# Add pipettes that are detected in hardware to the software
left_pipette, right_pipette = ot_api.lh.add_mounted_pipettes()
left_pipette_id = left_pipette["pipetteId"]

# Defining labware
data = ot_api.labware.define(labware_definition) # json from opentrons-shared-data
namespace, definition, version = data["data"]["definitionUri"].split("/")

# Adding labware
labware_id = "arbitrary id for labware"
ot_api.labware.add(
  load_name=definition,
  namespace=namespace,
  version=version,
  ot_location=1, # slot
  labware_id=labware_id
)

# Picking up a tip
ot_api.lh.pick_up_tip(labware_id=labware_id, well_name="A1", pipette_id=left_pipette_id)

# Aspirating
ot_api.lh.aspirate(labware_id=labware_id, well_name="A1", pipette_id=left_pipette_id,
                   flow_rate=10, volume=10)

# Dispensing
ot_api.lh.dispense(labware_id=labware_id, well_name="A1", pipette_id=left_pipette_id,
                   flow_rate=10, volume=10)

# Tip drop
ot_api.lh.drop_tip(labware_id=labware_id, well_name="A1", pipette_id=left_pipette_id)

Note: the ot_api is blocking!

Notice

This project is not affiliated with Opentrons.

This project is created for the Sculpting Evolution group at the MIT Media Lab.

See LICENSE

Release files for opentrons-http-api-client 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for opentrons-http-api-client 0.2.1
File Size Uploaded
opentrons_http_api_client-0.2.1.tar.gz 6.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for opentrons-http-api-client 0.2.1
File Interpreter ABI Platform
opentrons_http_api_client-0.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 15.3 kB

Release files / opentrons_http_api_client-0.2.1.tar.gz

Download URL opentrons_http_api_client-0.2.1.tar.gz
Size 6.7 kB
Tags Source
SHA-256 checksum
How to use checksums
f57eac74eefcb9a7525149c112e194121e35bd7f7e3ae05fe377bc2756d38200
BLAKE2b-256 checksum
How to use checksums
54616ebba258f7cd3f540f823293a77c6cafb33ce5fc744954d7b65257ed7b00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.23

Release files / opentrons_http_api_client-0.2.1-py3-none-any.whl

Download URL opentrons_http_api_client-0.2.1-py3-none-any.whl
Size 8.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0d17ed0088c0dc9a71c7c264f893b138e92facc4b8647d26dc28dc4bcee0ee35
BLAKE2b-256 checksum
How to use checksums
9abc60c3459523bb2512cccadc94ef3a46b20283b7984b2594b0bdb848a2b02e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.9.23

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.6

2 release files

0.1.5

1 release file

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page