Skip to main content

SDK library for building services for the IVCAP platform

Project description

ivcap_sdk_service

SDK library for building services for the IVCAP platform

Installation

pip install ivcap_sdk_service

Usage

Below is the obligatory hello world service which simply writes a few messages to logging.

from ivcap_sdk_service import Service, ServiceArgs, Parameter, PythonWorkflow, Type, register_service
import logging

SERVICE = Service(
    name = "Hello World",
    description = "Simple service which does a few simple things",
    parameters = [
        Parameter(name="msg", type=Type.STRING, description="Message to echo"),
        Parameter(name="times", type=Type.INT, default=2, description="Times to repeat"),
    ],
    workflow = PythonWorkflow(min_memory='2Gi', min_cpu='500m', min_ephemeral_storage='4Gi'),
)

def hello_world(args: ServiceArgs, logger: logging):
    for i in range(args.times):
        logger.info(f"({i + 1}) Hello {args.msg}")

register_service(SERVICE, hello_world)

For more useful examples see the examples directory or for a git repo which could work as a starting point, check out ivcap-python-service-example and ivcap-python-service-example-collection.

API Documentation

The auto-generated API docs can be found here.

Contributing

Interested in contributing? Check out the contributing guidelines. Please note that this project is released with a Code of Conduct. By contributing to this project, you agree to abide by its terms.

License

ivcap_sdk_service was initially created by Max Ott max.ott@csiro.au, Tim Erwin tim.erwin@csiro.au with additional contributions from Ben Clews ben.clews@csiro.au" and "John Zhang j.zhang@csiro.au". See LICENSE for licensing terms.

Credits

ivcap_sdk_service was created with cookiecutter and the py-pkgs-cookiecutter template.

Development

Setup with Conda

To use conda to create a virtual python environment named ivcap_service:

conda create --name ivcap_service python=3.9 -y
conda activate ivcap_service
pip install poetry

Setup with Nix Flakes

Alternatively, if you'd like to use Nix Flakes for your virtual environment, run:

nix develop

To use direnv to automatically load the development environment when you enter the ivcap-service-sdk-python directory, run:

direnv allow

Adding dependencies

For testing:

poetry add --group dev _lib_name_

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

ivcap_sdk_service-0.8.0.tar.gz (36.3 kB view details)

Uploaded Source

Built Distribution

ivcap_sdk_service-0.8.0-py3-none-any.whl (49.9 kB view details)

Uploaded Python 3

File details

Details for the file ivcap_sdk_service-0.8.0.tar.gz.

File metadata

  • Download URL: ivcap_sdk_service-0.8.0.tar.gz
  • Upload date:
  • Size: 36.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.9.16 Darwin/23.4.0

File hashes

Hashes for ivcap_sdk_service-0.8.0.tar.gz
Algorithm Hash digest
SHA256 dc3d082513ca3e69f59a9c45b046d7897e9aa6bddd8f7f7e3532821793a964fe
MD5 ccb34cc2bd286d20e870370e2f597aa1
BLAKE2b-256 0d71b53451ef9681487f3370d6080479c8781da584ac1e02f4318ee459d3e54c

See more details on using hashes here.

File details

Details for the file ivcap_sdk_service-0.8.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ivcap_sdk_service-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 87ae0b96cba1e2b085e020b08f5d8ac19483c851a61111eabc23eec0a309397c
MD5 0b1fa2b043b66e8036492314011b3142
BLAKE2b-256 06994591fde2487690f1a8f536f97db8f5f87dba3c7ed38b1fa1a92e6c026496

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