Data level integration for services built atop of Modular Framework
Project description
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.tomlis 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:
- 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 specifyingmodular_mongo_user,modular_mongo_password,
modular_mongo_url, andmodular_mongo_srv, you can use:
modular_mongo_uri:$MONGO_URI# Format:mongodb+srv://<USER>:<PASSWORD>@<URL>/ - SaaS, DynamoDB (cross-account access):
modular_service_mode:saas# Optional
modular_assume_role_arn:$ASSUME_ROLE_ARN - 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file modular_sdk-7.1.8.tar.gz.
File metadata
- Download URL: modular_sdk-7.1.8.tar.gz
- Upload date:
- Size: 81.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69dbcc474f9ec631f611cc42e12eda946e8de8904c3dcf7974580c634d298839
|
|
| MD5 |
3e66aecb4796e01dd61cf36d33d8b84a
|
|
| BLAKE2b-256 |
da8d86fca4564659f9083229ded38bc789ba253af80f3b13c0c7f2233711ec90
|
Provenance
The following attestation bundles were made for modular_sdk-7.1.8.tar.gz:
Publisher:
pypi-package.yml on epam/modular-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
modular_sdk-7.1.8.tar.gz -
Subject digest:
69dbcc474f9ec631f611cc42e12eda946e8de8904c3dcf7974580c634d298839 - Sigstore transparency entry: 872170905
- Sigstore integration time:
-
Permalink:
epam/modular-sdk@91c466e1fa70345b4e764039e3124370f1f5423c -
Branch / Tag:
refs/tags/7.1.8 - Owner: https://github.com/epam
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-package.yml@91c466e1fa70345b4e764039e3124370f1f5423c -
Trigger Event:
release
-
Statement type:
File details
Details for the file modular_sdk-7.1.8-py3-none-any.whl.
File metadata
- Download URL: modular_sdk-7.1.8-py3-none-any.whl
- Upload date:
- Size: 102.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2094a56289777c2edfebadf4d1573dab970c5a2f33489f5f380bc31143f89744
|
|
| MD5 |
9d27478543cb285fb4f094c6f347c576
|
|
| BLAKE2b-256 |
672615c7991fe0f9ecd0e2dcad4aa4cb1a5f2df498b4d61455016e13ac135e7b
|
Provenance
The following attestation bundles were made for modular_sdk-7.1.8-py3-none-any.whl:
Publisher:
pypi-package.yml on epam/modular-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
modular_sdk-7.1.8-py3-none-any.whl -
Subject digest:
2094a56289777c2edfebadf4d1573dab970c5a2f33489f5f380bc31143f89744 - Sigstore transparency entry: 872170908
- Sigstore integration time:
-
Permalink:
epam/modular-sdk@91c466e1fa70345b4e764039e3124370f1f5423c -
Branch / Tag:
refs/tags/7.1.8 - Owner: https://github.com/epam
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-package.yml@91c466e1fa70345b4e764039e3124370f1f5423c -
Trigger Event:
release
-
Statement type: