orrin-sdk 0.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ Metadata-Version: 2.4
2
+ Name: orrin-sdk
3
+ Version: 0.0.1
4
+ Summary: Orrin SDK for developers
5
+ Requires-Python: >=3.9
6
+ Dynamic: requires-python
7
+ Dynamic: summary
@@ -0,0 +1,6 @@
1
+ sdk/__init__.py,sha256=Px3OgzcJIDznC12g24vZWdZmBFjgWiN6Y-159t6uiv8,32
2
+ sdk/decorators.py,sha256=863AmnjmUXMSH34S07tmPBJ_dPYxeBOpcBzj9qCO5T0,1438
3
+ orrin_sdk-0.0.1.dist-info/METADATA,sha256=Fxi72bTJ9HgQLPPwyn2yKcuIsM8PQB53Dm0PgCDyNH8,152
4
+ orrin_sdk-0.0.1.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
5
+ orrin_sdk-0.0.1.dist-info/top_level.txt,sha256=JuXS55gRP3EzGKmJgbLfVfUolO3cM_u69k3qvutnBuw,4
6
+ orrin_sdk-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (80.9.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1 @@
1
+ sdk
sdk/__init__.py ADDED
@@ -0,0 +1 @@
1
+ from .decorators import OrrinSDK
sdk/decorators.py ADDED
@@ -0,0 +1,43 @@
1
+ import inspect
2
+ import requests
3
+
4
+ API_BASE = "https://stellr-company.com"
5
+ _registered_actions = set()
6
+
7
+ class OrrinSDK:
8
+ def __init__(self, developer_api_key: str):
9
+ self.developer_api_key = developer_api_key
10
+
11
+ def action(self, name: str, extra_metadata: dict = {}): # `extra_metadata` will just be extra metadata for the developer
12
+ def decorator(fn):
13
+ if name in _registered_actions:
14
+ return fn # avoid duplicate registration
15
+
16
+ _registered_actions.add(name)
17
+
18
+ try:
19
+ source = inspect.getsource(fn)
20
+ payload = {
21
+ "action_name": name,
22
+ "entrypoint": fn.__name__,
23
+ "runtime": "python",
24
+ "source_code": source
25
+ }
26
+
27
+ if not extra_metadata == {}:
28
+ payload['extra_metadata'] = extra_metadata
29
+
30
+ requests.post(
31
+ f"{API_BASE}/actions/register",
32
+ json=payload,
33
+ headers={
34
+ "Authorization": self.developer_api_key,
35
+ 'fsdk': 'yes'
36
+ },
37
+ timeout=5 # avoid hanging imports
38
+ )
39
+ except Exception as e:
40
+ print(f"[stellr-sdk] Warning: Failed to register action '{name}': {e}")
41
+
42
+ return fn
43
+ return decorator