unstructured-platform-plugins 0.0.0__tar.gz → 0.0.2__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.
- {unstructured-platform-plugins-0.0.0/unstructured_platform_plugins.egg-info → unstructured-platform-plugins-0.0.2}/PKG-INFO +1 -1
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/test/test_schema.py +3 -3
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/test/test_utils.py +1 -1
- unstructured-platform-plugins-0.0.2/unstructured_platform_plugins/__version__.py +1 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/unstructured_platform_plugins/etl_uvicorn/api_generator.py +2 -2
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/unstructured_platform_plugins/etl_uvicorn/utils.py +5 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/unstructured_platform_plugins/schema/json_schema.py +11 -2
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2/unstructured_platform_plugins.egg-info}/PKG-INFO +1 -1
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/unstructured_platform_plugins.egg-info/requires.txt +3 -3
- unstructured-platform-plugins-0.0.0/unstructured_platform_plugins/__version__.py +0 -1
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/LICENSE +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/LICENSE.md +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/README.md +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/pyproject.toml +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/setup.cfg +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/setup.py +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/test/__init__.py +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/test/assets/__init__.py +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/test/assets/async_typed_dict_response.py +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/test/assets/dataclass_response.py +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/test/assets/empty_input_and_response.py +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/test/assets/hash_function.py +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/test/assets/improper_function.py +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/test/assets/pydantic_response_class_method.py +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/test/assets/simple_hash_class.py +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/test/assets/simple_hash_lambda.py +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/test/assets/simple_hash_value.py +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/test/assets/typed_dict_response.py +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/unstructured_platform_plugins/__init__.py +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/unstructured_platform_plugins/etl_uvicorn/__init__.py +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/unstructured_platform_plugins/etl_uvicorn/main.py +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/unstructured_platform_plugins/schema/__init__.py +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/unstructured_platform_plugins/schema/model.py +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/unstructured_platform_plugins/schema/usage.py +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/unstructured_platform_plugins/schema/utils.py +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/unstructured_platform_plugins/type_hints.py +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/unstructured_platform_plugins/validate_api.py +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/unstructured_platform_plugins.egg-info/SOURCES.txt +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/unstructured_platform_plugins.egg-info/dependency_links.txt +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/unstructured_platform_plugins.egg-info/entry_points.txt +0 -0
- {unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/unstructured_platform_plugins.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: unstructured-platform-plugins
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.2
|
|
4
4
|
Summary: A utility library that provides tools around unstructured plugin development
|
|
5
5
|
Home-page: https://github.com/Unstructured-IO/unstructured-platform-plugins
|
|
6
6
|
License: Apache-2.0
|
{unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/test/test_schema.py
RENAMED
|
@@ -7,7 +7,7 @@ from typing import Any, Optional, Union
|
|
|
7
7
|
import pytest
|
|
8
8
|
from pydantic import BaseModel
|
|
9
9
|
from typing_extensions import TypedDict
|
|
10
|
-
from
|
|
10
|
+
from unstructured_ingest.v2.interfaces import FileData
|
|
11
11
|
|
|
12
12
|
import unstructured_platform_plugins.schema.json_schema as js
|
|
13
13
|
from unstructured_platform_plugins.etl_uvicorn.utils import get_input_schema
|
|
@@ -507,7 +507,7 @@ def test_file_data():
|
|
|
507
507
|
],
|
|
508
508
|
"default": None,
|
|
509
509
|
},
|
|
510
|
-
"doc_type": {"type": "string", "
|
|
510
|
+
"doc_type": {"type": "string", "default": "file"},
|
|
511
511
|
"metadata": {
|
|
512
512
|
"type": "object",
|
|
513
513
|
"properties": {
|
|
@@ -599,7 +599,7 @@ def test_file_data():
|
|
|
599
599
|
],
|
|
600
600
|
"default": None,
|
|
601
601
|
},
|
|
602
|
-
"doc_type": {"type": "string", "
|
|
602
|
+
"doc_type": {"type": "string", "default": "file"},
|
|
603
603
|
"metadata": {
|
|
604
604
|
"type": "object",
|
|
605
605
|
"properties": {
|
{unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/test/test_utils.py
RENAMED
|
@@ -4,7 +4,7 @@ from enum import Enum
|
|
|
4
4
|
|
|
5
5
|
import pytest
|
|
6
6
|
from pydantic import BaseModel
|
|
7
|
-
from
|
|
7
|
+
from unstructured_ingest.v2.interfaces import FileData
|
|
8
8
|
from uvicorn.importer import import_from_string
|
|
9
9
|
|
|
10
10
|
from unstructured_platform_plugins.etl_uvicorn import utils
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.0.2" # pragma: no cover
|
|
@@ -122,8 +122,8 @@ def generate_fast_api(
|
|
|
122
122
|
|
|
123
123
|
else:
|
|
124
124
|
|
|
125
|
-
@fastapi_app.post("/invoke", response_model=
|
|
126
|
-
async def run_job() ->
|
|
125
|
+
@fastapi_app.post("/invoke", response_model=InvokeResponse)
|
|
126
|
+
async def run_job() -> InvokeResponse:
|
|
127
127
|
logger.debug(f"invoking function without inputs: {func}")
|
|
128
128
|
return await wrap_fn(
|
|
129
129
|
func=func,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import inspect
|
|
2
2
|
from dataclasses import is_dataclass
|
|
3
3
|
from enum import EnumMeta
|
|
4
|
+
from inspect import Parameter
|
|
4
5
|
from types import GenericAlias, NoneType
|
|
5
6
|
from typing import Any, Callable, Optional
|
|
6
7
|
|
|
@@ -58,6 +59,10 @@ def get_input_schema(func: Callable, omit: Optional[list[str]] = None) -> dict:
|
|
|
58
59
|
parameters = get_typed_parameters(func)
|
|
59
60
|
if omit:
|
|
60
61
|
parameters = [p for p in parameters if p.name not in omit]
|
|
62
|
+
# Omit self if wrapping method
|
|
63
|
+
parameters = [
|
|
64
|
+
p for p in parameters if not (p.param_type is Parameter.empty and p.name == "self")
|
|
65
|
+
]
|
|
61
66
|
return parameters_to_json_schema(parameters)
|
|
62
67
|
|
|
63
68
|
|
|
@@ -4,11 +4,11 @@ from enum import Enum, EnumMeta
|
|
|
4
4
|
from inspect import Parameter
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
from types import GenericAlias, NoneType, UnionType
|
|
7
|
-
from typing import Any, Optional, Type, Union, _UnionGenericAlias
|
|
7
|
+
from typing import Any, Literal, Optional, Type, Union, _UnionGenericAlias
|
|
8
8
|
|
|
9
9
|
from pydantic import BaseModel, create_model
|
|
10
10
|
from pydantic.fields import FieldInfo, PydanticUndefined
|
|
11
|
-
from
|
|
11
|
+
from unstructured_ingest.v2.interfaces import FileData
|
|
12
12
|
|
|
13
13
|
from unstructured_platform_plugins.schema.utils import TypedParameter
|
|
14
14
|
from unstructured_platform_plugins.type_hints import get_type_hints
|
|
@@ -37,6 +37,13 @@ def is_typed_dict(val: Any) -> bool:
|
|
|
37
37
|
|
|
38
38
|
|
|
39
39
|
def type_to_json_schema(t: Type, args: Optional[tuple[Any, ...]] = None) -> dict:
|
|
40
|
+
if t is Literal:
|
|
41
|
+
arg_types = [type(a) for a in args]
|
|
42
|
+
if len(set(arg_types)) != 1:
|
|
43
|
+
raise TypeError(
|
|
44
|
+
"Literal must be of a single type. Defined with: {}".format(", ".join(arg_types))
|
|
45
|
+
)
|
|
46
|
+
t = arg_types[0]
|
|
40
47
|
resp = {"type": types_map[t]}
|
|
41
48
|
if t is list and args:
|
|
42
49
|
list_type = args[0]
|
|
@@ -305,6 +312,8 @@ def schema_to_base_model_type(json_type_name, name: str, type_info: dict) -> Typ
|
|
|
305
312
|
|
|
306
313
|
def schema_to_base_model(schema: dict, name: str = "reconstructed_model") -> Type[BaseModel]:
|
|
307
314
|
inputs = {}
|
|
315
|
+
if schema["type"] == "null":
|
|
316
|
+
return create_model(name)
|
|
308
317
|
properties = schema["properties"]
|
|
309
318
|
|
|
310
319
|
for k, v in properties.items():
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: unstructured-platform-plugins
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.2
|
|
4
4
|
Summary: A utility library that provides tools around unstructured plugin development
|
|
5
5
|
Home-page: https://github.com/Unstructured-IO/unstructured-platform-plugins
|
|
6
6
|
License: Apache-2.0
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
__version__ = "0.0.0" # pragma: no cover
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/test/__init__.py
RENAMED
|
File without changes
|
{unstructured-platform-plugins-0.0.0 → unstructured-platform-plugins-0.0.2}/test/assets/__init__.py
RENAMED
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|