conduit-connector-sdk 0.1.0.dev1__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 (42) hide show
  1. conduit_connector_sdk-0.1.0.dev1/.gitignore +30 -0
  2. conduit_connector_sdk-0.1.0.dev1/LICENSE +201 -0
  3. conduit_connector_sdk-0.1.0.dev1/PKG-INFO +245 -0
  4. conduit_connector_sdk-0.1.0.dev1/README.md +206 -0
  5. conduit_connector_sdk-0.1.0.dev1/examples/http-poll-source/README.md +31 -0
  6. conduit_connector_sdk-0.1.0.dev1/pyproject.toml +213 -0
  7. conduit_connector_sdk-0.1.0.dev1/src/conduit/__init__.py +40 -0
  8. conduit_connector_sdk-0.1.0.dev1/src/conduit/_batch.py +357 -0
  9. conduit_connector_sdk-0.1.0.dev1/src/conduit/_build.py +394 -0
  10. conduit_connector_sdk-0.1.0.dev1/src/conduit/_cli.py +85 -0
  11. conduit_connector_sdk-0.1.0.dev1/src/conduit/_dispatch.py +80 -0
  12. conduit_connector_sdk-0.1.0.dev1/src/conduit/_grpc/__init__.py +46 -0
  13. conduit_connector_sdk-0.1.0.dev1/src/conduit/_grpc/_controller.py +83 -0
  14. conduit_connector_sdk-0.1.0.dev1/src/conduit/_grpc/adapters.py +188 -0
  15. conduit_connector_sdk-0.1.0.dev1/src/conduit/_grpc/config/v1/parameter_pb2.py +43 -0
  16. conduit_connector_sdk-0.1.0.dev1/src/conduit/_grpc/config/v1/parameter_pb2.pyi +59 -0
  17. conduit_connector_sdk-0.1.0.dev1/src/conduit/_grpc/config/v1/parameter_pb2_grpc.py +4 -0
  18. conduit_connector_sdk-0.1.0.dev1/src/conduit/_grpc/connector/v2/destination_pb2.py +113 -0
  19. conduit_connector_sdk-0.1.0.dev1/src/conduit/_grpc/connector/v2/destination_pb2.pyi +145 -0
  20. conduit_connector_sdk-0.1.0.dev1/src/conduit/_grpc/connector/v2/destination_pb2_grpc.py +418 -0
  21. conduit_connector_sdk-0.1.0.dev1/src/conduit/_grpc/connector/v2/source_pb2.py +111 -0
  22. conduit_connector_sdk-0.1.0.dev1/src/conduit/_grpc/connector/v2/source_pb2.pyi +140 -0
  23. conduit_connector_sdk-0.1.0.dev1/src/conduit/_grpc/connector/v2/source_pb2_grpc.py +428 -0
  24. conduit_connector_sdk-0.1.0.dev1/src/conduit/_grpc/connector/v2/specifier_pb2.py +57 -0
  25. conduit_connector_sdk-0.1.0.dev1/src/conduit/_grpc/connector/v2/specifier_pb2.pyi +55 -0
  26. conduit_connector_sdk-0.1.0.dev1/src/conduit/_grpc/connector/v2/specifier_pb2_grpc.py +81 -0
  27. conduit_connector_sdk-0.1.0.dev1/src/conduit/_grpc/opencdc/v1/opencdc_pb2.py +49 -0
  28. conduit_connector_sdk-0.1.0.dev1/src/conduit/_grpc/opencdc/v1/opencdc_pb2.pyi +89 -0
  29. conduit_connector_sdk-0.1.0.dev1/src/conduit/_grpc/opencdc/v1/opencdc_pb2_grpc.py +4 -0
  30. conduit_connector_sdk-0.1.0.dev1/src/conduit/_handshake.py +222 -0
  31. conduit_connector_sdk-0.1.0.dev1/src/conduit/_introspect.py +49 -0
  32. conduit_connector_sdk-0.1.0.dev1/src/conduit/config.py +551 -0
  33. conduit_connector_sdk-0.1.0.dev1/src/conduit/destination.py +435 -0
  34. conduit_connector_sdk-0.1.0.dev1/src/conduit/errors.py +412 -0
  35. conduit_connector_sdk-0.1.0.dev1/src/conduit/record.py +274 -0
  36. conduit_connector_sdk-0.1.0.dev1/src/conduit/schema.py +176 -0
  37. conduit_connector_sdk-0.1.0.dev1/src/conduit/serve.py +623 -0
  38. conduit_connector_sdk-0.1.0.dev1/src/conduit/source.py +446 -0
  39. conduit_connector_sdk-0.1.0.dev1/src/conduit/testing/README.md +16 -0
  40. conduit_connector_sdk-0.1.0.dev1/src/conduit/testing/__init__.py +24 -0
  41. conduit_connector_sdk-0.1.0.dev1/src/conduit/testing/acceptance.py +446 -0
  42. conduit_connector_sdk-0.1.0.dev1/src/conduit/testing/fixtures.py +142 -0
