tether-vcs 0.1.0__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.
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,398 @@
1
+ Metadata-Version: 2.4
2
+ Name: tether-vcs
3
+ Version: 0.1.0
4
+ Summary: jj-style version control for heterogeneous datasets (files/object stores, Icechunk, Neon, Iceberg, Delta, Lance, lakeFS, DuckLake, Dolt, git)
5
+ Keywords: version-control,data-versioning,icechunk,iceberg,neon,delta-lake,lance,lakefs,ducklake,dolt,jujutsu
6
+ Author: tether contributors
7
+ License-Expression: Apache-2.0
8
+ License-File: LICENSE
9
+ Classifier: Development Status :: 3 - Alpha
10
+ Classifier: Intended Audience :: Developers
11
+ Classifier: Programming Language :: Python :: 3 :: Only
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Topic :: Software Development :: Version Control
16
+ Classifier: Typing :: Typed
17
+ Requires-Dist: tomlkit>=0.12
18
+ Requires-Dist: typer>=0.12 ; extra == 'all'
19
+ Requires-Dist: obstore>=0.11 ; extra == 'all'
20
+ Requires-Dist: icechunk>=1.0 ; extra == 'all'
21
+ Requires-Dist: httpx>=0.27 ; extra == 'all'
22
+ Requires-Dist: psycopg[binary]>=3.1 ; extra == 'all'
23
+ Requires-Dist: pyiceberg>=0.10 ; extra == 'all'
24
+ Requires-Dist: pyarrow>=15 ; extra == 'all'
25
+ Requires-Dist: deltalake>=1.0 ; extra == 'all'
26
+ Requires-Dist: pylance>=1.0 ; extra == 'all'
27
+ Requires-Dist: lakefs>=0.8 ; extra == 'all'
28
+ Requires-Dist: duckdb>=1.3 ; extra == 'all'
29
+ Requires-Dist: pymysql>=1.1 ; extra == 'all'
30
+ Requires-Dist: obstore>=0.11 ; extra == 'azure'
31
+ Requires-Dist: typer>=0.12 ; extra == 'cli'
32
+ Requires-Dist: deltalake>=1.0 ; extra == 'delta'
33
+ Requires-Dist: pymysql>=1.1 ; extra == 'dolt'
34
+ Requires-Dist: duckdb>=1.3 ; extra == 'ducklake'
35
+ Requires-Dist: obstore>=0.11 ; extra == 'gcs'
36
+ Requires-Dist: pyiceberg>=0.10 ; extra == 'iceberg'
37
+ Requires-Dist: pyarrow>=15 ; extra == 'iceberg'
38
+ Requires-Dist: icechunk>=1.0 ; extra == 'icechunk'
39
+ Requires-Dist: lakefs>=0.8 ; extra == 'lakefs'
40
+ Requires-Dist: pylance>=1.0 ; extra == 'lance'
41
+ Requires-Dist: httpx>=0.27 ; extra == 'neon'
42
+ Requires-Dist: psycopg[binary]>=3.1 ; extra == 'neon'
43
+ Requires-Dist: obstore>=0.11 ; extra == 'objectstore'
44
+ Requires-Dist: obstore>=0.11 ; extra == 's3'
45
+ Requires-Python: >=3.11
46
+ Project-URL: Homepage, https://evanlyall.com/tether/
47
+ Project-URL: Documentation, https://evanlyall.com/tether/
48
+ Project-URL: Repository, https://github.com/elyall/tether
49
+ Project-URL: Changelog, https://github.com/elyall/tether/blob/main/CHANGELOG.md
50
+ Provides-Extra: all
51
+ Provides-Extra: azure
52
+ Provides-Extra: cli
53
+ Provides-Extra: delta
54
+ Provides-Extra: dolt
55
+ Provides-Extra: ducklake
56
+ Provides-Extra: gcs
57
+ Provides-Extra: iceberg
58
+ Provides-Extra: icechunk
59
+ Provides-Extra: lakefs
60
+ Provides-Extra: lance
61
+ Provides-Extra: neon
62
+ Provides-Extra: objectstore
63
+ Provides-Extra: s3
64
+ Description-Content-Type: text/markdown
65
+
66
+ # tether
67
+
68
+ **jj-style version control for heterogeneous datasets.**
69
+
70
+ > Status: alpha. See the [changelog](https://github.com/elyall/tether/blob/main/CHANGELOG.md).
71
+ >
72
+ > State: vibe coded with Claude Fable 5.1. **USE AT YOUR OWN RISK.**
73
+
74
+ `tether` ties heterogeneous data objects -- files and object-store prefixes (S3,
75
+ GCS, Azure), [Icechunk](https://icechunk.io) repositories, [Neon](https://neon.com)
76
+ Postgres databases, [Apache Iceberg](https://iceberg.apache.org) tables,
77
+ [Delta Lake](https://delta.io) tables, [Lance](https://lance.org) datasets,
78
+ [lakeFS](https://lakefs.io) repositories, [DuckLake](https://ducklake.select)
79
+ catalogs, [Dolt](https://www.dolthub.com) databases, and git/[jj](https://jj-vcs.dev)
80
+ repositories -- to the commits of an existing git or jj repository.
81
+
82
+ A `tether commit` records each object's state and, for systems that support it,
83
+ creates a durable native reference (an Icechunk tag, a Neon child branch, a git
84
+ tag, an Iceberg tag, a Lance tag, a lakeFS tag, a Dolt tag) so the exact state
85
+ can be recovered and branched from later.
86
+ `tether new` forks fresh writable branches off any committed state. The VCS
87
+ supplies history, undo, bookmarks, workspaces, and sharing; `tether` only
88
+ implements what is novel: cross-system fan-out, drift detection, and the
89
+ pin/fork lifecycle.
90
+
91
+ Think of it as **DVC for *branchable* systems**: like DVC it commits small
92
+ manifests into your git/jj repo, but where DVC only fingerprints files, tether
93
+ also *pins* and *forks* live systems.
94
+
95
+ Documentation: <https://evanlyall.com/tether/> -- user guide (getting
96
+ started, concepts, pinning, branching and writing, CLI, configuration,
97
+ backends, writing a backend) plus the generated API and CLI reference. The
98
+ guide sources live in [`user_guide/`](https://github.com/elyall/tether/tree/main/user_guide).
99
+
100
+ ## Why this exists (prior art)
101
+
102
+ Every existing tool versions a single layer:
103
+
104
+ | Tool | Scope | Relationship to tether |
105
+ | --- | --- | --- |
106
+ | lakeFS, Quilt, Oxen, DataChain | objects / files | analog of our `file` objects; lakeFS is also a backend |
107
+ | **DVC** (lakeFS-owned) | files/objects in git | closest structural analog; no pin/fork of live systems |
108
+ | Dolt, pgGit, Neon, Databricks Lakebase | one database | vendor-bound; no external-object pins; Dolt and Neon are backends |
109
+ | Nessie, Bauplan | Iceberg catalog branching | Iceberg-only |
110
+ | Icechunk, Lance, Delta, DuckLake | one dataset / table / catalog | we use them as backends |
111
+ | [Yggdrasil](https://github.com/replikativ/yggdrasil) (replikativ) | cross-system: Clojure protocol stack (snapshot / branch / merge / watch) over Git, ZFS, Btrfs, IPFS, Iceberg, Datahike, lakeFS, Dolt, Podman, with an HLC-coordinated workspace | the closest conceptual sibling; not adoptable from Python (JVM library; its own README marks the Python binding as unmaintained since the initial release) |
112
+ | Dagster observable assets | staleness detection | analog of our snapshot/drift step; no branching |
113
+
114
+ Nothing provides unified version control *across* files + Icechunk + Postgres +
115
+ Iceberg with pinning and forking. So tether borrows jj's working-copy model
116
+ (fingerprint, snapshot on every command, stale-working-copy detection), DVC's
117
+ manifests-in-VCS layout, and [Yggdrasil](https://github.com/replikativ/yggdrasil)'s
118
+ observe-then-record shape (a workspace that watches independent systems and
119
+ records their snapshots, rather than a store that holds the data).
120
+
121
+ ## Install
122
+
123
+ ```bash
124
+ pip install tether-vcs[cli] # core + CLI
125
+ pip install tether-vcs[cli,icechunk,neon] # add backends you need
126
+ pip install tether-vcs[all] # everything
127
+ ```
128
+
129
+ The distribution is `tether-vcs` (PyPI reserves the bare name); the package you
130
+ import and the command you run are both `tether`.
131
+
132
+ Extras: `cli`, `objectstore` (S3/GCS/Azure for `file`; `s3`/`gcs`/`azure` are
133
+ aliases), `icechunk`, `neon`, `iceberg`, `delta`, `lance`, `lakefs`, `ducklake`,
134
+ `dolt`, `all`. `git`/`jj` must be on `PATH`.
135
+
136
+ ## Quickstart
137
+
138
+ ```bash
139
+ tether init
140
+ tether add zarr/imaging --kind icechunk s3://bucket/imaging.zarr.icechunk --write fork
141
+ tether add db/rosebud --kind neon --project-id prj-123 --database neondb --role runner
142
+ tether add raw/plate1 --kind file s3://bucket/raw/plate1/ # Observed unless versioned
143
+ tether add raw/manifest --kind file gs://bucket/manifest.csv --file versioned # Addressable
144
+ tether add features --kind lance s3://bucket/features.lance
145
+ tether add events --kind delta s3://bucket/events # Addressable (retention-bound)
146
+ tether add lake --kind lakefs --repository analytics --branch main --prefix raw/
147
+ tether add warehouse --kind ducklake ducklake:postgres:dbname=lake --table events
148
+ tether add ledger --kind dolt --host dolt.internal --database ledger --branch main
149
+ tether add code --kind git . --remote origin
150
+
151
+ tether status # fan-out: modified / unpinned / drifted per object
152
+ tether commit -m "Baseline imaging + metrics" # pins, writes manifests, jj/git commit
153
+ tether new main # fork fresh writable branches off main's pins
154
+ tether open db/rosebud # -> postgresql://...tether.ws.ab12cd34...
155
+ tether open zarr/imaging -r main # read-only handle at main's pinned tag
156
+ tether diff main @ --content # what changed inside each object, natively
157
+ tether verify --all-history --deep
158
+ tether gc --dry-run
159
+ ```
160
+
161
+ Python:
162
+
163
+ ```python
164
+ from tether import Repo
165
+
166
+ repo = Repo.find(".")
167
+ repo.status()
168
+ repo.commit("baseline")
169
+ repo.new("main")
170
+ handle = repo.open("zarr/imaging") # writable IcechunkHandle
171
+ session = handle.session # native icechunk session
172
+ ro = repo.open("zarr/imaging", rev="main") # read-only at the pinned tag
173
+ ```
174
+
175
+ Set `TETHER_REV=<vcs rev>` and `repo.open(key)` defaults to a read-only handle at
176
+ that commit's pinned state -- convenient for downstream, reproducible reads.
177
+
178
+ ## Concept map (jj / DVC -> tether)
179
+
180
+ | jj / DVC | tether |
181
+ | --- | --- |
182
+ | working copy | the VCS working dir; the committed thing is the manifests |
183
+ | `TreeState.snapshot()` | **snapshot**: concurrent fan-out fingerprint -> `workspace.toml` |
184
+ | `commit` | **pin** fan-out + write state into manifests + `jj/git commit` |
185
+ | `new <rev>` | checkout + **fork** fan-out (fresh writable branch per object) |
186
+ | stale working copy | manifest hash recorded at fork; differs from HEAD => refuse writes |
187
+ | bookmarks / op log / undo / workspaces / push | delegated to the VCS |
188
+ | `.dvc` files | `.tether/objects/<key>.toml` (committed) |
189
+ | `jj diff` | **diff**: object-level manifest diff; `--content` asks each backend for its native diff (files, tables, arrays, fragments, commits) |
190
+ | -- | **verify** (pins still resolve) and **gc** (drop unreferenced pins) |
191
+
192
+ ## Repository layout
193
+
194
+ ```
195
+ <dataset-root>/
196
+ tether.toml # committed: snapshot.auto (CLI snapshots by default), verify.on_status,
197
+ # new.auto_fork (commit re-forks working refs), default policies,
198
+ # backend options, credential *references*
199
+ .tether/
200
+ .gitignore # ignores workspace.toml
201
+ objects/<key>.toml # committed, one per object: kind, locator, policy, state, pin
202
+ listings/<hash>.jsonl # committed, content-addressed per-file listings for directory/prefix
203
+ # states (so `diff --content` can compare them); pruned by gc
204
+ workspace.toml # untracked: workspace_id, base manifest hash, working refs, last snapshot
205
+ ```
206
+
207
+ `pin_id = blake2b(kind, locator identity, state)[:12]`; the native ref is
208
+ `tether.<pin_id>`. Identical state yields the same pin, so re-committing an
209
+ unchanged object is a no-op and identical states dedupe to one pin.
210
+
211
+ ## Capability tiers
212
+
213
+ Backends declare capabilities; commands degrade explicitly by tier.
214
+
215
+ - **Observed** (`FINGERPRINT`): drift detection only. `commit` records state and
216
+ marks it `recoverable = false`. E.g. a local file by mtime/size.
217
+ - **Addressable** (`+ ADDRESSABLE`): an immutable version id can be read later;
218
+ `open -r <rev>` works, nothing to create or GC. E.g. an S3 object in a
219
+ versioned bucket, a Delta table version.
220
+ - **Pinnable** (`+ PIN`): can create/delete a durable, GC-proof ref; `commit`
221
+ pins, `verify`/`gc` apply. E.g. an Icechunk tag.
222
+ - **Forkable** (`+ FORK`): a writable branch can be created off a pin; `new`
223
+ forks, `open` returns a writable handle. E.g. Icechunk, Neon, Iceberg, Lance,
224
+ lakeFS, Dolt, git/jj.
225
+
226
+ Orthogonal flags: `CHEAP_FINGERPRINT`, `RETENTION_BOUND`, `NEEDS_QUIESCENCE`,
227
+ `ATOMIC_REF`, `DIFF` (the backend can describe what changed between two
228
+ recorded states; see [Content diffs](#content-diffs)).
229
+
230
+ ### Compatibility matrix
231
+
232
+ | Backend | Max tier | State | Pin | Fork | Notable flags / caveats |
233
+ | --- | --- | --- | --- | --- | --- |
234
+ | `file` (local) | Observed | size, mtime_ns (or dir digest) | -- | -- | `CHEAP`; immutable-by-default, drift is an error |
235
+ | `file` (S3 / GCS / Azure object) | Addressable | size, etag, version_id | -- | -- | `CHEAP`; `--file versioned` on a versioning-enabled bucket; one `HEAD` |
236
+ | `file` (S3 / GCS / Azure prefix) | Observed | count, size, etag digest | -- | -- | `CHEAP`; one paged `LIST`, no per-object calls |
237
+ | `icechunk` | Forkable | snapshot_id | tag | branch | `ATOMIC_REF`; tags immutable, excluded from expiry |
238
+ | `neon` | Forkable | lsn, next_xid | protected child branch @ parent_lsn | child of pin | `NEEDS_QUIESCENCE`, `RETENTION_BOUND`; no merge/promote, leaf-only gc, quotas |
239
+ | `git` / `jj` | Forkable | sha, change_id, dirty | tag (pushed if `remote`) | branch | `CHEAP`, `ATOMIC_REF`; local path only for now |
240
+ | `iceberg` | Forkable | snapshot_id, metadata_location | tag (`native`) or recorded id (`record`) | branch | `RETENTION_BOUND`; `record` for S3 Tables (no native ref) |
241
+ | `delta` | Addressable | version, table_id | -- | -- | `CHEAP`, `RETENTION_BOUND`; no native tags; `VACUUM`/log retention bound readability |
242
+ | `lance` | Forkable | branch, version | tag on (branch, version) | branch | `ATOMIC_REF`; tagged versions exempt from cleanup; version numbers are branch-scoped |
243
+ | `lakefs` | Forkable | commit_id (+ dirty) | tag | branch | `CHEAP`, `ATOMIC_REF`; repo-wide pins, `prefix` scopes the handle |
244
+ | `ducklake` | Addressable | snapshot_id, snapshot_time_us | -- | -- | `CHEAP`, `RETENTION_BOUND`; catalog-wide snapshots; `ducklake_expire_snapshots` bounds readability |
245
+ | `dolt` | Forkable | commit (+ dirty) | tag | branch | `ATOMIC_REF`; over MySQL protocol to `dolt sql-server`; handles are `db/ref` revision URLs |
246
+ | `memory` | Forkable | snapshot_id | tag | branch | reference impl for tests |
247
+
248
+ Command requirements: `status`/`snapshot`/`verify` need `FINGERPRINT`; `commit`
249
+ pins `PIN` objects (records `ADDRESSABLE`, records + warns for Observed, or fails
250
+ with `--strict`); `new` forks `FORK` objects; `gc` applies to `PIN` objects;
251
+ `diff --content` applies to `DIFF` objects.
252
+
253
+ ### Content diffs
254
+
255
+ `tether diff A B` compares manifests: which objects were added, removed, or
256
+ changed (with pin ids). `--content` additionally asks each changed object's
257
+ backend for its *native* diff, using metadata only (no data is read), run
258
+ concurrently across objects:
259
+
260
+ | Backend | Unit | Source | Example detail |
261
+ | --- | --- | --- | --- |
262
+ | `file` (dir / prefix) | files | two stored listings (`.tether/listings/`) | `modified a.tif +4.0 KiB` |
263
+ | `file` (object) | objects | recorded size / etag / version | `etag a -> b, version v1 -> v2` |
264
+ | `git` / `jj` | files | `git diff --name-status` + `--numstat` | `modified main.py +1 -1` |
265
+ | `icechunk` | nodes | `Repository.diff(from, to)` | `modified /x 2 chunks` |
266
+ | `iceberg` | snapshots | snapshot summaries along `b`'s ancestry to `a` | `append: +5 rows, +1 files` |
267
+ | `delta` | commits | transaction-log `history()` in `(a, b]` | `WRITE: +2 rows, +1 files` |
268
+ | `lance` | fragments | fragment ids / deletions / schema at both versions | `added fragment 1 +1 rows` |
269
+ | `lakefs` | objects | server-side `Reference.diff`, scoped to `prefix` | `added raw/c.bin 1 B` |
270
+ | `ducklake` | tables | snapshot `changes` + `ducklake_table_changes` | `modified main.t +5000 rows, -1 rows` |
271
+ | `dolt` | tables | `dolt_diff_summary` + `dolt_diff_stat` | `modified t +6 rows` |
272
+ | `neon` | -- | no native diff; not supported (yet) | |
273
+
274
+ Directory and prefix states are digests, so the `file` backend hands the
275
+ engine a per-file listing at commit time; it is stored content-addressed under
276
+ `.tether/listings/` and committed with the manifests (the same trick as DVC's
277
+ `.dir` files). Diffs of commits made before listings existed fall back to a
278
+ count/size summary. `gc` removes listings no manifest references. Entries are
279
+ capped at 2000 per object; counts are exact.
280
+
281
+ ## Writing a backend
282
+
283
+ Implement the `ObjectBackend` protocol (`tether.backends.base`): declare
284
+ `kind` and `capabilities`, then `identity`, `fingerprint`, `pin`, `unpin`,
285
+ `list_pins`, `verify`, `fork`, `delete_working_ref`, and `open`. A backend whose
286
+ tier varies per object (like `file`) can override
287
+ `effective_capabilities(locator, policy)`. To support `diff --content`, add
288
+ `DIFF` and implement `diff(locator, a, b, *, listings)` returning an
289
+ `ObjectDiff`; if your state is a digest, also implement `listing(locator,
290
+ state)` and the engine will store and hand back the text. Register it with
291
+ `register_backend`.
292
+
293
+ Validate it against the importable conformance suite:
294
+
295
+ ```python
296
+ from tether.testing import run_conformance
297
+
298
+
299
+ class MyHarness:
300
+ capabilities = ... # optional; defaults to backend.capabilities
301
+ backend = MyBackend()
302
+
303
+ def new_object(self): ... # create a fresh system, return a locator
304
+ def mutate(self, locator, working_ref): ... # change current state
305
+
306
+
307
+ run_conformance(MyHarness()) # runs only the tier-appropriate checks
308
+ ```
309
+
310
+ ## Caveats
311
+
312
+ - **No cross-system atomicity.** A commit records each object's state within a
313
+ capture window; point-consistency requires quiesced writers (the Neon check
314
+ helps; `tether commit` refuses while writers are active unless `--force`).
315
+ - **Pin-then-commit ordering.** Pins are created before the VCS commit; if the
316
+ commit never lands, pins leak until `gc` (which scans VCS history + the current
317
+ workspace). Re-run `tether verify` after merging manifests across branches.
318
+ - **Neon lineage.** Pins are child branches, so a working branch can't be deleted
319
+ while its pins exist, `gc` only drops leaf pins, and fork-per-`new` deepens the
320
+ tree. Neon cannot merge/promote a child into `main`; use `--write track` on
321
+ `main` for production. `protected` needs a paid plan; branch quotas vary.
322
+ - **Neon fingerprint noise/cost.** LSN moves without user writes (`next_xid` is
323
+ the real change signal); snapshot may wake a suspended compute. Use
324
+ `--no-snapshot` to skip.
325
+ - **Files on unversioned storage** are Observed: detectably but not recoverably
326
+ drifted. Bucket/container versioning promotes single objects to Addressable;
327
+ prefixes stay Observed (tether does not record per-object version ids).
328
+ Object-store credentials come from the environment; `[backends.file]
329
+ storage_options` in `tether.toml` passes non-secret options (region,
330
+ endpoint, account name) to obstore.
331
+ - **Iceberg catalog variance.** S3 Tables disables maintenance when user refs
332
+ exist; use `--pin record` there.
333
+ - **Delta has no refs.** Versions are recorded, not pinned; `VACUUM` (7-day
334
+ default) and log retention (30 days) bound how long `open -r` works. A
335
+ recreated table (new metadata id) verifies as drifted, not re-addressed.
336
+ - **Lance versions are branch-scoped.** State is `(branch, version)`; an
337
+ untouched fork reports its parent's address so no-op commits stay no-ops.
338
+ Lance refuses to delete a branch a tag references, so a pinned working branch
339
+ outlives its workspace until `gc` drops the tag (a re-fork picks `name.2`).
340
+ - **lakeFS staging.** Uncommitted lakeFS changes are not in any commit; a dirty
341
+ branch is reported in `status` and refused at `commit`.
342
+ - **DuckLake attachments.** A DuckDB-file metadata catalog can be attached only
343
+ once per process, so tether attaches per operation and a `DuckLakeHandle` owns
344
+ its attachment: `close()` it (or use it as a context manager) before the next
345
+ `status`, and don't hold your own writer connection open in the same process.
346
+ Postgres/SQLite/MySQL catalogs have no such limit. Snapshots are catalog-wide;
347
+ `table` only scopes the handle. Put `CREATE SECRET` statements in
348
+ `[backends.ducklake] init_sql` rather than credentials in the locator.
349
+ - **Dolt working sets.** Uncommitted changes on a branch are not in any commit;
350
+ a dirty branch is reported and refused at `commit`. The password comes from
351
+ `$DOLT_PASSWORD` (configurable via `[backends.dolt] password_env`), never the
352
+ manifest. Requires a Dolt with the `dirty` column on `dolt_branches` for dirty
353
+ detection (older servers report clean).
354
+ - **Secrets** are never stored in manifests -- only credential *references* (env
355
+ var / secret names).
356
+
357
+ ## Performance notes
358
+
359
+ tether is an orchestrator; its cost is the network round-trips it fans out, not
360
+ Python.
361
+
362
+ - **Fan-out uses threads, not asyncio.** Every backend SDK tether wraps (obstore,
363
+ psycopg, pyiceberg, deltalake, lance, lakefs, duckdb, pymysql, `git`) is synchronous, the
364
+ per-object Python work is microseconds, and a thread pool gives the same
365
+ wall-clock concurrency without forcing an async protocol on backend authors.
366
+ `snapshot`, `verify`, and the fork step of `new` all run concurrently.
367
+ - **History walks are batched.** `gc` and `verify --all-history` stream every
368
+ manifest at every commit through one `git cat-file --batch` process (jj repos
369
+ are git-backed, so the same plumbing applies), caching trees and blobs by
370
+ object id and verifying each distinct `(system, state, pin)` once. On a repo
371
+ with 200 commits and 5 objects this is ~20-40 ms end to end versus 6-12 s
372
+ with one process per read.
373
+ - **Fingerprints are metadata-only.** Local trees use `os.scandir`
374
+ (~4 us/file); a remote object is one `HEAD`; a prefix is one paged `LIST`.
375
+ - **Content diffs are metadata-only too.** Each backend reads manifests, logs,
376
+ or catalog tables -- never data -- so `diff --content` costs about one
377
+ fingerprint per changed object (two manifest reads for Icechunk/Lance, one log
378
+ walk for Delta, one catalog query for DuckLake, one prolly-tree diff for
379
+ Dolt). Two stored file listings diff in pure Python at ~50 ms per 100k paths.
380
+
381
+ ## Non-goals
382
+
383
+ - Being in the data path (tether hands back native handles and steps aside).
384
+ - Reimplementing history/undo/branching/sharing (that is the VCS's job).
385
+ - Cross-system transactions or a query layer.
386
+
387
+ ## Development
388
+
389
+ ```bash
390
+ uv sync --all-extras
391
+ uv run ruff format --check . && uv run ruff check .
392
+ uv run ty check
393
+ uv run pytest
394
+ ```
395
+
396
+ ## License
397
+
398
+ Apache-2.0. See [LICENSE](LICENSE).