Metadata-Version: 2.1
Name: autoprotocol
Version: 9.1.0
Summary: Python library for generating Autoprotocol
Home-page: https://github.com/autoprotocol/autoprotocol-python
Maintainer: The Autoprotocol Development Team
Maintainer-email: support@strateos.com
License: BSD
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: Unix
Classifier: Programming Language :: Python
Classifier: Topic :: Scientific/Engineering
Classifier: Topic :: Software Development
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Requires-Python: >=3.7
Description-Content-Type: text/x-rst
License-File: LICENSE.rst
License-File: AUTHORS.rst
Requires-Dist: Pint (==0.9)
Provides-Extra: docs
Requires-Dist: jinja2 (==3.0.0) ; extra == 'docs'
Requires-Dist: releases (<2,>=1.6.3) ; extra == 'docs'
Requires-Dist: sphinx (==4.2.0) ; extra == 'docs'
Requires-Dist: sphinx-rtd-theme (==1.0.0) ; extra == 'docs'
Requires-Dist: readthedocs-sphinx-search (==0.1.1) ; extra == 'docs'
Requires-Dist: semantic-version (==2.6.0) ; extra == 'docs'
Requires-Dist: six (<2,>=1.15.0) ; extra == 'docs'
Requires-Dist: click (==8.0.2) ; extra == 'docs'
Requires-Dist: black (==22.3.0) ; extra == 'docs'
Provides-Extra: test
Requires-Dist: coverage (<7,>=6) ; extra == 'test'
Requires-Dist: pre-commit (<3,>=2.4) ; extra == 'test'
Requires-Dist: pylint (==2.5.2) ; extra == 'test'
Requires-Dist: pytest (<7,>=6.2.5) ; extra == 'test'
Requires-Dist: pytest-cov (<4,>=3.0.0) ; extra == 'test'
Requires-Dist: tox (<4,>=3.15) ; extra == 'test'

=============================
 Autoprotocol Python Library
=============================

.. image:: https://img.shields.io/pypi/v/autoprotocol.svg?maxAge=86400
   :target: https://pypi.python.org/pypi/autoprotocol
   :alt: PyPI Version

.. image:: https://github.com/autoprotocol/autoprotocol-python/workflows/CI/badge.svg?branch=master
   :target: https://github.com/autoprotocol/autoprotocol-python/actions?query=workflow%3ACI+branch%3Amaster
   :alt: Build Status

.. image:: https://codecov.io/gh/autoprotocol/autoprotocol-python/branch/master/graph/badge.svg
   :target: https://codecov.io/gh/autoprotocol/autoprotocol-python
   :alt: Code Coverage

.. image:: https://img.shields.io/pypi/dm/autoprotocol?logo=pypi
   :target: https://autoprotocol-python.readthedocs.io
   :alt: PyPI - Downloads

.. image:: https://badges.gitter.im/autoprotocol/autoprotocol-python.svg
   :target: https://gitter.im/autoprotocol/autoprotocol-python?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge
   :alt: Gitter Chat


Autoprotocol_ is the standard way to express experiments in life science. This repository contains a python library for generating Autoprotocol.

Installation
------------

To work from the latest stable release:

.. code-block:: bash

    pip install autoprotocol

check the the releases_ for more information about the changes that will be downloaded.

Alternatively to get more up-to-date features:

.. code-block:: bash

    git clone https://github.com/autoprotocol/autoprotocol-python
    cd autoprotocol-python
    python setup.py install

check the changelog_ for information about features included on `master` but not yet released.

Building a Protocol
-------------------

A basic protocol is written by declaring :code:`Protocol.ref` objects and acting on them with :code:`Protocol.instruction` methods.

.. code-block:: python

    import json
    from autoprotocol.protocol import Protocol

    # instantiate a protocol object
    p = Protocol()

    # generate a ref
    # specify where it comes from and how it should be handled when the Protocol is done
    plate = p.ref("test pcr plate", id=None, cont_type="96-pcr", discard=True)

    # generate seal and spin instructions that act on the ref
    # some parameters are explicitly specified and others are left to vendor defaults
    p.seal(
        ref=plate,
        type="foil",
        mode="thermal",
        temperature="165:celsius",
        duration="1.5:seconds"
    )
    p.spin(
        ref=plate,
        acceleration="1000:g",
        duration="1:minute"
    )

    # serialize the protocol as Autoprotocol JSON
    print(json.dumps(p.as_dict(), indent=2))

which prints

.. code-block:: json

    {
      "instructions": [
        {
          "op": "seal",
          "object": "test pcr plate",
          "type": "foil",
          "mode": "thermal",
          "mode_params": {
            "temperature": "165:celsius",
            "duration": "1.5:second"
          }
        },
        {
          "op": "spin",
          "object": "test pcr plate",
          "acceleration": "1000:g",
          "duration": "1:minute"
        }
      ],
      "refs": {
        "test pcr plate": {
          "new": "96-pcr",
          "discard": true
        }
      }
    }

Extras
------

Select SublimeText snippets are included with this repository.
To use them copy the :code:`autoprotocol-python SublimeText Snippet` folder to your local Sublime :code:`/Packages/User` directory.

Documentation
-------------

For more information, see the documentation_.

Contributing
------------

For more information, see CONTRIBUTING_.

.. _Autoprotocol: http://www.autoprotocol.org
.. _releases: http://github.com/autoprotocol/autoprotocol-python/releases
.. _changelog: http://autoprotocol-python.readthedocs.io/en/latest/changelog.html
.. _CONTRIBUTING: http://autoprotocol-python.readthedocs.io/en/latest/CONTRIBUTING.html
.. _documentation: http://autoprotocol-python.readthedocs.org/en/latest/
