Skip to content

Commit 3f0ffba

Browse files
authored
Bring back async methods for python (#1074)
* Add first python async function * Moreeeee * clippy * All sessions meethods now have async versions * lookup_tags * Add missing tags async impls * All branches methods now have async * lint * Add writable session async method * Add rewrite manifests async * Add expire_snapshots * Add garbage_collection async method * Fix bad merge * Update repository.rs * Wrok on splitting up resolve version * One more * Resolve diff correctly * More async methods * remaining store methods * Add python bindigns * add a boatload of async tests to timetravel * More tests * Mix in async method with gc test * Sync with upstream virtual refs changes * Remove unnecessary async methods * cleanup * More cleanup * Cleanup as of spec versioning * gc test cleanup prep * Virtual refs tests * gc async tests * More tests * Remove unneccsssary async chuink coordinates function * More tests * Fix tests * Think thats all * Finish up virtual tests to simplify * More tests * More tests
1 parent c19bffb commit 3f0ffba

File tree

16 files changed

+2364
-131
lines changed

16 files changed

+2364
-131
lines changed

icechunk-python/python/icechunk/_icechunk_python.pyi

Lines changed: 121 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,14 @@ class PyRepository:
12811281
authorize_virtual_chunk_access: dict[str, AnyCredential | None] | None = None,
12821282
) -> PyRepository: ...
12831283
@classmethod
1284+
async def create_async(
1285+
cls,
1286+
storage: Storage,
1287+
*,
1288+
config: RepositoryConfig | None = None,
1289+
authorize_virtual_chunk_access: dict[str, AnyCredential | None] | None = None,
1290+
) -> PyRepository: ...
1291+
@classmethod
12841292
def open(
12851293
cls,
12861294
storage: Storage,
@@ -1289,23 +1297,57 @@ class PyRepository:
12891297
authorize_virtual_chunk_access: dict[str, AnyCredential | None] | None = None,
12901298
) -> PyRepository: ...
12911299
@classmethod
1300+
async def open_async(
1301+
cls,
1302+
storage: Storage,
1303+
*,
1304+
config: RepositoryConfig | None = None,
1305+
authorize_virtual_chunk_access: dict[str, AnyCredential | None] | None = None,
1306+
) -> PyRepository: ...
1307+
@classmethod
12921308
def open_or_create(
12931309
cls,
12941310
storage: Storage,
12951311
*,
12961312
config: RepositoryConfig | None = None,
12971313
authorize_virtual_chunk_access: dict[str, AnyCredential | None] | None = None,
12981314
) -> PyRepository: ...
1315+
@classmethod
1316+
async def open_or_create_async(
1317+
cls,
1318+
storage: Storage,
1319+
*,
1320+
config: RepositoryConfig | None = None,
1321+
authorize_virtual_chunk_access: dict[str, AnyCredential | None] | None = None,
1322+
) -> PyRepository: ...
12991323
@staticmethod
13001324
def exists(storage: Storage) -> bool: ...
1325+
@staticmethod
1326+
async def exists_async(storage: Storage) -> bool: ...
13011327
@classmethod
13021328
def from_bytes(cls, data: bytes) -> PyRepository: ...
13031329
def as_bytes(self) -> bytes: ...
13041330
@staticmethod
13051331
def fetch_config(storage: Storage) -> RepositoryConfig | None: ...
1332+
@staticmethod
1333+
async def fetch_config_async(storage: Storage) -> RepositoryConfig | None: ...
13061334
def save_config(self) -> None: ...
1335+
async def save_config_async(self) -> None: ...
13071336
def config(self) -> RepositoryConfig: ...
1337+
def storage_settings(self) -> StorageSettings: ...
13081338
def storage(self) -> Storage: ...
1339+
def reopen(
1340+
self,
1341+
*,
1342+
config: RepositoryConfig | None = None,
1343+
authorize_virtual_chunk_access: dict[str, AnyCredential | None] | None = None,
1344+
) -> PyRepository: ...
1345+
async def reopen_async(
1346+
self,
1347+
*,
1348+
config: RepositoryConfig | None = None,
1349+
authorize_virtual_chunk_access: dict[str, AnyCredential | None] | None = None,
1350+
) -> PyRepository: ...
13091351
def set_default_commit_metadata(self, metadata: dict[str, Any]) -> None: ...
13101352
def default_commit_metadata(self) -> dict[str, Any]: ...
13111353
def async_ancestry(
@@ -1316,15 +1358,25 @@ class PyRepository:
13161358
snapshot_id: str | None = None,
13171359
) -> AsyncIterator[SnapshotInfo]: ...
13181360
def create_branch(self, branch: str, snapshot_id: str) -> None: ...
1361+
async def create_branch_async(self, branch: str, snapshot_id: str) -> None: ...
13191362
def list_branches(self) -> set[str]: ...
1363+
async def list_branches_async(self) -> set[str]: ...
13201364
def lookup_branch(self, branch: str) -> str: ...
1365+
async def lookup_branch_async(self, branch: str) -> str: ...
13211366
def lookup_snapshot(self, snapshot_id: str) -> SnapshotInfo: ...
1367+
async def lookup_snapshot_async(self, snapshot_id: str) -> SnapshotInfo: ...
13221368
def reset_branch(self, branch: str, snapshot_id: str) -> None: ...
1369+
async def reset_branch_async(self, branch: str, snapshot_id: str) -> None: ...
13231370
def delete_branch(self, branch: str) -> None: ...
1371+
async def delete_branch_async(self, branch: str) -> None: ...
13241372
def delete_tag(self, tag: str) -> None: ...
1373+
async def delete_tag_async(self, tag: str) -> None: ...
13251374
def create_tag(self, tag: str, snapshot_id: str) -> None: ...
1375+
async def create_tag_async(self, tag: str, snapshot_id: str) -> None: ...
13261376
def list_tags(self) -> set[str]: ...
1377+
async def list_tags_async(self) -> set[str]: ...
13271378
def lookup_tag(self, tag: str) -> str: ...
1379+
async def lookup_tag_async(self, tag: str) -> str: ...
13281380
def diff(
13291381
self,
13301382
from_branch: str | None = None,
@@ -1334,6 +1386,15 @@ class PyRepository:
13341386
to_tag: str | None = None,
13351387
to_snapshot_id: str | None = None,
13361388
) -> Diff: ...
1389+
async def diff_async(
1390+
self,
1391+
from_branch: str | None = None,
1392+
from_tag: str | None = None,
1393+
from_snapshot_id: str | None = None,
1394+
to_branch: str | None = None,
1395+
to_tag: str | None = None,
1396+
to_snapshot_id: str | None = None,
1397+
) -> Diff: ...
13371398
def readonly_session(
13381399
self,
13391400
branch: str | None = None,
@@ -1342,17 +1403,36 @@ class PyRepository:
13421403
snapshot_id: str | None = None,
13431404
as_of: datetime.datetime | None = None,
13441405
) -> PySession: ...
1406+
async def readonly_session_async(
1407+
self,
1408+
branch: str | None = None,
1409+
*,
1410+
tag: str | None = None,
1411+
snapshot_id: str | None = None,
1412+
as_of: datetime.datetime | None = None,
1413+
) -> PySession: ...
13451414
def writable_session(self, branch: str) -> PySession: ...
1415+
async def writable_session_async(self, branch: str) -> PySession: ...
13461416
def expire_snapshots(
13471417
self,
13481418
older_than: datetime.datetime,
13491419
*,
13501420
delete_expired_branches: bool = False,
13511421
delete_expired_tags: bool = False,
13521422
) -> set[str]: ...
1423+
async def expire_snapshots_async(
1424+
self,
1425+
older_than: datetime.datetime,
1426+
*,
1427+
delete_expired_branches: bool = False,
1428+
delete_expired_tags: bool = False,
1429+
) -> set[str]: ...
13531430
def rewrite_manifests(
13541431
self, message: str, *, branch: str, metadata: dict[str, Any] | None = None
13551432
) -> str: ...
1433+
async def rewrite_manifests_async(
1434+
self, message: str, *, branch: str, metadata: dict[str, Any] | None = None
1435+
) -> str: ...
13561436
def garbage_collect(
13571437
self,
13581438
delete_object_older_than: datetime.datetime,
@@ -1362,13 +1442,29 @@ class PyRepository:
13621442
max_compressed_manifest_mem_bytes: int = 512 * 1024 * 1024,
13631443
max_concurrent_manifest_fetches: int = 500,
13641444
) -> GCSummary: ...
1445+
async def garbage_collect_async(
1446+
self,
1447+
delete_object_older_than: datetime.datetime,
1448+
*,
1449+
dry_run: bool = False,
1450+
max_snapshots_in_memory: int = 50,
1451+
max_compressed_manifest_mem_bytes: int = 512 * 1024 * 1024,
1452+
max_concurrent_manifest_fetches: int = 500,
1453+
) -> GCSummary: ...
13651454
def total_chunks_storage(
13661455
self,
13671456
*,
13681457
max_snapshots_in_memory: int = 50,
13691458
max_compressed_manifest_mem_bytes: int = 512 * 1024 * 1024,
13701459
max_concurrent_manifest_fetches: int = 500,
13711460
) -> int: ...
1461+
async def total_chunks_storage_async(
1462+
self,
1463+
*,
1464+
max_snapshots_in_memory: int = 50,
1465+
max_compressed_manifest_mem_bytes: int = 512 * 1024 * 1024,
1466+
max_concurrent_manifest_fetches: int = 500,
1467+
) -> int: ...
13721468

