SDK for creating and registering custom Orrin apps
Project description
Orrin SDK v0.0.13
The Orrin SDK v0.x.x series represents the initial iterations of the Orrin SDK. It brings forth a simple Python decorator for developers creating small-scale apps to be deployed on the Orrin platform.
Orrin SDK serves as the bridge between backend logic and UI manipulation.
Architecture: Why Python & Node.js?
The Orrin stack utilizes a hybrid approach for maximum efficiency and flexibility:
- Python (Backend): Used for its simplicity and broad compatibility.
- Node.js (Frontend): Used for flexibility and compatibility with the Orrin Web platform, which is also based on Node.js. Sustaining a unified stack for the web platform ensures seamless integration.
Orrin SDK Actions
The current version offers a primary decorator: action. This is placed on top of any function intended to be used by your frontend code to perform activities or manipulate the UI.
Signature
@action(name: str, required_payload: list = [], extra_metadata: dict = {})
Arguments
| Argument | Type | Description |
|---|---|---|
name |
str |
Required. This must explicitly match the function name. |
required_payload |
list |
A list of dictionaries defining arguments passed to the function. |
extra_metadata |
dict |
Optional dictionary for additional context. |
1. The name Argument
When uploading the backend, the server stores a copy of the code (excluding SDK configurations) and maps actions to specific functions using this name.
Warning: The
namein the decorator must match the function definition exactly. If there is a mismatch, the server will throw a 500 Internal Error when the frontend attempts to call the action, as it will fail to locate the entry point.
2. The required_payload Argument
If your function requires arguments, you must specify them here. This is an array of dictionaries containing the argument's name and expected type.
Structure:
{
"name": "<argument_name>",
"type": "<argument_type>"
}
<argument_name>: The literal argument name used in the Python function.<argument_type>: The required Python type (e.g.,int,str).- Note: You may set the type to
"any"if the argument is not restricted to a specific type.
- Note: You may set the type to
Example Payload:
For a function def my_func(arg: int):, the payload configuration would be:
[{"name": "arg", "type": "int"}]
Implementation Example
Below is a complete example of the SDK in action.
from sdk import OrrinSDK
# Initialize the SDK
orrin_sdk = OrrinSDK(
developer_api_key='<your_developer_api_key>', # Required
app_name='ATestApp', # Required
desc='A test app built for the Orrin platform!' # Required metadata
)
# Standard helper function (Not accessible directly by UI)
def lol():
return 'You can use non-action based functions inside action-based functions!'
# Action function (Accessible by UI)
@orrin_sdk.action('test', required_payload=[{"name": "a", "type": "any"}])
def test(a):
return {'message': f'test done! {a}'}
# Finalizes configuration and requests app backend creation
orrin_sdk.finalize()
Important Implementation Notes:
- Do not forget
.finalize(): This must be called at the end of your script.- Naming Conventions: App names must not contain spaces. The server will reject backend uploads if the app name violates this rule.
Using the Action in UI
Once deployed, you can utilize this action via the Node.js-based frontend SDK. The result returned from the Python function (test) can be used to determine how to manipulate your UI.
Extra Metadata
An elaborate developer platform is in development to provide direct access to data regarding your apps. To support this, you may need to attach additional metadata to your actions, particularly as your backend grows.
Note: Please keep apps small-scale; Orrin is not intended for massive social media clones.
Example with Metadata:
from sdk import OrrinSDK
orrin_sdk = OrrinSDK(
developer_api_key='<your_developer_api_key>',
app_name='ATestApp',
desc='A test app built for the Orrin platform!'
)
@orrin_sdk.action(
'test',
required_payload=[{"name": "a", "type": "any"}],
# Add any dictionary data here to help you understand the action later
extra_metadata={'reason': 'This action is a test. Do not use in production!'}
)
def test(a):
return {'message': f'test done! {a}'}
orrin_sdk.finalize()
There is no limit or schema requirement for extra_metadata. Use it as needed to document your code.
Registration and Deployment
1. Run Your Script
You must run your Python script locally to register the actions and upload the backend code.
- If you have no functions decorated with
@action, your codebase is considered "dead" (unusable on the platform). - Such submissions will be marked as DENIED upon review, and you will be required to resubmit with correct configurations.
2. Review Process
After .finalize() runs:
- Your backend status becomes PENDING.
- The review process can take up to 3 days.
- Final states are either AUTHORIZED or DENIED.
For more details, refer to: https://stellr-company.com/orrin/sdk
App Status & Policy
When you submit a backend, an application is created on the server.
- Dependencies: A frontend cannot exist without an associated backend.
- Review: The app undergoes a full review only after both backend and frontend are submitted.
Policy Enforcement
If an app is found to be deceptive, abusive, discriminatory, or in violation of any Stellr company policy:
- It will be removed from the review queue.
- It will be archived.
- Archived applications cannot be resubmitted.
Warning: Attempting to bypass enforcement by re-uploading an archived application under a different name may result in the revocation of your developer API key and loss of platform access.
Status Lifecycle
There are 4 possible statuses for an application:
- NOT_LIVE
- IN_REVIEW
- LIVE
- DELETED
Transitions:
- Submission: When Stellr begins reviewing your app, the status updates to IN_REVIEW.
- Rejection/Issues: If issues require attention, the status reverts to NOT_LIVE.
- Approval: Upon approval, the status updates to LIVE.
- Marketplace Removal: You may voluntarily switch an app from LIVE to NOT_LIVE to remove it from the public marketplace.
Note: Switching an app from LIVE back to NOT_LIVE may subject the app to a new review process before it can go live again.
New versions of Orrin SDK are in the works.
Please see https://stellr-company.com/orrin/sdk/license for the Proprietary License for this package.
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 orrin_sdk-0.0.14.tar.gz.
File metadata
- Download URL: orrin_sdk-0.0.14.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59bbcfd993d67fb1437c631c53c4ae793345cf4b35b96953a1d85c967bd304d3
|
|
| MD5 |
fe66a6077cdbe4bbb05e13b73e9801c7
|
|
| BLAKE2b-256 |
b218baefc045f9f53490116ea53cce93476a287c6b974f72257ca2aa563b024b
|
File details
Details for the file orrin_sdk-0.0.14-py3-none-any.whl.
File metadata
- Download URL: orrin_sdk-0.0.14-py3-none-any.whl
- Upload date:
- Size: 9.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bb9aaf3a4d1380ffedb0772fc622ab6c572eaa4ca517c2ac6874412b5ae9b2ad
|
|
| MD5 |
f9edc00ce64bdabb365cbb9223133979
|
|
| BLAKE2b-256 |
17880b867f6048ee93624862c838943e794d3b1ce8e373186945a29f0706f9bd
|