sdg-hub 0.7.3__py3-none-any.whl → 0.8.0__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.
- sdg_hub/_version.py +2 -2
- sdg_hub/core/__init__.py +13 -1
- sdg_hub/core/blocks/__init__.py +2 -0
- sdg_hub/core/blocks/agent/__init__.py +6 -0
- sdg_hub/core/blocks/agent/agent_block.py +397 -0
- sdg_hub/core/blocks/transform/rename_columns.py +10 -0
- sdg_hub/core/connectors/__init__.py +46 -0
- sdg_hub/core/connectors/agent/__init__.py +10 -0
- sdg_hub/core/connectors/agent/base.py +233 -0
- sdg_hub/core/connectors/agent/langflow.py +151 -0
- sdg_hub/core/connectors/base.py +99 -0
- sdg_hub/core/connectors/exceptions.py +41 -0
- sdg_hub/core/connectors/http/__init__.py +6 -0
- sdg_hub/core/connectors/http/client.py +150 -0
- sdg_hub/core/connectors/registry.py +112 -0
- {sdg_hub-0.7.3.dist-info → sdg_hub-0.8.0.dist-info}/METADATA +1 -1
- {sdg_hub-0.7.3.dist-info → sdg_hub-0.8.0.dist-info}/RECORD +20 -9
- {sdg_hub-0.7.3.dist-info → sdg_hub-0.8.0.dist-info}/WHEEL +1 -1
- {sdg_hub-0.7.3.dist-info → sdg_hub-0.8.0.dist-info}/licenses/LICENSE +0 -0
- {sdg_hub-0.7.3.dist-info → sdg_hub-0.8.0.dist-info}/top_level.txt +0 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# SPDX-License-Identifier: Apache-2.0
|
|
2
|
+
"""Registry for connector classes."""
|
|
3
|
+
|
|
4
|
+
import inspect
|
|
5
|
+
|
|
6
|
+
from ..utils.logger_config import setup_logger
|
|
7
|
+
from .exceptions import ConnectorError
|
|
8
|
+
|
|
9
|
+
logger = setup_logger(__name__)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class ConnectorRegistry:
|
|
13
|
+
"""Global registry for connector classes.
|
|
14
|
+
|
|
15
|
+
Simple registry for registering and retrieving connectors by name.
|
|
16
|
+
|
|
17
|
+
Example
|
|
18
|
+
-------
|
|
19
|
+
>>> @ConnectorRegistry.register("my_connector")
|
|
20
|
+
... class MyConnector(BaseConnector):
|
|
21
|
+
... pass
|
|
22
|
+
...
|
|
23
|
+
>>> connector_class = ConnectorRegistry.get("my_connector")
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
_connectors: dict[str, type] = {}
|
|
27
|
+
|
|
28
|
+
@classmethod
|
|
29
|
+
def register(cls, name: str):
|
|
30
|
+
"""Register a connector class.
|
|
31
|
+
|
|
32
|
+
Parameters
|
|
33
|
+
----------
|
|
34
|
+
name : str
|
|
35
|
+
Name under which to register the connector.
|
|
36
|
+
|
|
37
|
+
Returns
|
|
38
|
+
-------
|
|
39
|
+
callable
|
|
40
|
+
Decorator function that registers the class.
|
|
41
|
+
|
|
42
|
+
Example
|
|
43
|
+
-------
|
|
44
|
+
>>> @ConnectorRegistry.register("langflow")
|
|
45
|
+
... class LangflowConnector(BaseAgentConnector):
|
|
46
|
+
... pass
|
|
47
|
+
"""
|
|
48
|
+
|
|
49
|
+
def decorator(connector_class: type) -> type:
|
|
50
|
+
# Validate the class
|
|
51
|
+
if not inspect.isclass(connector_class):
|
|
52
|
+
raise ConnectorError(f"Expected a class, got {type(connector_class)}")
|
|
53
|
+
|
|
54
|
+
# Check for BaseConnector inheritance
|
|
55
|
+
from .base import BaseConnector
|
|
56
|
+
|
|
57
|
+
if not issubclass(connector_class, BaseConnector):
|
|
58
|
+
raise ConnectorError(
|
|
59
|
+
f"Connector class '{connector_class.__name__}' "
|
|
60
|
+
"must inherit from BaseConnector"
|
|
61
|
+
)
|
|
62
|
+
|
|
63
|
+
cls._connectors[name] = connector_class
|
|
64
|
+
logger.debug(f"Registered connector '{name}' ({connector_class.__name__})")
|
|
65
|
+
|
|
66
|
+
return connector_class
|
|
67
|
+
|
|
68
|
+
return decorator
|
|
69
|
+
|
|
70
|
+
@classmethod
|
|
71
|
+
def get(cls, name: str) -> type:
|
|
72
|
+
"""Get a connector class by name.
|
|
73
|
+
|
|
74
|
+
Parameters
|
|
75
|
+
----------
|
|
76
|
+
name : str
|
|
77
|
+
Name of the connector to retrieve.
|
|
78
|
+
|
|
79
|
+
Returns
|
|
80
|
+
-------
|
|
81
|
+
type
|
|
82
|
+
The connector class.
|
|
83
|
+
|
|
84
|
+
Raises
|
|
85
|
+
------
|
|
86
|
+
ConnectorError
|
|
87
|
+
If the connector is not found.
|
|
88
|
+
"""
|
|
89
|
+
if name not in cls._connectors:
|
|
90
|
+
available = sorted(cls._connectors.keys())
|
|
91
|
+
error_msg = f"Connector '{name}' not found."
|
|
92
|
+
if available:
|
|
93
|
+
error_msg += f" Available: {', '.join(available)}"
|
|
94
|
+
raise ConnectorError(error_msg)
|
|
95
|
+
|
|
96
|
+
return cls._connectors[name]
|
|
97
|
+
|
|
98
|
+
@classmethod
|
|
99
|
+
def list_all(cls) -> list[str]:
|
|
100
|
+
"""Get all registered connector names.
|
|
101
|
+
|
|
102
|
+
Returns
|
|
103
|
+
-------
|
|
104
|
+
list[str]
|
|
105
|
+
Sorted list of all connector names.
|
|
106
|
+
"""
|
|
107
|
+
return sorted(cls._connectors.keys())
|
|
108
|
+
|
|
109
|
+
@classmethod
|
|
110
|
+
def clear(cls) -> None:
|
|
111
|
+
"""Clear all registered connectors. Primarily for testing."""
|
|
112
|
+
cls._connectors.clear()
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
sdg_hub/__init__.py,sha256=TlkZT40-70urdcWLqv3kupaJj8s-SVgd2QyvlSFwb4A,510
|
|
2
|
-
sdg_hub/_version.py,sha256=
|
|
2
|
+
sdg_hub/_version.py,sha256=Rttl-BDadtcW1QzGnNffCWA_Wc9mUKDMOBPZp--Mnsc,704
|
|
3
3
|
sdg_hub/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
4
|
-
sdg_hub/core/__init__.py,sha256=
|
|
5
|
-
sdg_hub/core/blocks/__init__.py,sha256=
|
|
4
|
+
sdg_hub/core/__init__.py,sha256=puXA9S4n-D9MveT9GhpJ84ACKpAzVmwD32TBX8xR8Z8,719
|
|
5
|
+
sdg_hub/core/blocks/__init__.py,sha256=WXlr-9g47rU6_IDpRFxvsPyImfNEBbhvx5JRi3Z3otY,1048
|
|
6
6
|
sdg_hub/core/blocks/base.py,sha256=LgRGvlMqZrxQYUcS_-9HBN_8FZFY1I3O4SBzh0iOCQc,13201
|
|
7
7
|
sdg_hub/core/blocks/registry.py,sha256=FuEN_pnq-nSH1LguY3_oCubT6Kz3SuJjk3TcUpLT-lw,10695
|
|
8
|
+
sdg_hub/core/blocks/agent/__init__.py,sha256=6Vf64AfzPYL8rBbatPkXYrLjgvq-eyhsp5nOatbm02g,162
|
|
9
|
+
sdg_hub/core/blocks/agent/agent_block.py,sha256=3R9tO3YYtEsNO20vQ_2MjdeqcqlCthxlvXxNhWlIw2U,11942
|
|
8
10
|
sdg_hub/core/blocks/filtering/__init__.py,sha256=isxSVSvDqkMjG8dQSl3Q2M4g5c1t9fTjBSA21icf-yA,275
|
|
9
11
|
sdg_hub/core/blocks/filtering/column_value_filter.py,sha256=nT4vBFvi0Q8KoNvh2LkVWRGRp7HkiiLBcPPOGNZF6ig,6528
|
|
10
12
|
sdg_hub/core/blocks/llm/__init__.py,sha256=GTyXZHNYoiyaajx600ouKIrwAg7aS8QjcgkDlThzbag,805
|
|
@@ -18,9 +20,18 @@ sdg_hub/core/blocks/transform/duplicate_columns.py,sha256=vK853XsNh62TAcanK8ioVt
|
|
|
18
20
|
sdg_hub/core/blocks/transform/index_based_mapper.py,sha256=yN0i7kxv9Wn5VGWa1INMry6US3K9FS-jrYrb2GP1-BI,8943
|
|
19
21
|
sdg_hub/core/blocks/transform/json_structure_block.py,sha256=vVnKCdE_Qs6bFoLG5mPp6LFXZf0UhucwGj_6r79nhFM,5104
|
|
20
22
|
sdg_hub/core/blocks/transform/melt_columns.py,sha256=a6UjTKizsBP2CX8Opp0FmuembGXUJ8b0NGi5lZjmPm8,4418
|
|
21
|
-
sdg_hub/core/blocks/transform/rename_columns.py,sha256=
|
|
23
|
+
sdg_hub/core/blocks/transform/rename_columns.py,sha256=tvxW9qMM3fJ7vHyxwkfsbcSeTD2eFP1MQfPhQkspA_E,3590
|
|
22
24
|
sdg_hub/core/blocks/transform/text_concat.py,sha256=E4DoRDeIUgWuF-0a1vE8DpxPpBhQGgXW7wDWAKLSKdg,3124
|
|
23
25
|
sdg_hub/core/blocks/transform/uniform_col_val_setter.py,sha256=mqDG5h0p2qfzWFLlxzOCkDQzYgVUVgKW4PLxKtuon3Q,3274
|
|
26
|
+
sdg_hub/core/connectors/__init__.py,sha256=V66HGS2wGVMYRwjrHHIm5JXxIzTwPTpSimCp2SczrCA,1236
|
|
27
|
+
sdg_hub/core/connectors/base.py,sha256=OLeKrd9QYtvqaAIsc4Bm_f1jUv9lblUkvlixjiyw-EY,2794
|
|
28
|
+
sdg_hub/core/connectors/exceptions.py,sha256=4-L9vQzQfCnymjV6l42fNPtfTCFtxIc4R-6aWJ4bwMk,1089
|
|
29
|
+
sdg_hub/core/connectors/registry.py,sha256=U5OQWi2waiGMeSZAhU_LzADtGvFQFttqZaQk0IjH3RQ,2991
|
|
30
|
+
sdg_hub/core/connectors/agent/__init__.py,sha256=5rUo5fPZ7-8TkyRoWSD5XGdZA2i_X8rElgHvZgzyUn8,221
|
|
31
|
+
sdg_hub/core/connectors/agent/base.py,sha256=GtmRCCof-mo0RzXHJYTFZO7Fc0L9HBugQhe7SacCzdo,6964
|
|
32
|
+
sdg_hub/core/connectors/agent/langflow.py,sha256=DJzIjSnkeDJj_oHSxX9R7IqorARiKV4KUKk8pxCdY5I,4348
|
|
33
|
+
sdg_hub/core/connectors/http/__init__.py,sha256=au0vfsWmNJB7UsHFm0Hsc_JvKoPeDTuYC-SdSQJ2VBM,133
|
|
34
|
+
sdg_hub/core/connectors/http/client.py,sha256=0elw5pOr9akocAF2ZNbLLKxc8dy41BP4kSr2tBd7GR8,4782
|
|
24
35
|
sdg_hub/core/flow/__init__.py,sha256=0_m_htuZfPxk8xQ9IKfp0Pz-JRE4O7lYMUFrKyLNoLA,409
|
|
25
36
|
sdg_hub/core/flow/base.py,sha256=o7OBBH4LkMdJrvYbf3kX6NSAb6U8jQFoRXHKSFHjTEs,58278
|
|
26
37
|
sdg_hub/core/flow/checkpointer.py,sha256=MJay3Q5cfRgJDetk82DaMKJ3ZZUYRHxQabEQTxhGukk,11850
|
|
@@ -84,8 +95,8 @@ sdg_hub/flows/text_analysis/structured_insights/extract_entities.yaml,sha256=Q_S
|
|
|
84
95
|
sdg_hub/flows/text_analysis/structured_insights/extract_keywords.yaml,sha256=_nPPMdHnxag_lYbhYUjGJGo-CvRwWvwdGX7cQhdZ1S0,847
|
|
85
96
|
sdg_hub/flows/text_analysis/structured_insights/flow.yaml,sha256=E9bx5QvmIwm69KITVwZFgwlwe33nhYbVRPRwrMrD8Xw,4978
|
|
86
97
|
sdg_hub/flows/text_analysis/structured_insights/summarize.yaml,sha256=WXwQak1pF8e1OwnOoI1EHu8QB6iUNW89rfkTdi1Oq54,687
|
|
87
|
-
sdg_hub-0.
|
|
88
|
-
sdg_hub-0.
|
|
89
|
-
sdg_hub-0.
|
|
90
|
-
sdg_hub-0.
|
|
91
|
-
sdg_hub-0.
|
|
98
|
+
sdg_hub-0.8.0.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
|
99
|
+
sdg_hub-0.8.0.dist-info/METADATA,sha256=yC_UNI988aCntR3Kf-YcRMpqhCixp9j0boYFeBMlqOo,9614
|
|
100
|
+
sdg_hub-0.8.0.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
101
|
+
sdg_hub-0.8.0.dist-info/top_level.txt,sha256=TqI7d-HE1n6zkXFkU0nF3A1Ct0P0pBaqI675uFokhx4,8
|
|
102
|
+
sdg_hub-0.8.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|