@@ -0,0 +1,30 @@
1
+ # Python
2
+ __pycache__/
3
+ *.py[cod]
4
+ *.egg-info/
5
+ .eggs/
6
+ build/
7
+ dist/
8
+ .venv/
9
+ venv/
10
+
11
+ # Tooling caches
12
+ .mypy_cache/
13
+ .ruff_cache/
14
+ .pytest_cache/
15
+ .hypothesis/
16
+ htmlcov/
17
+ .coverage
18
+ .coverage.*
19
+
20
+ # uv
21
+ .uv/
22
+
23
+ # Editors / OS
24
+ .vscode/
25
+ .idea/
26
+ .DS_Store
27
+
28
+ # Generated protobuf/grpc stubs are checked in (vendored, see docs/design/) —
29
+ # do NOT ignore src/conduit/_grpc/**, but ignore ad hoc regeneration scratch.
30
+ buf-generate.log
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2022 Meroxa, Inc.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,245 @@
1
+ Metadata-Version: 2.5
2
+ Name: conduit-connector-sdk
3
+ Version: 0.1.0.dev1
4
+ Summary: Python SDK for building Conduit source and destination connectors.
5
+ Project-URL: Homepage, https://github.com/ConduitIO/conduit-connector-sdk-python
6
+ Project-URL: Repository, https://github.com/ConduitIO/conduit-connector-sdk-python
7
+ Project-URL: Issues, https://github.com/ConduitIO/conduit-connector-sdk-python/issues
8
+ Author: Conduit contributors
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Keywords: cdc,conduit,connector,grpc,sdk
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: Apache Software License
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Software Development :: Libraries
19
+ Requires-Python: >=3.11
20
+ Requires-Dist: grpcio-health-checking<2,>=1.75
21
+ Requires-Dist: grpcio<2,>=1.75
22
+ Requires-Dist: packaging<26,>=23
23
+ Requires-Dist: protobuf<8,>=6.31
24
+ Requires-Dist: pydantic<3,>=2.7
25
+ Provides-Extra: avro
26
+ Requires-Dist: fastavro<2,>=1.9; extra == 'avro'
27
+ Provides-Extra: dev
28
+ Requires-Dist: grpc-stubs<2,>=1.24; extra == 'dev'
29
+ Requires-Dist: grpcio-tools<2,>=1.75; extra == 'dev'
30
+ Requires-Dist: httpx<1,>=0.27; extra == 'dev'
31
+ Requires-Dist: hypothesis<7,>=6.120; extra == 'dev'
32
+ Requires-Dist: mypy<2,>=1.15; extra == 'dev'
33
+ Requires-Dist: pytest-asyncio<1,>=0.25; extra == 'dev'
34
+ Requires-Dist: pytest-timeout<3,>=2.3; extra == 'dev'
35
+ Requires-Dist: pytest<9,>=8.3; extra == 'dev'
36
+ Requires-Dist: ruff<1,>=0.14; extra == 'dev'
37
+ Requires-Dist: types-protobuf<7,>=6.30; extra == 'dev'
38
+ Description-Content-Type: text/markdown
39
+
40
+ # conduit-connector-sdk (Python)
41
+
42
+ Python SDK for building [Conduit](https://github.com/ConduitIO/conduit) source and
43
+ destination connectors. Connectors built with this SDK run as standalone gRPC
44
+ subprocess plugins — no changes to Conduit itself are required to run one.
45
+
46
+ > **Status: pre-alpha, under active development.** No release has shipped yet.
47
+ > The public API (`Source`, `Destination`, `Config`, `Record`) is not stable
48
+ > until the v0.19 Phase-1 acceptance criteria in
49
+ > [`docs/design/20260707-python-connector-sdk.md`](docs/design/20260707-python-connector-sdk.md)
50
+ > are met. Treat everything here as subject to change without a deprecation
51
+ > notice until then.
52
+ >
53
+ > **What "GA" means for this repo's first tagged release (v0.20 plan, WS2),
54
+ > stated precisely so it isn't over-read:** GA here means exactly two
55
+ > things -- the acceptance suite (`conduit.testing.acceptance`) is green in
56
+ > CI, and a first tag is published via PyPI Trusted Publishing. It does
57
+ > **not** mean production hardening, edge-case parity with the Go SDK, or a
58
+ > 1.0. The value of that tag is narrow and specific: it unblocks the Rust
59
+ > SDK build, which waits on a *tagged release* existing, not on a merge to
60
+ > `main`. Read every claim in this README with that scope in mind.
61
+
62
+ ## What this is
63
+
64
+ - A gRPC client/server implementation of `conduit-connector-protocol` v2
65
+ (`SourcePlugin` / `DestinationPlugin` / `SpecifierPlugin`), wrapped in an
66
+ idiomatic Python API: `async`/`await` connector methods (with sync-method
67
+ auto-dispatch to a thread pool), `pydantic`-based config with automatic
68
+ parameter introspection, and a `bytes | dict` OpenCDC record model instead of
69
+ Go's `Data` interface.
70
+ - The Python analog of [`conduit-connector-sdk`](https://github.com/ConduitIO/conduit-connector-sdk)
71
+ (Go). Behavioral parity is a goal; API-shape parity is not — see the design
72
+ doc's "Alternatives considered" section for why.
73
+
74
+ ## Batching (`sdk.batch.size` / `sdk.batch.delay`)
75
+
76
+ Every connector gets two SDK-injected config parameters for free -- authors
77
+ never declare them on their own `BaseConfig` -- matching the Go SDK's
78
+ `DestinationWithBatch`/`SourceWithBatch` middleware exactly:
79
+
80
+ - `sdk.batch.size` (int, default `0`): maximum records per batch before an
81
+ early flush.
82
+ - `sdk.batch.delay` (Go-duration string, default `0s`): maximum time an
83
+ incomplete batch waits before flushing.
84
+
85
+ **Activation threshold, matched exactly from the Go SDK:** batching is only
86
+ active when `size > 1` or `delay > 0`. A `size` of `0` *or* `1` with no
87
+ delay is passthrough -- no accumulation, no background task, one wire
88
+ message in for one wire message/record out (Go's `destination.go:182`/
89
+ `source_middleware.go:709` condition, reproduced verbatim, not rounded to a
90
+ more "intuitive" `size >= 1`).
91
+
92
+ **On the source side**, this SDK's `Source` ABC has no `read_batch`/`ReadN`
93
+ override point yet (deferred past this phase), so batching buffers
94
+ individual `read()` calls -- Go's own *fallback* behavior when a connector
95
+ doesn't implement `ReadN`, not its optimized path. This is a real, current
96
+ capability gap versus Go, documented (not hidden) in
97
+ `conduit/_batch.py`'s module docstring.
98
+
99
+ **On the destination side**, incoming `Run` batches are flattened and
100
+ re-grouped by size/delay before `write()` is called -- so `write()` may now
101
+ receive a batch spanning several incoming wire messages. A buffered-but-
102
+ below-threshold remainder is always flushed (written and acked) when the
103
+ stream ends or `Stop()` drains the connector -- batching never drops
104
+ records, per invariant 3 (at-least-once is the floor).
105
+
106
+ ## Avro schema support
107
+
108
+ `conduit.schema.AvroSchema` (optional -- install with
109
+ `conduit-connector-sdk[avro]`) encodes/decodes plain, headerless Avro
110
+ binary -- the exact wire format `conduit-commons`' `schema/avro` package
111
+ produces via `github.com/hamba/avro/v2` (**not** the Confluent Schema
112
+ Registry wire format; there's no magic-byte/schema-ID header on either
113
+ side). This is a cross-language compatibility claim, proven against golden
114
+ bytes an actual Go program produced with `hamba/avro/v2` directly, not a
115
+ Python-only round-trip -- see `tests/test_schema_avro.py` and
116
+ `tests/testdata/avro_golden.json`.
117
+
118
+ This SDK does **not** ship a schema registry client (no `SchemaService`
119
+ gRPC stubs are generated) -- an author supplies schema text themselves and
120
+ is responsible for keeping it consistent with the
121
+ `opencdc.{key,payload}.schema.{subject,version}` record metadata (see
122
+ `conduit.record.Metadata.set_payload_schema`/`get_payload_schema`).
123
+
124
+ ## What this is not (yet)
125
+
126
+ See the design doc's Phase 2/3 breakdown for what's still deliberately
127
+ deferred: a `read_batch`/`ReadN` override point for source connectors (see
128
+ "Batching" above for the current fallback-only behavior), a schema registry
129
+ client, the acceptance-test harness's full test corpus beyond the current
130
+ categories, and any performance claim versus the Go SDK (none ships without
131
+ a committed `benchi` result, per the org's CLAUDE.md).
132
+
133
+ ## Delivery semantics
134
+
135
+ What this SDK guarantees, and — just as important — what it does not:
136
+
137
+ **Guaranteed:**
138
+
139
+ - **At-least-once.** A source record is never acknowledged to the
140
+ connector's own `ack()` hook until Conduit's `Run` stream sends its
141
+ position back via `ack_positions` (never speculatively when the record is
142
+ merely produced) -- see `conduit.source._SourceServicer._consume_acks`.
143
+ - **No silent partial-batch acking.** A destination write failure never
144
+ assumes an unmentioned record succeeded -- `write()` either returns
145
+ cleanly (full-batch success), raises `BatchWriteError` with an exhaustive,
146
+ construction-time-validated per-index accounting, or (any other
147
+ exception) nacks the *entire* batch. There is no code path that infers
148
+ "everything not explicitly marked as failed" succeeded — see
149
+ `conduit.errors.BatchWriteError` and `conduit.destination._DestinationServicer._write_batch`.
150
+ - **Batching never drops records.** A buffered-but-below-threshold
151
+ remainder is always flushed (and, on the destination side, acked) before
152
+ a controlled shutdown (stream end, `Stop()`, or a SIGTERM-triggered
153
+ drain) completes.
154
+ - **Graceful shutdown by default.** SIGTERM drains an in-flight read/write
155
+ loop (including any buffered batch) before `teardown()` runs, bounded by
156
+ a watchdog so a genuinely wedged connector still exits.
157
+
158
+ **Not guaranteed / explicit limits:**
159
+
160
+ - **Positions/state are the connector author's responsibility.** This SDK
161
+ round-trips whatever `bytes` a `Source.read()`/`open()` implementation
162
+ returns; it does not itself provide crash-safe position storage.
163
+ - **A hard-cancelled (not drained) `Run` can lose a buffered-but-unflushed
164
+ batching remainder.** The controlled shutdown paths above (stream end,
165
+ `Stop()`, SIGTERM-triggered drain) all flush correctly; an externally
166
+ torn-down RPC (e.g. the framework cancelling the whole call, not a normal
167
+ drain) is a documented, narrow-window exception -- see
168
+ `conduit._batch.collect_batches`'s docstring for exactly why and how this
169
+ mirrors an already-accepted tradeoff elsewhere in this SDK (an in-flight,
170
+ never-acked write on a hard stop).
171
+ - **No exactly-once.** Like the Go SDK, redelivery on restart is possible;
172
+ connectors must tolerate at-least-once delivery.
173
+ - **Structured (`dict`) payloads lose precision on integers beyond `2**53`**
174
+ (via `google.protobuf.Struct`'s double-precision representation) --
175
+ silently, by design of the wire format, not a bug in this SDK. Pinned by
176
+ `tests/test_record_codec.py`.
177
+ - **No schema registry integration, no schema evolution/compatibility
178
+ checking** -- see "Avro schema support" above.
179
+
180
+ ## Requirements
181
+
182
+ - Python 3.11+
183
+ - [`uv`](https://docs.astral.sh/uv/) for dependency management (recommended;
184
+ `pip install -e .[dev]` also works)
185
+
186
+ ## Repo layout
187
+
188
+ ```text
189
+ src/conduit/
190
+ __init__.py # public API surface
191
+ config.py # BaseConfig, Field, to_parameters()
192
+ record.py # Record / Change / Operation / Metadata
193
+ schema.py # AvroSchema -- optional, `conduit-connector-sdk[avro]`
194
+ source.py # Source ABC
195
+ destination.py # Destination ABC
196
+ _batch.py # sdk.batch.size/delay middleware (source + destination)
197
+ serve.py # handshake + gRPC server bootstrap
198
+ _handshake.py # magic cookie, protocol negotiation, stdout line
199
+ _build.py # `conduit-connector-sdk build` implementation
200
+ _cli.py # `conduit-connector-sdk` console-script entry point
201
+ _grpc/ # generated protobuf/grpc stubs (buf generate output)
202
+ testing/ # acceptance-test harness (acceptance.py, fixtures.py)
203
+ examples/http-poll-source/ # worked example connector
204
+ docs/design/ # design docs for this repo
205
+ tests/ # unit tests
206
+ ```
207
+
208
+ ## Building a standalone connector artifact
209
+
210
+ Conduit launches a standalone connector as a subprocess with a **clean
211
+ environment** — no inherited `PATH` (design doc §1.1.6). A `pip
212
+ install`-then-shebang-script connector (`#!/usr/bin/env python3`, or an
213
+ activated venv) cannot launch this way: there's no `PATH` for `env` to
214
+ search. `conduit-connector-sdk build` closes that gap:
215
+
216
+ ```shell
217
+ conduit-connector-sdk build examples/http-poll-source -o http-poll-source.pyz
218
+ ./http-poll-source.pyz # directly executable — no `python` prefix, no venv activation
219
+ ```
220
+
221
+ This produces one file with an **absolute** interpreter shebang (resolved
222
+ at build time, never looked up via `PATH`), bundling every third-party
223
+ dependency your connector needs — including compiled-extension
224
+ dependencies like `grpcio`/`pydantic`'s `pydantic-core`, which a plain
225
+ [`zipapp`](https://docs.python.org/3/library/zipapp.html) can't load
226
+ in-place: the artifact extracts itself to a per-build cache directory on
227
+ first run (the same fundamental approach `shiv`/`pex` use), then executes
228
+ your connector's real entry point from those extracted files. Later
229
+ launches of the same build reuse the cache.
230
+
231
+ **Precondition:** run `build` from an environment where your connector's
232
+ own dependencies are already installed (however you installed them — pip,
233
+ uv, poetry) — it vendors from what's already resolved, not a fresh
234
+ `pip install`. See `conduit/_build.py`'s module docstring for the full
235
+ rationale and known limitations.
236
+
237
+ ## Contributing
238
+
239
+ See [CONTRIBUTING.md](CONTRIBUTING.md). This SDK sits on Conduit's data path —
240
+ read [`docs/design/20260707-python-connector-sdk.md`](docs/design/20260707-python-connector-sdk.md)
241
+ before proposing changes to the wire adapter, ack/nack logic, or handshake.
242
+
243
+ ## License
244
+
245
+ [Apache License 2.0](LICENSE).