Skip to main content

CONTACT Logo Functions-SDK for Python

This SDK provides the csfunctions library for developing Functions with Python.

Functions are deeply integrated in the CIM Database Cloud Webhooks technology. They are designed to work seamlessly together. The goal is to allow implementing custom business logic in a CIM Database Cloud SaaS application without leaving the CONTACT Cloud and without the need to create and maintain a separate infrastructure.

Documentation: https://cslab.github.io/functions-sdk-python/

Source code: https://github.com/cslab/functions-sdk-python

Requirements

Python 3.10+

csfunctions is built with Pydantic 2

Installation

Install using pip:

pip install contactsoftware-functions

Usage

Build the Function

Folder content of a minimal example for a Function implementation:

  my_example_functions/
  ├── environment.yaml
  ├── mymodule.py
  └── requirements.txt

Code for a Function:

import requests
import json

from csfunctions import MetaData, Service
from csfunctions.events import DocumentReleaseEvent

def send_doc_to_erp(metadata: MetaData, event: DocumentReleaseEvent, service: Service):
  # iterate over the documents contained in the event
  for document in event.data.documents:
    # create the payload for our (fictional ERP system)
    payload = json.dumps({
      "document_number": document.z_nummer,
      "document_index": document.z_index,
      "document_title": document.titel
    })
    res = requests.post("https://example.com", data=payload)
    if res.status_code != 200:
      return ValueError(f"Failed to upload document to ERP. Got response code {res.status_code}")

Environment file to define runtime and Function entrypoints:

runtime: python3.10
version: v1
functions:
  - name: send_doc_to_erp
    entrypoint: mymodule.send_doc_to_erp

Define requirements:

contactsoftware-functions

Deploy the Code

To deploy the Code you first need to install the contactsoftware-functions-client and retrieve developer credentials in the CONTACT Portal.

Install client:

pip install contactsoftware-functions-client

Login:

cfc login

Create a new environment:

cfc env create myenv

Upload code into new environment:

cfc env deploy myenv

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

contactsoftware_functions-0.26.0.tar.gz (290.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

contactsoftware_functions-0.26.0-py3-none-any.whl (49.2 kB view details)

Uploaded Python 3

File details

Details for the file contactsoftware_functions-0.26.0.tar.gz.

File metadata

  • Download URL: contactsoftware_functions-0.26.0.tar.gz
  • Upload date:
  • Size: 290.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for contactsoftware_functions-0.26.0.tar.gz
Algorithm Hash digest
SHA256 00b87a8b42918bfb18327c4bb7d40b59b80d7b1020b57a8566a579755ac1d08d
MD5 267480359903cc33180b9a94b03c5190
BLAKE2b-256 dc84800c36038d0990cdf9b239d93dd7478b7983f4ab7ff82cb5414b2cd5ed63

See more details on using hashes here.

File details

Details for the file contactsoftware_functions-0.26.0-py3-none-any.whl.

File metadata

  • Download URL: contactsoftware_functions-0.26.0-py3-none-any.whl
  • Upload date:
  • Size: 49.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.28 {"installer":{"name":"uv","version":"0.11.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for contactsoftware_functions-0.26.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ffd932edacee2fadb65c18903a6c607b12029ffd0c5be615eb84779ad2540609
MD5 e3ffabae2c72e2c2b718e7465851515b
BLAKE2b-256 9d4e9dfa2d1fd82f3a285a7131ebd2de3e856cbb693af276db9c737c9b71f588

See more details on using hashes here.

Release history Release notifications | RSS feed

0.28.0

2 files

0.27.0

2 files

This release

0.26.0 This release

2 files

0.25.0

2 files

0.24.0

2 files

0.23.0

2 files

0.22.0

2 files

0.21.0

2 files

0.20.0

2 files

0.19.0

2 files

0.18.1

2 files

0.18.0

2 files

0.17.0

2 files

0.16.0

2 files

0.15.0

2 files

0.14.0

2 files

0.13.1

2 files

0.13.0

2 files

0.12.0

2 files

0.11.1

2 files

0.11.0

2 files

0.10.0

2 files

0.9.0

2 files

0.8.4

2 files

0.8.3

2 files

0.8.2

2 files

0.8.1

2 files

0.8.0

2 files

0.7.2

2 files

0.7.1

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.2

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page