datainfra 0.7.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.
Files changed (67) hide show
  1. datainfra/__init__.py +119 -0
  2. datainfra/__main__.py +235 -0
  3. datainfra/_version.py +13 -0
  4. datainfra/catalogs/__init__.py +19 -0
  5. datainfra/catalogs/registry.py +132 -0
  6. datainfra/contract/__init__.py +111 -0
  7. datainfra/contract/dataset.py +314 -0
  8. datainfra/contract/errors.py +535 -0
  9. datainfra/contract/ports.py +367 -0
  10. datainfra/contract/provenance.py +109 -0
  11. datainfra/contract/query.py +100 -0
  12. datainfra/contract/records.py +365 -0
  13. datainfra/contract/secret.py +125 -0
  14. datainfra/contract/write.py +191 -0
  15. datainfra/encoder/__init__.py +21 -0
  16. datainfra/encoder/json_rows.py +62 -0
  17. datainfra/encoder/table_rows.py +94 -0
  18. datainfra/export/__init__.py +40 -0
  19. datainfra/export/frame.py +91 -0
  20. datainfra/export/jsonl.py +109 -0
  21. datainfra/export/mcp.py +118 -0
  22. datainfra/kernel/__init__.py +21 -0
  23. datainfra/kernel/catalog.py +127 -0
  24. datainfra/kernel/plan.py +135 -0
  25. datainfra/kernel/source.py +783 -0
  26. datainfra/policy/__init__.py +58 -0
  27. datainfra/policy/engine/__init__.py +34 -0
  28. datainfra/policy/engine/auth.py +190 -0
  29. datainfra/policy/engine/backoff.py +93 -0
  30. datainfra/policy/engine/credentials.py +87 -0
  31. datainfra/policy/engine/rate_limit.py +140 -0
  32. datainfra/policy/engine/retry.py +121 -0
  33. datainfra/policy/engine/token_client.py +142 -0
  34. datainfra/policy/schemes/__init__.py +42 -0
  35. datainfra/policy/schemes/api_key.py +90 -0
  36. datainfra/policy/schemes/base.py +129 -0
  37. datainfra/policy/schemes/basic.py +81 -0
  38. datainfra/policy/schemes/bearer.py +87 -0
  39. datainfra/policy/schemes/hmac_signature.py +116 -0
  40. datainfra/policy/schemes/oauth2_client_credentials.py +150 -0
  41. datainfra/py.typed +1 -0
  42. datainfra/reader/__init__.py +29 -0
  43. datainfra/reader/columns.py +97 -0
  44. datainfra/reader/csv.py +185 -0
  45. datainfra/reader/json.py +141 -0
  46. datainfra/reader/mapping.py +67 -0
  47. datainfra/reader/records.py +96 -0
  48. datainfra/reader/xml.py +156 -0
  49. datainfra/sources/__init__.py +30 -0
  50. datainfra/sources/csv_file.py +110 -0
  51. datainfra/sources/rest_json.py +155 -0
  52. datainfra/sources/rss.py +115 -0
  53. datainfra/sources/sqlite.py +121 -0
  54. datainfra/transport/__init__.py +34 -0
  55. datainfra/transport/callable.py +89 -0
  56. datainfra/transport/csv.py +299 -0
  57. datainfra/transport/file.py +131 -0
  58. datainfra/transport/http.py +633 -0
  59. datainfra/transport/memory.py +150 -0
  60. datainfra/transport/sdk.py +153 -0
  61. datainfra/transport/sql.py +249 -0
  62. datainfra-0.7.0.dist-info/METADATA +122 -0
  63. datainfra-0.7.0.dist-info/RECORD +67 -0
  64. datainfra-0.7.0.dist-info/WHEEL +5 -0
  65. datainfra-0.7.0.dist-info/entry_points.txt +2 -0
  66. datainfra-0.7.0.dist-info/licenses/LICENSE +21 -0
  67. datainfra-0.7.0.dist-info/top_level.txt +1 -0
