dc-python-sdk 1.5.26__tar.gz → 1.5.28__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.
Files changed (35) hide show
  1. {dc_python_sdk-1.5.26/src/dc_python_sdk.egg-info → dc_python_sdk-1.5.28}/PKG-INFO +1 -1
  2. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/pyproject.toml +1 -1
  3. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/setup.cfg +1 -1
  4. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28/src/dc_python_sdk.egg-info}/PKG-INFO +1 -1
  5. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/ai_http.py +42 -23
  6. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/LICENSE +0 -0
  7. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/README.md +0 -0
  8. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_python_sdk.egg-info/SOURCES.txt +0 -0
  9. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_python_sdk.egg-info/dependency_links.txt +0 -0
  10. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_python_sdk.egg-info/entry_points.txt +0 -0
  11. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_python_sdk.egg-info/requires.txt +0 -0
  12. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_python_sdk.egg-info/top_level.txt +0 -0
  13. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/__init__.py +0 -0
  14. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/app.py +0 -0
  15. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/cli.py +0 -0
  16. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/errors.py +0 -0
  17. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/handler.py +0 -0
  18. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/__init__.py +0 -0
  19. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/ai.py +0 -0
  20. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/mapping.py +0 -0
  21. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/models/__init__.py +0 -0
  22. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/models/enums.py +0 -0
  23. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/models/errors.py +0 -0
  24. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/models/log_templates.py +0 -0
  25. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/models/pipeline_details.py +0 -0
  26. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/pipeline.py +0 -0
  27. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/server.py +0 -0
  28. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/services/__init__.py +0 -0
  29. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/services/api.py +0 -0
  30. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/services/aws.py +0 -0
  31. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/services/environment.py +0 -0
  32. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/services/loader.py +0 -0
  33. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/services/logger.py +0 -0
  34. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/src/services/session.py +0 -0
  35. {dc_python_sdk-1.5.26 → dc_python_sdk-1.5.28}/src/dc_sdk/types.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dc-python-sdk
3
- Version: 1.5.26
3
+ Version: 1.5.28
4
4
  Summary: Data Connector Python SDK
5
5
  Home-page: https://github.com/data-connector/dc-python-sdk
6
6
  Author: DataConnector
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "dc-python-sdk"
7
- version = "1.5.26"
7
+ version = "1.5.28"
8
8
  description = "Data Connector Python SDK"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.6"
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = dc-python-sdk
3
- version = 1.5.26
3
+ version = 1.5.28
4
4
  author = DataConnector
5
5
  author_email = josh@dataconnector.com
6
6
  description = A small example package
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dc-python-sdk
3
- Version: 1.5.26
3
+ Version: 1.5.28
4
4
  Summary: Data Connector Python SDK
5
5
  Home-page: https://github.com/data-connector/dc-python-sdk
6
6
  Author: DataConnector
@@ -17,6 +17,44 @@ app = FastAPI()
17
17
 
18
18
  _DEFAULT_PROCESS_TTL_SECONDS = 600.0
19
19
 
