Skip to main content

The Logichub Integration SDK

Project description

lhub_integ

Python package to shim basic scripts to work with integration machinery. An example script is available in /lhub_integ/tests/test_integration/main.py This package requires Python 3.7:

brew install pyenv
pyenv install 3.7.1
pyenv init # Follow the instructions
pyenv local 3.7.1
# Make sure this says "3.7.1"
python --version

Usage (as an integration writer)

To write a Python script that is convertible into an integration:

  1. Create a directory that will contain your integration
  2. Install lhub_integ as a local package: pip install lh_integration
  3. Copy main.py from the tests folder into your integration and modify as desired.

Python scripts must provide an entrypoint function with some number of arguments. These arguments will correspond to columns in the input data. The function should return a Python dictionary that can be serialized to JSON

def process(url, num_bytes: int):
  return {'output': url + 'hello'}

Dev Installation

# Get Python 3
brew install python
brew install pipenv
pipenv install
pipenv shell

Test the package installer

pipenv install -e .

Run tests

pytest

Deploying changes to lhub_integ & custom integrations

  1. Make changes. Verify that the tests pass and that you can build the image locally (do not push the image from your laptop)
  2. Get your changes merged to master. CircleCI will build an image. It will be unused at this point because nothing points to latest.
  3. Go to https://hub.docker.com/r/logichub/integrations-custom/tags/ and find that latest tag that contains the results of building your image. Update ConfigProperties.IntegrationsCustomImageTag and make any code updates required.

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

lhub_integ-0.1.0.tar.gz (8.5 kB view hashes)

Uploaded Source

Built Distribution

lhub_integ-0.1.0-py3-none-any.whl (22.5 kB view hashes)

Uploaded Python 3

Supported by

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