datainfra/__init__.py ADDED
@@ -0,0 +1,119 @@
1
+ ################################################################################
2
+ # @Project: datainfra
3
+ # @File Path: src/datainfra/__init__.py
4
+ # @Description: Public surface of the library. Anything absent from
5
+ # __all__ is an implementation detail and may change
6
+ # without a major release.
7
+ # @Creation Date: 2026-12-01
8
+ # @Last Update: 2026-12-01
9
+ ################################################################################
10
+
11
+ ################################################################################
12
+ # Import Libraries
13
+ ################################################################################
14
+ # Local Modules
15
+ from datainfra._version import __version__
16
+ from datainfra.contract import (
17
+ AttemptStats,
18
+ AuthError,
19
+ CapabilityError,
20
+ Cursor,
21
+ DataInfraError,
22
+ DatasetNotFoundError,
23
+ DatasetSpec,
24
+ DecodedPage,
25
+ DecodeError,
26
+ Encoder,
27
+ ErrorStage,
28
+ ExportError,
29
+ Field,
30
+ FieldType,
31
+ Kind,
32
+ MissingCredentialError,
33
+ PageLimitError,
34
+ ParamError,
35
+ ParamSpec,
36
+ PartialWriteError,
37
+ Policies,
38
+ Provenance,
39
+ Query,
40
+ RateLimitError,
41
+ Reader,
42
+ Record,
43
+ RecordBatch,
44
+ RequestView,
45
+ Schema,
46
+ SchemaMismatchError,
47
+ Secret,
48
+ SourceSpec,
49
+ SpecError,
50
+ Transport,
51
+ TransportCapabilities,
52
+ TransportError,
53
+ TransportRequest,
54
+ TransportResponse,
55
+ WriteError,
56
+ WriteMode,
57
+ WriteReceipt,
58
+ WriteSpec,
59
+ )
60
+ from datainfra.kernel import Catalog, Plan, Source, Step
61
+
62
+ # 导入出口层只是为了登记 RecordBatch 的转换方法(to_records / to_dataframe /
63
+ # to_jsonl / to_json)。契约层不能反向依赖它,所以由门面来做这件事:
64
+ # 少了这一行,用户拿到 batch 后调 .to_dataframe() 会得到「没有登记转换器」。
65
+ import datainfra.export # noqa: F401 # isort: skip
66
+
67
+ ################################################################################
68
+ # Module Constants
69
+ ################################################################################
70
+ # 导出面即契约:不在此列的名字随时可能改名,下游不应直接 import
71
+ __all__ = [
72
+ "AttemptStats",
73
+ "AuthError",
74
+ "CapabilityError",
75
+ "Catalog",
76
+ "Cursor",
77
+ "DataInfraError",
78
+ "DatasetNotFoundError",
79
+ "DatasetSpec",
80
+ "DecodeError",
81
+ "DecodedPage",
82
+ "Encoder",
83
+ "ErrorStage",
84
+ "ExportError",
85
+ "Field",
86
+ "FieldType",
87
+ "Kind",
88
+ "MissingCredentialError",
89
+ "PageLimitError",
90
+ "ParamError",
91
+ "ParamSpec",
92
+ "PartialWriteError",
93
+ "Plan",
94
+ "Policies",
95
+ "Provenance",
96
+ "Query",
97
+ "RateLimitError",
98
+ "Reader",
99
+ "Record",
100
+ "RecordBatch",
101
+ "RequestView",
102
+ "Schema",
103
+ "SchemaMismatchError",
104
+ "Secret",
105
+ "Source",
106
+ "SourceSpec",
107
+ "SpecError",
108
+ "Step",
109
+ "Transport",
110
+ "TransportCapabilities",
111
+ "TransportError",
112
+ "TransportRequest",
113
+ "TransportResponse",
114
+ "WriteError",
115
+ "WriteMode",
116
+ "WriteReceipt",
117
+ "WriteSpec",
118
+ "__version__",
119
+ ]
datainfra/__main__.py ADDED
@@ -0,0 +1,235 @@
1
+ ################################################################################
2
+ # @Project: datainfra
3
+ # @File Path: src/datainfra/__main__.py
4
+ # @Description: Command line entry point: list catalogs, fetch a dataset or
5
+ # print MCP tool descriptions, for a registry supplied by the
6
+ # caller's own module.
7
+ # @Creation Date: 2026-12-02
8
+ # @Last Update: 2026-12-02
9
+ ################################################################################
10
+
11
+ ################################################################################
12
+ # Import Libraries
13
+ ################################################################################
14
+ # Standard Libraries
15
+ import argparse
16
+ import importlib
17
+ import json
18
+ import sys
19
+ from collections.abc import Sequence
20
+ from typing import Any
21
+
22
+ # Local Modules
23
+ from datainfra.catalogs.registry import SourceRegistry
24
+ from datainfra.contract.errors import DataInfraError
25
+ from datainfra.export.frame import to_records
26
+ from datainfra.export.jsonl import to_jsonl, write_jsonl
27
+ from datainfra.export.mcp import registry_tool_specs
28
+
29
+ ################################################################################
30
+ # Module Constants
31
+ ################################################################################
32
+ # 默认工厂名:约定优于配置,用户模块里叫 build_registry 即可零参数接入
33
+ DEFAULT_FACTORY: str = "build_registry"
34
+
35
+ # 退出码:0 正常,2 库错误,3 装配错误(模块或工厂找不到)
36
+ EXIT_OK: int = 0
37
+ EXIT_LIBRARY_ERROR: int = 2
38
+ EXIT_WIRING_ERROR: int = 3
39
+
40
+ # 表格渲染的最大列宽,超过就截断,避免一行横穿终端
41
+ MAX_CELL_WIDTH: int = 32
42
+
43
+
44
+ ################################################################################
45
+ # Module Functions
46
+ ################################################################################
47
+ def main(argv: Sequence[str] | None = None) -> int:
48
+ """
49
+ Run one command and return its exit code.
50
+
51
+ :param argv: Arguments to parse, ``None`` reads ``sys.argv``.
52
+ :return: Process exit code.
53
+ """
54
+ # 参数解析放在 main 里,便于测试直接传 argv
55
+ args = _parser().parse_args(argv)
56
+ try:
57
+ registry = _load_registry(args.module, args.factory)
58
+ except (ImportError, AttributeError) as error:
59
+ print(f"error: cannot load registry: {error}", file=sys.stderr)
60
+ return EXIT_WIRING_ERROR
61
+
62
+ try:
63
+ if args.command == "catalog":
64
+ return _cmd_catalog(registry, args)
65
+ if args.command == "tools":
66
+ return _cmd_tools(registry)
67
+ return _cmd_fetch(registry, args)
68
+ except DataInfraError as error:
69
+ # 库错误已经结构化,直接打印即可,不需要堆栈
70
+ print(f"error: {error}", file=sys.stderr)
71
+ return EXIT_LIBRARY_ERROR
72
+
73
+
74
+ def _parser() -> argparse.ArgumentParser:
75
+ """
76
+ Build the argument parser.
77
+
78
+ :return: Configured parser.
79
+ """
80
+ # 三个子命令覆盖「看有什么、取一次、导出成工具」
81
+ parser = argparse.ArgumentParser(
82
+ prog="datainfra", description="Inspect and query a datainfra deployment."
83
+ )
84
+ parser.add_argument("--module", required=True, help="module exposing a registry")
85
+ parser.add_argument(
86
+ "--factory", default=DEFAULT_FACTORY, help="factory name inside that module"
87
+ )
88
+ subparsers = parser.add_subparsers(dest="command", required=True)
89
+
90
+ catalog = subparsers.add_parser("catalog", help="list sources and datasets")
91
+ catalog.add_argument("--source", default=None, help="only show one source")
92
+
93
+ subparsers.add_parser("tools", help="print MCP tool descriptions as JSON")
94
+
95
+ fetch = subparsers.add_parser("fetch", help="fetch one dataset")
96
+ fetch.add_argument("--source", required=True)
97
+ fetch.add_argument("--dataset", required=True)
98
+ fetch.add_argument(
99
+ "--params", default="{}", help="JSON object of dataset parameters"
100
+ )
101
+ fetch.add_argument(
102
+ "--format", choices=("table", "jsonl"), default="table", help="output format"
103
+ )
104
+ fetch.add_argument("--out", default=None, help="write jsonl to this path")
105
+ return parser
106
+
107
+
108
+ def _load_registry(module: str, factory: str) -> SourceRegistry:
109
+ """
110
+ Import the caller's module and call its registry factory.
111
+
112
+ :param module: Importable module path.
113
+ :param factory: Function name returning a registry.
114
+ :return: Registry built by that function.
115
+ :raises ImportError: If the module cannot be imported.
116
+ :raises AttributeError: If the factory is missing.
117
+ :raises TypeError: If the factory does not return a registry.
118
+ """
119
+ # 库不猜测部署结构:注册表由使用方的模块提供
120
+ imported = importlib.import_module(module)
121
+ builder = getattr(imported, factory)
122
+ registry = builder()
123
+ if not isinstance(registry, SourceRegistry):
124
+ raise TypeError(f"{module}.{factory}() must return a SourceRegistry")
125
+ return registry
126
+
127
+
128
+ def _cmd_catalog(registry: SourceRegistry, args: argparse.Namespace) -> int:
129
+ """
130
+ Print the catalog as JSON.
131
+
132
+ :param registry: Registry to describe.
133
+ :param args: Parsed arguments carrying the optional source filter.
134
+ :return: Exit code.
135
+ """
136
+ # 输出就是 describe() 的结果,CLI 不做二次加工,便于管道消费
137
+ described = registry.describe()
138
+ if args.source is not None:
139
+ described = [item for item in described if item["name"] == args.source]
140
+ print(_dumps(described))
141
+ return EXIT_OK
142
+
143
+
144
+ def _cmd_tools(registry: SourceRegistry) -> int:
145
+ """
146
+ Print MCP tool descriptions as JSON.
147
+
148
+ :param registry: Registry to describe.
149
+ :return: Exit code.
150
+ """
151
+ # 纯 dict 输出,无需 MCP SDK:贴进任何宿主都能用
152
+ print(_dumps(registry_tool_specs(registry)))
153
+ return EXIT_OK
154
+
155
+
156
+ def _cmd_fetch(registry: SourceRegistry, args: argparse.Namespace) -> int:
157
+ """
158
+ Fetch one dataset and print or write it.
159
+
160
+ :param registry: Registry to resolve the source from.
161
+ :param args: Parsed arguments carrying source, dataset and format.
162
+ :return: Exit code.
163
+ """
164
+ # 参数是 JSON 字符串:CLI 无法表达任意 schema,只能交给调用方写清楚
165
+ params = json.loads(args.params)
166
+ source = registry.create(args.source)
167
+ batch = source.fetch(args.dataset, **params)
168
+
169
+ if args.out is not None:
170
+ write_jsonl(batch, args.out)
171
+ print(f"wrote {batch.row_count} rows to {args.out}")
172
+ return EXIT_OK
173
+ if args.format == "jsonl":
174
+ sys.stdout.write(to_jsonl(batch))
175
+ return EXIT_OK
176
+
177
+ print(_table(to_records(batch), batch.schema.column_names))
178
+ print(f"-- {batch.row_count} rows from {batch.provenance.source}")
179
+ return EXIT_OK
180
+
181
+
182
+ def _dumps(payload: Any) -> str:
183
+ """
184
+ Render JSON for humans and for pipes.
185
+
186
+ :param payload: JSON-serializable value.
187
+ :return: Indented JSON text.
188
+ """
189
+ # 不转义中文:终端里看目录不该出现 \u4e2d\u6587
190
+ return json.dumps(payload, ensure_ascii=False, indent=2)
191
+
192
+
193
+ def _table(rows: list[dict[str, Any]], columns: Sequence[str]) -> str:
194
+ """
195
+ Render rows as a fixed width table.
196
+
197
+ :param rows: Mapping rows to render.
198
+ :param columns: Column order, taken from the schema.
199
+ :return: Table text, header included.
200
+ """
201
+ # 先算每列宽度:取表头与单元格的最大值,再按上限截断
202
+ cells = [[_cell(row.get(name)) for name in columns] for row in rows]
203
+ widths = [
204
+ min(MAX_CELL_WIDTH, max([len(name), *(len(row[index]) for row in cells)]))
205
+ for index, name in enumerate(columns)
206
+ ]
207
+
208
+ header = " ".join(name.ljust(widths[index]) for index, name in enumerate(columns))
209
+ separator = " ".join("-" * width for width in widths)
210
+ body = [
211
+ " ".join(
212
+ value[: widths[index]].ljust(widths[index])
213
+ for index, value in enumerate(row)
214
+ )
215
+ for row in cells
216
+ ]
217
+ return "\n".join([header, separator, *body])
218
+
219
+
220
+ def _cell(value: Any) -> str:
221
+ """
222
+ Render one cell as text.
223
+
224
+ :param value: Cell value.
225
+ :return: Text, empty for ``None``.
226
+ """
227
+ # None 与空串在表格里都显示为空,避免出现字面上的 None
228
+ return "" if value is None else str(value)
229
+
230
+
231
+ ################################################################################
232
+ # Script Entry Point
233
+ ################################################################################
234
+ if __name__ == "__main__":
235
+ raise SystemExit(main())
datainfra/_version.py ADDED
@@ -0,0 +1,13 @@
1
+ ################################################################################
2
+ # @Project: datainfra
3
+ # @File Path: src/datainfra/_version.py
4
+ # @Description: Single source of truth for the package version.
5
+ # @Creation Date: 2026-12-01
6
+ # @Last Update: 2026-12-01
7
+ ################################################################################
8
+
9
+ ################################################################################
10
+ # Module Constants
11
+ ################################################################################
12
+ # 版本只在这里改一次;pyproject 通过 setuptools.dynamic 读取,避免两处漂移
13
+ __version__ = "0.7.0"
@@ -0,0 +1,19 @@
1
+ ################################################################################
2
+ # @Project: datainfra
3
+ # @File Path: src/datainfra/catalogs/__init__.py
4
+ # @Description: Layer 4: domain level aggregation. Holds the name to factory
5
+ # registry that a deployment, a CLI or an agent starts from.
6
+ # @Creation Date: 2026-12-02
7
+ # @Last Update: 2026-12-02
8
+ ################################################################################
9
+
10
+ ################################################################################
11
+ # Import Libraries
12
+ ################################################################################
13
+ # Local Modules
14
+ from datainfra.catalogs.registry import SourceRegistry
15
+
16
+ ################################################################################
17
+ # Module Constants
18
+ ################################################################################
19
+ __all__ = ["SourceRegistry"]
@@ -0,0 +1,132 @@
1
+ ################################################################################
2
+ # @Project: datainfra
3
+ # @File Path: src/datainfra/catalogs/registry.py
4
+ # @Description: Name to factory registry, so callers and tooling can ask for a
5
+ # source by name without importing every module themselves.
6
+ # @Creation Date: 2026-12-02
7
+ # @Last Update: 2026-12-02
8
+ ################################################################################
9
+
10
+ ################################################################################
11
+ # Import Libraries
12
+ ################################################################################
13
+ # Standard Libraries
14
+ from collections.abc import Callable
15
+ from typing import Any
16
+
17
+ # Local Modules
18
+ from datainfra.contract.errors import SpecError
19
+ from datainfra.kernel.source import Source
20
+
21
+
22
+ ################################################################################
23
+ # Module Classes
24
+ ################################################################################
25
+ class SourceRegistry:
26
+ """
27
+ Hold configured sources by name and expose their catalogs.
28
+
29
+ Two uses, both boring: a CLI or an agent needs to list what a deployment
30
+ can reach without hard coding imports, and a test needs to build the same
31
+ source twice. Registration takes a factory rather than an instance so that
32
+ credentials and connections stay with the caller.
33
+ """
34
+
35
+ ############################################################################
36
+ # Constructor Method
37
+ ############################################################################
38
+ def __init__(self) -> None:
39
+ """
40
+ Start with an empty registry.
41
+ """
42
+ # 只存工厂,构造期不建立任何源,因此登记本身没有副作用
43
+ self._factories: dict[str, Callable[..., Source]] = {}
44
+
45
+ ############################################################################
46
+ # Core Instance Methods
47
+ ############################################################################
48
+ def register(self, name: str, factory: Callable[..., Source]) -> "SourceRegistry":
49
+ """
50
+ Register a factory under a name.
51
+
52
+ :param name: Registry name, usually the source id.
53
+ :param factory: Callable returning a configured source.
54
+ :return: This registry, for chaining.
55
+ :raises SpecError: If the name is empty or already taken.
56
+ """
57
+ # 重名会让「按名字取源」变得取决于登记顺序,必须拒绝
58
+ if not name:
59
+ raise SpecError("registry name must not be empty")
60
+ if name in self._factories:
61
+ raise SpecError(f"source {name!r} is already registered")
62
+
63
+ # 只登记工厂:谁持有凭据与连接,谁负责构造
64
+ self._factories[name] = factory
65
+ return self
66
+
67
+ def names(self) -> tuple[str, ...]:
68
+ """
69
+ Return the registered names.
70
+
71
+ :return: Names in sorted order, so help output is stable.
72
+ """
73
+ # 排序让 CLI 与工具描述的输出可 diff
74
+ return tuple(sorted(self._factories))
75
+
76
+ def create(self, name: str, **kwargs: Any) -> Source:
77
+ """
78
+ Build the source registered under a name.
79
+
80
+ :param name: Registered name.
81
+ :param kwargs: Arguments forwarded to the factory.
82
+ :return: Configured source.
83
+ :raises SpecError: If the name is not registered.
84
+ """
85
+ # 未知名字要报出可用项,否则调用方只能去翻登记代码
86
+ factory = self._factories.get(name)
87
+ if factory is None:
88
+ raise SpecError(f"source {name!r} is not registered; known: {self.names()}")
89
+ return factory(**kwargs)
90
+
91
+ ############################################################################
92
+ # Utility Methods
93
+ ############################################################################
94
+ def sources(self) -> dict[str, Source]:
95
+ """
96
+ Build every registered source.
97
+
98
+ Safe because constructing a source performs no I/O — that invariant is
99
+ what makes an eager catalog possible at all.
100
+
101
+ :return: Name to source mapping.
102
+ """
103
+ # 构造无 IO,所以可以为了列目录而全部实例化
104
+ return {name: self._factories[name]() for name in self.names()}
105
+
106
+ def describe(self) -> list[dict[str, Any]]:
107
+ """
108
+ Describe every registered source and its datasets.
109
+
110
+ :return: One mapping per source with its id, description and datasets.
111
+ """
112
+ # 目录是公共产物:CLI、MCP 导出与自检都从这一份结构出发
113
+ described: list[dict[str, Any]] = []
114
+ for name, source in self.sources().items():
115
+ described.append(
116
+ {
117
+ "name": name,
118
+ "id": source.spec.id,
119
+ "description": source.spec.description,
120
+ "datasets": [
121
+ {
122
+ "name": spec.name,
123
+ "kind": spec.kind.value,
124
+ "description": spec.description,
125
+ "params": [param.name for param in spec.params],
126
+ "writable": spec.write is not None,
127
+ }
128
+ for spec in source.catalog()
129
+ ],
130
+ }
131
+ )
132
+ return described
@@ -0,0 +1,111 @@
1
+ ################################################################################
2
+ # @Project: datainfra
3
+ # @File Path: src/datainfra/contract/__init__.py
4
+ # @Description: Layer 0 contract: pure data types, ports and the error tree.
5
+ # @Creation Date: 2026-12-01
6
+ # @Last Update: 2026-12-02
7
+ ################################################################################
8
+
9
+ ################################################################################
10
+ # Import Libraries
11
+ ################################################################################
12
+ # Local Modules
13
+ from datainfra.contract.dataset import DatasetSpec, Kind, ParamSpec, SourceSpec
14
+ from datainfra.contract.errors import (
15
+ AuthError,
16
+ CapabilityError,
17
+ DataInfraError,
18
+ DatasetNotFoundError,
19
+ DecodeError,
20
+ ErrorStage,
21
+ ExportError,
22
+ MissingCredentialError,
23
+ PageLimitError,
24
+ ParamError,
25
+ PartialWriteError,
26
+ RateLimitError,
27
+ SchemaMismatchError,
28
+ SpecError,
29
+ TransportError,
30
+ WriteError,
31
+ )
32
+ from datainfra.contract.ports import (
33
+ AttemptStats,
34
+ Authenticator,
35
+ Encoder,
36
+ Policies,
37
+ RateLimiter,
38
+ Reader,
39
+ RequestView,
40
+ RetryStrategy,
41
+ Transport,
42
+ TransportCapabilities,
43
+ TransportRequest,
44
+ TransportResponse,
45
+ )
46
+ from datainfra.contract.provenance import Provenance
47
+ from datainfra.contract.query import Cursor, Query
48
+ from datainfra.contract.records import (
49
+ DecodedPage,
50
+ Field,
51
+ FieldType,
52
+ Record,
53
+ RecordBatch,
54
+ Schema,
55
+ register_exporter,
56
+ )
57
+ from datainfra.contract.secret import Secret
58
+ from datainfra.contract.write import WriteMode, WriteReceipt, WriteSpec
59
+
60
+ ################################################################################
61
+ # Module Constants
62
+ ################################################################################
63
+ # contract 层的导出面;这是整个库的词汇表,增删都属公共 API 变更
64
+ __all__ = [
65
+ "AttemptStats",
66
+ "AuthError",
67
+ "Authenticator",
68
+ "CapabilityError",
69
+ "Cursor",
70
+ "DataInfraError",
71
+ "DatasetNotFoundError",
72
+ "DatasetSpec",
73
+ "DecodeError",
74
+ "DecodedPage",
75
+ "Encoder",
76
+ "ErrorStage",
77
+ "ExportError",
78
+ "Field",
79
+ "FieldType",
80
+ "Kind",
81
+ "MissingCredentialError",
82
+ "PageLimitError",
83
+ "ParamError",
84
+ "ParamSpec",
85
+ "PartialWriteError",
86
+ "Policies",
87
+ "Provenance",
88
+ "Query",
89
+ "RateLimitError",
90
+ "RateLimiter",
91
+ "Reader",
92
+ "Record",
93
+ "RecordBatch",
94
+ "RequestView",
95
+ "RetryStrategy",
96
+ "Schema",
97
+ "SchemaMismatchError",
98
+ "Secret",
99
+ "SourceSpec",
100
+ "SpecError",
101
+ "Transport",
102
+ "TransportCapabilities",
103
+ "TransportError",
104
+ "TransportRequest",
105
+ "TransportResponse",
106
+ "WriteError",
107
+ "WriteMode",
108
+ "WriteReceipt",
109
+ "WriteSpec",
110
+ "register_exporter",
111
+ ]