Skip to main content

Basic Integration Platform

Project description

Basic Integration Platform

PyPI PyPI - License PyPI - Python Version

logo-192

Provides a platform for automation with code-first approach, with embedded batteries:

  • Tracing (journals)
  • Internal and user-defined API
  • Ultra-light but rich mobile-first UI
  • Embedded key-value storage

It is heavily inspired by node-red and aims to provide same enjoyment during development but without mess of nodes and connections for tasks a little bit more complicated than just hello world.

The platform also tries to be easy in deployment and maintaining. Code could be stored in a SCM (ex: git) and persistent storage is just a single file that could be backed up and restored trivially.

Because memory and CPU consumption relatively low a solution based on the platform could be launched even on Raspberry Pi Zero with 512MB RAM.

Install

pip install binp uvicorn

Example:

from random import randint

from binp import BINP

binp = BINP()


@binp.app.post('/random', response_model=int)
@binp.journal
async def generate_random():
    """
    Generate random number in range 0 ... 1024
    """
    return randint(0, 1024)


@binp.action
@binp.journal
async def currency_rate():
    """
    Fetch currency rate for EUR -> USD
    """
    # go to external service
    euro = 1.3
    await binp.journal.record('rates fetched', base_currency='USD', euro=euro)

Save as 'example.py' and run it by

uvicorn example:binp.app

TIP: pass --reload flag to uvicorn to support automatic reload during development

It will expose

Peek 2021-02-08 17-27

image

Configuration

Default configuration can be changed by environment variables:

  • DEV - set DEV=true to enable development mode
  • DB_URL - database SQLITE URL, default sqlite:///data.db

HTTP port and binding address configured by uvicorn:

  • --port - set listening port, default 8000
  • --host - set binding host, default 127.0.0.1

For uvicorn command should be like

uvicorn <python file without .py>:<binp instance>.app

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

binp-0.0.4.tar.gz (128.9 kB view details)

Uploaded Source

Built Distribution

binp-0.0.4-py3-none-any.whl (130.8 kB view details)

Uploaded Python 3

File details

Details for the file binp-0.0.4.tar.gz.

File metadata

  • Download URL: binp-0.0.4.tar.gz
  • Upload date:
  • Size: 128.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

File hashes

Hashes for binp-0.0.4.tar.gz
Algorithm Hash digest
SHA256 7ca851c0d5e5926fec1527522b98d124e7e3d898b541b2740624b3968fd330ca
MD5 e48e3e2af66499e8e08271da05cd1a49
BLAKE2b-256 45ef715bfc61f720f26f77f08e7600b5f0ce1352a587d6d61277f6ead8287295

See more details on using hashes here.

File details

Details for the file binp-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: binp-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 130.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.7

File hashes

Hashes for binp-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 45cc61ee9b985584dfd8a5a90a4edf744bbe2346ca46eab0b0b22b4a66487db4
MD5 86b04bae2a92291fab1123f0bb816f6c
BLAKE2b-256 cccf8addc01b1879e5c7b863caa920b4ea23ec45fbdd1bdb2500c66762204a08

See more details on using hashes here.

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