20
+ METHOD_CONTEXT = {
21
+ "authenticate": "Authenticate using self.credentials. Return True when authentication is successful, otherwise raise a meaningful error.",
22
+ "get_objects": "Return a list of object dictionaries with keys: object_id, object_name, object_label, and optional object_group/visible.",
23
+ "get_fields": "Return a list of field dictionaries for an object_id with keys: field_id, field_name, field_label, and optional metadata like data_type/size.",
24
+ "get_data": "Return paginated data in shape {'next_page': <token_or_none>, 'data': [row_dict, ...]}. Respect object_id, field_ids, n_rows, filters, next_page.",
25
+ "load_data": "Load mapped destination rows into object_id using mapping m and update_method. Return True on success or raise a specific load/write error.",
26
+ "close": "Close open sessions/connections safely. Should not fail when resources were never initialized.",
27
+ "FOLLOWUP": "Refine output quality based on user follow-up feedback after a method succeeds.",
28
+ }
29
+
30
+ REQUIRED_METHODS = [
31
+ "authenticate",
32
+ "get_objects",
33
+ "get_fields",
34
+ "get_data",
35
+ "load_data",
36
+ "close",
37
+ ]
38
+
39
+
40
+ METHOD_SHAPE_REFERENCE = """
41
+ Reference behavior patterns (from production connectors like PostgreSQL):
42
+ - authenticate(self) -> bool
43
+ - validates credentials and initializes client/connection state.
44
+ - get_objects(self) -> list[dict]
45
+ - each object has: object_id, object_name, object_label, optional object_group.
46
+ - if we need to hardcode the objects, we should not do it here. Instead return an empty list with a comment that says objects pulled from API.
47
+ - get_fields(self, object_id, options=dict()) -> list[dict]
48
+ - each field has: field_id, field_name, field_label, optional data_type/size.
49
+ - get_data(self, object_id, field_ids, n_rows=None, filters=None, next_page=None, options=dict()) -> dict
50
+ - returns {"next_page": token_or_none, "data": [row_dict, ...]}.
51
+ - load_data(self, data, object_id, m, update_method, batch_number: int, total_batches: int) -> bool
52
+ - maps/transforms rows and writes data to destination object.
53
+ - close(self) -> None
54
+ - gracefully closes resources (session/connection/tunnel/etc).
55
+ """
56
+
57
+
20
58
  # Default ports: connector HTTP (dc-sdk http) 5000, AI FastAPI 5001, code-server 5002.
21
59
  CONNECTOR_PORT = os.getenv("CONNECTOR_PORT", 5000)
22
60
  AI_PORT = os.getenv("AI_PORT", 5001)
@@ -60,7 +98,7 @@ class ChatMessage(BaseModel):
60
98
  class FeedbackRequest(BaseModel):
61
99
  credentials: Dict
62
100
  feedback: str
63
- connector_context: Optional[ConnectorContext] = None
101
+ connector_context: ConnectorContext
64
102
  failed_stage: Optional[str] = None
65
103
  # Prior turns from last response’s ai_messages; new user content is only req.feedback this round.
66
104
  ai_messages: Optional[List[ChatMessage]] = None
@@ -71,7 +109,7 @@ class FeedbackRequest(BaseModel):
71
109
  class RunRequest(BaseModel):
72
110
  credentials: List[Dict]
73
111
  max_attempts: Optional[int] = 5
74
- connector_context: Optional[ConnectorContext] = None
112
+ connector_context: ConnectorContext
75
113
  ai_messages: Optional[List[ChatMessage]] = None
76
114
  # When objects_dynamic is false: required — every id must appear in get_objects results.
77
115
  # When objects_dynamic is true and get_objects returns []: required — used to probe get_fields/get_data.
@@ -98,21 +136,8 @@ def read_connector():
98
136
  with open(f"{workspace}/src/connector.py", "r") as f:
99
137
  return f.read()
100
138
 
101
- def _resolved_connector_context(opt: Optional[ConnectorContext]) -> ConnectorContext:
102
- from dc_sdk.src.ai import CONNECTOR_CONTEXT as defaults
103
-
104
- merged: Dict[str, Any] = {
105
- "name": defaults["name"],
106
- "auth_type": defaults["auth_type"],
107
- "base_url": defaults["base_url"],
108
- "objects_dynamic": False,
109
- "notes": None,
110
- }
111
- if opt is not None:
112
- for key, value in opt.model_dump(exclude_unset=True).items():
113
- if value is not None:
114
- merged[key] = value
115
- return ConnectorContext(**merged)
139
+ def _resolved_connector_context(ctx: ConnectorContext) -> ConnectorContext:
140
+ return ctx
116
141
 
117
142
  def _chat_messages_to_openai(messages: Optional[List[ChatMessage]]) -> List[Dict[str, str]]:
118
143
  if not messages:
@@ -338,12 +363,6 @@ def _build_full_fix_prompt(
338
363
  stage: Optional[str],
339
364
  connector_context: ConnectorContext,
340
365
  ) -> str:
341
- from dc_sdk.src.ai import (
342
- METHOD_CONTEXT,
343
- METHOD_SHAPE_REFERENCE,
344
- REQUIRED_METHODS,
345
- )
346
-
347
366
  extra_block = ""
348
367
  if connector_context.notes:
349
368
  extra_block = f"\nAdditional connector details:\n{connector_context.notes}\n"
File without changes
File without changes