ENPICOM Logo API Docs Python SDK Docs Events

enpi_api

Welcome to the ENPICOM API Python SDK documentation

What is the ENPICOM API Python SDK

The ENPICOM API Software Development Kit (SDK), is a documented Python library designed to help you integrate and automate the capabilities of the ENPICOM Platform.

You can use it to do things like upload files, upload and download collections, add metadata as tags, and run apps like Sequence Annotation. All through Python scripts.

How to use the documentation

If this your first time using our SDK, you should begin with the Getting started section of this page. There you will find instructions on how to install the SDK and learn how authentication is handled.

In this page there are also code snippets with common use cases that will help you build your scripts. You can find those in the Common use cases section.

If you are looking to understand what a specific component of the library does you can search for it in search bar. Most classes and methods have an explanation of they do, their arguments and what do they return as well as an example of how to use them. The search bar can be useful to find functionality you need as well. For example searching for delete collection will show you the CollectionApi.delete_collection_by_id that can be used to delete collections.

Getting started

To start using the ENPICOM API SDK you need 2 things:

  1. Python version 3.11 or above installed on your device.
  2. A valid API Key - provided by ENPICOM

If you don't have an API key, please contact support at mailto:customersupport@enpicom.com

Installing the ENPICOM API SDK

The latest stable version is available in the Python Package Index (PyPI) here: https://pypi.org/project/enpicom-sdk/ and can be installed using

pip install enpicom-sdk

If you are using a Python environment that uses something other than pip to install packages, refer to the documentation of your environment to find out how to install packages from PyPI.

Dependencies

The ENPICOM SDK comes with some common dependencies such as pandas and jupyter already built in. You can check exactly which dependencies and respective versions by running: pip freeze after installing.

How to authenticate

The most convenient way to authenticate is using the EnpiApiClient() context manager. It fetches your API key from the environment variable ENPI_API_KEY and then uses it to authenticate any commands executed within that context.

  1. Add the API KEY to your environment variables:

    • Windows: You should refer to the official documentation to set your environment variables here and here. However, here is an example of a possible approach to permanently set the ENPI_API_KEY on your user environment.

      SetX ENPI_API_KEY <your-api-key>
      
    • MacOS and Linux: Note: Depending which shell you are using you might need to access a different configuration file. Here we assume you are using ZSH, as it is the default for MacOS. You can see which shell (ZSH, BASH, etc. ) you are using by typing $SHELL in your terminal and pressing enter.

      You can set an environment variable by adding it to your ~/.zshrc file (for BASH use file: ~/.bash-profile instead).

      1. Open your ~/.zshrc file in your editor of choice.
      2. Add the following line at the end of the file:

        export ENPI_API_KEY=<your-api-key>
        
      3. Save the changes.

      4. Execute the file to load the new variable:

        source ~/.zshrc
        
  2. Now you should be able to import the EnpiApiClient to your Python project and use it as a context manager with EnpiApiClient() as client: to authenticate. As an example, the following Python code should run without any errors:

    from enpi_api.l2.client.enpi_api_client import EnpiApiClient
    
    with EnpiApiClient() as enpi_client:
        print("I am connected to the ENPICOM API!")
    

The verbosity of the SDK can set either with an environment variable LOG_LEVEL or passed as an argument. Debug is the default log level. The following example show how to set it with an argument:

from enpi_api.l2.client.enpi_api_client import EnpiApiClient
from enpi_api.l2.types.log import LogLevel

with EnpiApiClient(log_level=LogLevel.Error) as enpi_client:
    print("I am connected to the ENPICOM API!")

In the example above the log level has been set to LogLevel.Error this means all warning, info and debug level output will be suppressed.

Further use

The ENPICOM API SDK provides building blocks for your scripts which are located in the enpi_api.l2 module.

System tags

The ENPICOM Platform includes pre-defined system tags. See the following page for the complete list and SDK usage instructions: https://api.igx.bio/public-api/v1/public/docs/python_sdk/enpi_api/l2/tags.html

Examples

There are various examples documented on the following examples page which can be found here.

1"""
2.. include:: ./welcome.md
3"""