Commit cb49627
authored
feat: generalize storage_options for GCS/Azure and any object_store backend (#46)
## Summary
Closes #45.
The Rust + PyO3 layer already forwards an arbitrary `storage_options`
dict through to lance's `DatasetBuilder::with_storage_options`, but the
Python constructor only exposed ergonomic shortcuts for AWS keys, which
made it look like GCS/Azure weren't supported and blocked tiered-memory
work on `gs://` URIs.
This PR:
- Promotes `storage_options` as the canonical, backend-agnostic way to
configure remote stores — aligned with how `lance` and `lance-graph`
handle backends.
- Keeps `aws_access_key_id`, `aws_secret_access_key`,
`aws_session_token`, `region`, `endpoint_url`, `allow_http` as
backwards-compatible shortcuts that now emit a single
`DeprecationWarning` pointing callers at `storage_options`.
- Documents S3, GCS, and Azure usage in the Python docstring and the
README.
- Adds `python/tests/test_storage_options.py` with 8 unit tests covering
merge / pass-through / precedence / deprecation semantics.
- Adds `python/tests/test_gcs_persistence.py`, an opt-in real-GCS
integration test gated on `LANCE_CONTEXT_GCS_BUCKET` + one of
`LANCE_CONTEXT_GCS_SERVICE_ACCOUNT_KEY` /
`GOOGLE_APPLICATION_CREDENTIALS` / `LANCE_CONTEXT_GCS_ENDPOINT` (for
\`fake-gcs-server\`-style emulators).
- Rewrites the existing S3 integration test to use the canonical
\`storage_options=\` path and adds a companion back-compat test that
asserts the deprecated AWS kwargs still work and emit the warning.
- Fixes the \`moto.server\` subprocess invocation for moto >= 5 (dropped
the positional service arg) and adds \`moto[s3,server]\` so \`flask\` /
\`flask-cors\` are available; without this the S3 suite was being
silently skipped on modern environments.
No behavior change for local or S3 callers that already pass
\`storage_options=\`.
## Notes
An emulator-based GCS test was explored with \`gcp-storage-emulator\`
but has two compat issues outside this repo's scope: (1) it imports
\`fs\` (pyfilesystem2) which calls \`pkg_resources.declare_namespace\`,
broken under setuptools >= 81 (Python 3.12+); (2) its JSON responses
fail OpenDAL's deserializer with \`invalid type: null, expected a
string\`. The opt-in integration test works against \`fake-gcs-server\`
(Go binary) and real GCS, which is what the UP+GCS tiered-memory rollout
will actually use.
## Test plan
- [x] \`cargo fmt --all -- --check\`
- [x] \`cargo clippy --all-targets -- -D warnings\`
- [x] \`cargo test --workspace\` (6 passed)
- [x] \`uv run pytest\` (39 passed, 2 skipped — PIL image test + opt-in
GCS)
- [x] \`uv run ruff format --check python/\`
- [x] \`uv run ruff check python/\`
- [x] \`uv run pyright\` (0 errors)
- [ ] Run \`test_gcs_persistence.py\` against real GCS with
\`LANCE_CONTEXT_GCS_BUCKET=... GOOGLE_APPLICATION_CREDENTIALS=...\` from
the UP+GCS environment before/after merge to confirm end-to-end for the
tiered-memory work
Made with [Cursor](https://cursor.com)1 parent 0ba80e5 commit cb49627
7 files changed
Lines changed: 1085 additions & 43 deletions
File tree
- python
- python/lance_context
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
68 | 69 | | |
69 | 70 | | |
70 | 71 | | |
71 | | - | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
72 | 76 | | |
73 | 77 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
79 | 107 | | |
80 | | - | |
81 | 108 | | |
82 | 109 | | |
83 | 110 | | |
| |||
141 | 168 | | |
142 | 169 | | |
143 | 170 | | |
144 | | - | |
| 171 | + | |
| 172 | + | |
145 | 173 | | |
146 | 174 | | |
147 | 175 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
134 | 135 | | |
135 | 136 | | |
136 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
137 | 199 | | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
138 | 248 | | |
139 | 249 | | |
140 | 250 | | |
141 | 251 | | |
142 | 252 | | |
| 253 | + | |
143 | 254 | | |
144 | 255 | | |
145 | 256 | | |
146 | 257 | | |
147 | 258 | | |
148 | 259 | | |
149 | | - | |
| 260 | + | |
150 | 261 | | |
151 | 262 | | |
152 | 263 | | |
153 | 264 | | |
154 | 265 | | |
155 | 266 | | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
171 | 277 | | |
172 | 278 | | |
173 | 279 | | |
| |||
197 | 303 | | |
198 | 304 | | |
199 | 305 | | |
200 | | - | |
201 | 306 | | |
202 | 307 | | |
203 | 308 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
0 commit comments