13731469
class PySession:
13741470
@classmethod
@@ -1386,20 +1482,30 @@ class PySession:
13861482
def status(self) -> Diff: ...
13871483
def discard_changes(self) -> None: ...
13881484
def all_virtual_chunk_locations(self) -> list[str]: ...
1485+
async def all_virtual_chunk_locations_async(self) -> list[str]: ...
13891486
def chunk_coordinates(
13901487
self, array_path: str, batch_size: int
13911488
) -> AsyncIterator[list[list[int]]]: ...
13921489
@property
13931490
def store(self) -> PyStore: ...
13941491
def merge(self, other: PySession) -> None: ...
1492+
async def merge_async(self, other: PySession) -> None: ...
13951493
def commit(
13961494
self,
13971495
message: str,
13981496
metadata: dict[str, Any] | None = None,
13991497
rebase_with: ConflictSolver | None = None,
14001498
rebase_tries: int = 1_000,
14011499
) -> str: ...
1500+
async def commit_async(
1501+
self,
1502+
message: str,
1503+
metadata: dict[str, Any] | None = None,
1504+
rebase_with: ConflictSolver | None = None,
1505+
rebase_tries: int = 1_000,
1506+
) -> str: ...
14021507
def rebase(self, solver: ConflictSolver) -> None: ...
1508+
async def rebase_async(self, solver: ConflictSolver) -> None: ...
14031509

14041510
class PyStore:
14051511
@classmethod
@@ -1437,12 +1543,27 @@ class PyStore:
14371543
checksum: str | datetime.datetime | None,
14381544
validate_container: bool,
14391545
) -> None: ...
1546+
async def set_virtual_ref_async(
1547+
self,
1548+
key: str,
1549+
location: str,
1550+
offset: int,
1551+
length: int,
1552+
checksum: str | datetime.datetime | None,
1553+
validate_container: bool = False,
1554+
) -> None: ...
14401555
def set_virtual_refs(
14411556
self,
14421557
array_path: str,
14431558
chunks: list[VirtualChunkSpec],
14441559
validate_containers: bool,
14451560
) -> list[tuple[int, ...]] | None: ...
1561+
async def set_virtual_refs_async(
1562+
self,
1563+
array_path: str,
1564+
chunks: list[VirtualChunkSpec],
1565+
validate_containers: bool,
1566+
) -> list[tuple[int, ...]] | None: ...
14461567
async def delete(self, key: str) -> None: ...
14471568
async def delete_dir(self, prefix: str) -> None: ...
14481569
@property

0 commit comments

Comments
 (0)