From 9a76b8fe18983ab7956806154e4060640fa3dc7c Mon Sep 17 00:00:00 2001 From: geruh Date: Sat, 24 Jan 2026 21:09:24 -0800 Subject: [PATCH] Remove sortedcontainers dependency --- pyiceberg/table/update/snapshot.py | 13 +------------ pyproject.toml | 1 - uv.lock | 11 ----------- 3 files changed, 1 insertion(+), 24 deletions(-) diff --git a/pyiceberg/table/update/snapshot.py b/pyiceberg/table/update/snapshot.py index b7c863d84a..389299bf8a 100644 --- a/pyiceberg/table/update/snapshot.py +++ b/pyiceberg/table/update/snapshot.py @@ -16,19 +16,15 @@ # under the License. from __future__ import annotations -import concurrent.futures import itertools import uuid from abc import abstractmethod from collections import defaultdict from collections.abc import Callable -from concurrent.futures import Future from datetime import datetime from functools import cached_property from typing import TYPE_CHECKING, Generic -from sortedcontainers import SortedList - from pyiceberg.avro.codecs import AvroCompressionCodec from pyiceberg.expressions import ( AlwaysFalse, @@ -792,14 +788,7 @@ def merge_bin(manifest_bin: list[ManifestFile]) -> list[ManifestFile]: executor = ExecutorFactory.get_or_create() futures = [executor.submit(merge_bin, b) for b in bins] - - # for consistent ordering, we need to maintain future order - futures_index = {f: i for i, f in enumerate(futures)} - completed_futures: SortedList[Future[list[ManifestFile]]] = SortedList(iterable=[], key=lambda f: futures_index[f]) - for future in concurrent.futures.as_completed(futures): - completed_futures.add(future) - - bin_results: list[list[ManifestFile]] = [f.result() for f in completed_futures if f.result()] + bin_results: list[list[ManifestFile]] = [r for f in futures if (r := f.result())] return [manifest for bin_result in bin_results for manifest in bin_result] diff --git a/pyproject.toml b/pyproject.toml index 69463861b1..6792438eca 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -37,7 +37,6 @@ dependencies = [ "rich>=10.11.0,<15.0.0", "strictyaml>=1.7.0,<2.0.0", # CVE-2020-14343 was fixed in 5.4. "pydantic>=2.0,<3.0,!=2.4.0,!=2.4.1,!=2.12.0,!=2.12.1", # 2.4.0, 2.4.1, 2.12.0, 2.12.1 has a critical bug - "sortedcontainers==2.4.0", "fsspec>=2023.1.0", "pyparsing>=3.1.0,<4.0.0", "tenacity>=8.2.3,<10.0.0", diff --git a/uv.lock b/uv.lock index 82800cc972..e63981be4e 100644 --- a/uv.lock +++ b/uv.lock @@ -4369,7 +4369,6 @@ dependencies = [ { name = "pyroaring" }, { name = "requests" }, { name = "rich" }, - { name = "sortedcontainers" }, { name = "strictyaml" }, { name = "tenacity" }, { name = "zstandard" }, @@ -4530,7 +4529,6 @@ requires-dist = [ { name = "requests", specifier = ">=2.20.0,<3.0.0" }, { name = "rich", specifier = ">=10.11.0,<15.0.0" }, { name = "s3fs", marker = "extra == 's3fs'", specifier = ">=2023.1.0" }, - { name = "sortedcontainers", specifier = "==2.4.0" }, { name = "sqlalchemy", marker = "extra == 'sql-postgres'", specifier = ">=2.0.18,<3" }, { name = "sqlalchemy", marker = "extra == 'sql-sqlite'", specifier = ">=2.0.18,<3" }, { name = "strictyaml", specifier = ">=1.7.0,<2.0.0" }, @@ -5483,15 +5481,6 @@ wheels = [ { url = "https://files.pythonhosted.org/packages/c8/78/3565d011c61f5a43488987ee32b6f3f656e7f107ac2782dd57bdd7d91d9a/snowballstemmer-3.0.1-py3-none-any.whl", hash = "sha256:6cd7b3897da8d6c9ffb968a6781fa6532dce9c3618a4b127d920dab764a19064", size = 103274, upload-time = "2025-05-09T16:34:50.371Z" }, ] -[[package]] -name = "sortedcontainers" -version = "2.4.0" -source = { registry = "https://pypi.org/simple" } -sdist = { url = "https://files.pythonhosted.org/packages/e8/c4/ba2f8066cceb6f23394729afe52f3bf7adec04bf9ed2c820b39e19299111/sortedcontainers-2.4.0.tar.gz", hash = "sha256:25caa5a06cc30b6b83d11423433f65d1f9d76c4c6a0c90e3379eaa43b9bfdb88", size = 30594, upload-time = "2021-05-16T22:03:42.897Z" } -wheels = [ - { url = "https://files.pythonhosted.org/packages/32/46/9cb0e58b2deb7f82b84065f37f3bffeb12413f947f9388e4cac22c4621ce/sortedcontainers-2.4.0-py2.py3-none-any.whl", hash = "sha256:a163dcaede0f1c021485e957a39245190e74249897e2ae4b2aa38595db237ee0", size = 29575, upload-time = "2021-05-16T22:03:41.177Z" }, -] - [[package]] name = "soupsieve" version = "2.8.1"