clerk-sdk 0.1.0__tar.gz → 0.1.1__tar.gz
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.
- {clerk_sdk-0.1.0/clerk_sdk.egg-info → clerk_sdk-0.1.1}/PKG-INFO +1 -3
- {clerk_sdk-0.1.0 → clerk_sdk-0.1.1}/README.md +0 -1
- clerk_sdk-0.1.1/clerk/decorator/models.py +19 -0
- clerk_sdk-0.1.1/clerk/decorator/task_decorator.py +43 -0
- {clerk_sdk-0.1.0 → clerk_sdk-0.1.1/clerk_sdk.egg-info}/PKG-INFO +1 -3
- {clerk_sdk-0.1.0 → clerk_sdk-0.1.1}/clerk_sdk.egg-info/requires.txt +0 -1
- clerk_sdk-0.1.1/requirements.txt +2 -0
- {clerk_sdk-0.1.0 → clerk_sdk-0.1.1}/setup.py +1 -1
- clerk_sdk-0.1.0/clerk/decorator/models.py +0 -8
- clerk_sdk-0.1.0/clerk/decorator/task_decorator.py +0 -23
- clerk_sdk-0.1.0/requirements.txt +0 -3
- {clerk_sdk-0.1.0 → clerk_sdk-0.1.1}/LICENSE +0 -0
- {clerk_sdk-0.1.0 → clerk_sdk-0.1.1}/MANIFEST.in +0 -0
- {clerk_sdk-0.1.0 → clerk_sdk-0.1.1}/clerk/__init__.py +0 -0
- {clerk_sdk-0.1.0 → clerk_sdk-0.1.1}/clerk/client.py +0 -0
- {clerk_sdk-0.1.0 → clerk_sdk-0.1.1}/clerk/decorator/__init__.py +0 -0
- {clerk_sdk-0.1.0 → clerk_sdk-0.1.1}/clerk/models/__init__.py +0 -0
- {clerk_sdk-0.1.0 → clerk_sdk-0.1.1}/clerk/models/document.py +0 -0
- {clerk_sdk-0.1.0 → clerk_sdk-0.1.1}/clerk/models/document_statuses.py +0 -0
- {clerk_sdk-0.1.0 → clerk_sdk-0.1.1}/clerk/models/file.py +0 -0
- {clerk_sdk-0.1.0 → clerk_sdk-0.1.1}/clerk/models/response_model.py +0 -0
- {clerk_sdk-0.1.0 → clerk_sdk-0.1.1}/clerk_sdk.egg-info/SOURCES.txt +0 -0
- {clerk_sdk-0.1.0 → clerk_sdk-0.1.1}/clerk_sdk.egg-info/dependency_links.txt +0 -0
- {clerk_sdk-0.1.0 → clerk_sdk-0.1.1}/clerk_sdk.egg-info/top_level.txt +0 -0
- {clerk_sdk-0.1.0 → clerk_sdk-0.1.1}/pyproject.toml +0 -0
- {clerk_sdk-0.1.0 → clerk_sdk-0.1.1}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: clerk-sdk
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: Library for interacting with Clerk
|
|
5
5
|
Home-page: https://github.com/F-ONE-Group/clerk_pypi
|
|
6
6
|
Author: F-ONE Group
|
|
@@ -11,7 +11,6 @@ Classifier: Operating System :: OS Independent
|
|
|
11
11
|
Requires-Python: >=3.10
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
|
-
Requires-Dist: prefect==3.4.1
|
|
15
14
|
Requires-Dist: pydantic>2.0.0
|
|
16
15
|
Requires-Dist: backoff>2.0.0
|
|
17
16
|
Dynamic: author
|
|
@@ -85,7 +84,6 @@ def process_document(payload):
|
|
|
85
84
|
|
|
86
85
|
- Python 3.10+
|
|
87
86
|
- Dependencies listed in `requirements.txt`:
|
|
88
|
-
- `prefect>=3.4.1`
|
|
89
87
|
- `pydantic>2.0.0`
|
|
90
88
|
- `backoff>2.0.0`
|
|
91
89
|
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from typing import Dict, List, Optional
|
|
2
|
+
from pydantic import BaseModel
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
class File(BaseModel):
|
|
6
|
+
name: str
|
|
7
|
+
url: str
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Document(BaseModel):
|
|
11
|
+
id: str
|
|
12
|
+
message_subject: Optional[str] = None
|
|
13
|
+
message_content: Optional[str] = None
|
|
14
|
+
files: List[File] = []
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
class ClerkCodePayload(BaseModel):
|
|
18
|
+
document: Document
|
|
19
|
+
structured_data: Dict
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import pickle
|
|
2
|
+
from typing import Callable
|
|
3
|
+
from functools import wraps
|
|
4
|
+
from .models import ClerkCodePayload
|
|
5
|
+
|
|
6
|
+
input_pkl: str = "/app/data/input/input.pkl"
|
|
7
|
+
output_pkl: str = "/app/data/output/output.pkl"
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
def clerk_code():
|
|
11
|
+
def decorator(func: Callable[[ClerkCodePayload], ClerkCodePayload]):
|
|
12
|
+
@wraps(func)
|
|
13
|
+
def wrapper():
|
|
14
|
+
# Step 1: Load and parse input
|
|
15
|
+
try:
|
|
16
|
+
with open(input_pkl, "rb") as f:
|
|
17
|
+
raw_data = pickle.load(f)
|
|
18
|
+
parsed = (
|
|
19
|
+
ClerkCodePayload.model_validate(raw_data)
|
|
20
|
+
if not isinstance(raw_data, ClerkCodePayload)
|
|
21
|
+
else raw_data
|
|
22
|
+
)
|
|
23
|
+
except Exception as e:
|
|
24
|
+
raise RuntimeError(f"Failed to load and parse input pickle: {e}") from e
|
|
25
|
+
|
|
26
|
+
# Step 2: Call the function and validate output
|
|
27
|
+
try:
|
|
28
|
+
output = func(parsed)
|
|
29
|
+
if not isinstance(output, ClerkCodePayload):
|
|
30
|
+
raise TypeError("Function must return a ClerkCodePayload instance.")
|
|
31
|
+
except Exception as e:
|
|
32
|
+
output = e # Save exception to output file for later debugging
|
|
33
|
+
|
|
34
|
+
# Step 3: Write output or exception to pickle
|
|
35
|
+
try:
|
|
36
|
+
with open(output_pkl, "wb") as f:
|
|
37
|
+
pickle.dump(output, f)
|
|
38
|
+
except Exception as e:
|
|
39
|
+
raise RuntimeError(f"Failed to write output pickle: {e}") from e
|
|
40
|
+
|
|
41
|
+
return wrapper
|
|
42
|
+
|
|
43
|
+
return decorator
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: clerk-sdk
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.1
|
|
4
4
|
Summary: Library for interacting with Clerk
|
|
5
5
|
Home-page: https://github.com/F-ONE-Group/clerk_pypi
|
|
6
6
|
Author: F-ONE Group
|
|
@@ -11,7 +11,6 @@ Classifier: Operating System :: OS Independent
|
|
|
11
11
|
Requires-Python: >=3.10
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
13
|
License-File: LICENSE
|
|
14
|
-
Requires-Dist: prefect==3.4.1
|
|
15
14
|
Requires-Dist: pydantic>2.0.0
|
|
16
15
|
Requires-Dist: backoff>2.0.0
|
|
17
16
|
Dynamic: author
|
|
@@ -85,7 +84,6 @@ def process_document(payload):
|
|
|
85
84
|
|
|
86
85
|
- Python 3.10+
|
|
87
86
|
- Dependencies listed in `requirements.txt`:
|
|
88
|
-
- `prefect>=3.4.1`
|
|
89
87
|
- `pydantic>2.0.0`
|
|
90
88
|
- `backoff>2.0.0`
|
|
91
89
|
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import json
|
|
2
|
-
from typing import Dict
|
|
3
|
-
from prefect import flow
|
|
4
|
-
from functools import wraps
|
|
5
|
-
from prefect.states import Completed
|
|
6
|
-
from pydantic import BaseModel
|
|
7
|
-
from .models import ClerkCodePayload
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
def clerk_code():
|
|
11
|
-
def wrapper(func):
|
|
12
|
-
@wraps(func)
|
|
13
|
-
@flow(persist_result=False, log_prints=True, result_serializer="json")
|
|
14
|
-
def wrapped_flow(payload: Dict):
|
|
15
|
-
payload = ClerkCodePayload(**payload)
|
|
16
|
-
result = func(payload)
|
|
17
|
-
if isinstance(result, BaseModel):
|
|
18
|
-
result = result.model_dump()
|
|
19
|
-
return Completed(message=json.dumps(result), data=result)
|
|
20
|
-
|
|
21
|
-
return wrapped_flow
|
|
22
|
-
|
|
23
|
-
return wrapper
|
clerk_sdk-0.1.0/requirements.txt
DELETED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|