Skip to main content

Data level integration for services built atop of Modular Framework

Project description

License

PyPI - Version PyPI - Python Version

Modular SDK

You use Modular SDK to create, configure, and manage common entities, such as:

  • Customers;
  • Tenants;
  • TenantSettings;
  • Regions;
  • Applications;
  • Parents;

Prerequisites

  • Python 3.10+ required

Building distribution archives

  • Make sure you have the latest version of PyPA’s build installed: python3 -m pip install --upgrade build
  • Run the command form the same directory where pyptoject.toml is located: python3 -m build
  • This command should output a lot of text and once completed should generate two files in the dist directory:
dist/
    modular_sdk-{version}.tar.gz
    modular_sdk-{version}-py3-none-any.whl

Installation

  • pip install modular-sdk

Usage

To use Modular SDK, you must import, configure and indicate which service or services you're going to use:

from modular_sdk.modular import Modular

modular_sdk = Modular()

parent_service = modular_sdk.parent_service()
tenant_service = modular_sdk.tenant_service()

For services that aren't tied to the service_mode configuration, you can use ModularServiceProvider:

from modular_sdk.modular import ModularServiceProvider

modular_sdk = ModularServiceProvider()

thread_local_storage_service = modular_sdk.thread_local_storage_service()

For now, Modular provides 3 ways of DB access. Depends on the way of database connection, different sets of env variables must be set:

  1. Onprem, Mongodb:
    modular_service_mode: docker,
    modular_mongo_user: $MONGO_USER,
    modular_mongo_password: $MONGO_PASSWORD,
    modular_mongo_url: $MONGO_URL,
    modular_mongo_db_name: $MONGO_DB_NAME,
    modular_mongo_srv: True, # Optional
    Alternatively, instead of specifying modular_mongo_user, modular_mongo_password,
    modular_mongo_url, and modular_mongo_srv, you can use:
    modular_mongo_uri: $MONGO_URI # Format: mongodb+srv://<USER>:<PASSWORD>@<URL>/
  2. SaaS, DynamoDB (cross-account access):
    modular_service_mode: saas # Optional
    modular_assume_role_arn: $ASSUME_ROLE_ARN
  3. SAAS, DynamoDB (same AWS account):
    modular_service_mode: saas # Optional

Alternatively, you can pass these parameters (fully or partially) on initialization:

from modular_sdk.modular import Modular

modular_sdk = Modular(modular_service_mode='docker',
                      modular_mongo_user='MONGO_USER',
                      modular_mongo_password='MONGO_PASSWORD',
                      modular_mongo_url='MONGO_URL',
                      modular_mongo_db_name='DB_NAME')

# initialize some services
application_service = modular_sdk.application_service()
parent_service = modular_sdk.parent_service()

More examples

Example 1: List Maestro Customers

from modular_sdk.modular import Modular

# initializing application service
customer_service = Modular().customer_service()

# listing available customers 
customers = customer_service.list()

# printing customer names
for customer in customers:
   print(customer.name)

Example 2: Update Maestro Application

from modular_sdk.modular import Modular

# initializing application service
application_service = Modular().application_service()

# extracting application by id
application = application_service.get_application_by_id(
   application_id="$APP_ID")

# updating application description
description_to_set = 'Updated application description'
application_service.update(application=application,
                           description=description_to_set)

# saving updated application
application_service.save(application=application)

Example 3: Delete Maestro Parent

from modular_sdk.modular import Modular

# initializing parent service
parent_service = Modular().parent_service()

# extracting parent by id
parent = parent_service.get_parent_by_id(parent_id="$PARENT_ID")

# deleting parent
parent_service.mark_deleted(parent=parent)

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

modular_sdk-7.1.11.tar.gz (81.7 kB view details)

Uploaded Source

Built Distribution

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

modular_sdk-7.1.11-py3-none-any.whl (102.5 kB view details)

Uploaded Python 3

File details

Details for the file modular_sdk-7.1.11.tar.gz.

File metadata

  • Download URL: modular_sdk-7.1.11.tar.gz
  • Upload date:
  • Size: 81.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for modular_sdk-7.1.11.tar.gz
Algorithm Hash digest
SHA256 4aa041db19444039c9f7b458f3d1f3bcdabf879d2bbb9649cf605b634a39864c
MD5 f3018c7354a2df33bf45a30f3745137a
BLAKE2b-256 e79f6284c8747976e10bc2c586e141f05bc93de636db4f89bacced447b8074c6

See more details on using hashes here.

Provenance

The following attestation bundles were made for modular_sdk-7.1.11.tar.gz:

Publisher: pypi-package.yml on epam/modular-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file modular_sdk-7.1.11-py3-none-any.whl.

File metadata

  • Download URL: modular_sdk-7.1.11-py3-none-any.whl
  • Upload date:
  • Size: 102.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for modular_sdk-7.1.11-py3-none-any.whl
Algorithm Hash digest
SHA256 622c35d5f1424b3545ddb6de3bd574adcd76a0c6381b6ed805709492b70377d2
MD5 84326784c6294944a8fbbb5d84941125
BLAKE2b-256 dbc98ee4592b0b656503800f391d0479e647fef22fe19a1c7d99d61f9f080cfa

See more details on using hashes here.

Provenance

The following attestation bundles were made for modular_sdk-7.1.11-py3-none-any.whl:

Publisher: pypi-package.yml on epam/modular-sdk

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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