From fdac20c035e990b9e8357a4bc217fe031a9f8599 Mon Sep 17 00:00:00 2001 From: lance-community Date: Tue, 5 May 2026 16:41:29 +0000 Subject: [PATCH] chore: update pylance dependency to v7.0.0b3 --- lance_ray/compaction.py | 12 +++++------ lance_ray/fragment.py | 5 ++++- lance_ray/index.py | 20 ++++++++++++++----- lance_ray/io.py | 4 +++- lance_ray/utils.py | 8 ++++++-- pyproject.toml | 2 +- tests/test_blob.py | 14 +++++-------- tests/test_distributed_indexing.py | 19 ++++++++++++------ uv.lock | 32 ++++++++++++++++-------------- 9 files changed, 69 insertions(+), 47 deletions(-) diff --git a/lance_ray/compaction.py b/lance_ray/compaction.py index b5f624e1..b8ebbdb3 100644 --- a/lance_ray/compaction.py +++ b/lance_ray/compaction.py @@ -132,7 +132,9 @@ def compact_files( if describe_response.storage_options: merged_storage_options.update(describe_response.storage_options) - namespace_kwargs = get_namespace_kwargs(namespace_impl, namespace_properties, table_id) + namespace_kwargs = get_namespace_kwargs( + namespace_impl, namespace_properties, table_id + ) # Load dataset dataset = lance.LanceDataset( @@ -261,9 +263,7 @@ def compact_database( if not database: raise ValueError("'database' must be a non-empty list of path segments.") if not namespace_impl: - raise ValueError( - "'namespace_impl' is required when using compact_database." - ) + raise ValueError("'namespace_impl' is required when using compact_database.") from lance_namespace import ListTablesRequest @@ -314,8 +314,6 @@ def compact_database( results.append({"table_id": table_id, "metrics": metrics}) except Exception as e: logger.exception("Compaction failed for table %s: %s", table_id, e) - raise RuntimeError( - f"Compaction failed for table {table_id}: {e}" - ) from e + raise RuntimeError(f"Compaction failed for table {table_id}: {e}") from e return results diff --git a/lance_ray/fragment.py b/lance_ray/fragment.py index 60b25ad9..4debeb29 100644 --- a/lance_ray/fragment.py +++ b/lance_ray/fragment.py @@ -107,7 +107,10 @@ def record_batch_converter(): except (AttributeError, ValueError): # pragma: no cover write_sig = None - if write_sig is not None and "allow_external_blob_outside_bases" in write_sig.parameters: + if ( + write_sig is not None + and "allow_external_blob_outside_bases" in write_sig.parameters + ): write_kwargs.setdefault("allow_external_blob_outside_bases", True) tbl_first = pd_to_arrow(first, schema) diff --git a/lance_ray/index.py b/lance_ray/index.py index 6955d5de..1207e70b 100755 --- a/lance_ray/index.py +++ b/lance_ray/index.py @@ -371,7 +371,9 @@ def create_scalar_index( if describe_response.storage_options: merged_storage_options.update(describe_response.storage_options) - namespace_kwargs = get_namespace_kwargs(namespace_impl, namespace_properties, table_id) + namespace_kwargs = get_namespace_kwargs( + namespace_impl, namespace_properties, table_id + ) # Load dataset dataset = LanceDataset( @@ -441,7 +443,9 @@ def create_scalar_index( existing_indices = dataset.list_indices() existing_names = {idx["name"] for idx in existing_indices} index_exists = name in existing_names - except Exception: # pragma: no cover - list_indices() not available in older lance versions + except ( + Exception + ): # pragma: no cover - list_indices() not available in older lance versions pass if index_exists: raise ValueError( @@ -830,7 +834,9 @@ def create_index( dataset_obj = uri dataset_uri = dataset_obj.uri if not merged_storage_options: - merged_storage_options = getattr(dataset_obj, "_storage_options", None) or {} + merged_storage_options = ( + getattr(dataset_obj, "_storage_options", None) or {} + ) namespace_kwargs = {} try: @@ -850,7 +856,9 @@ def create_index( existing_indices = dataset_obj.list_indices() existing_names = {idx["name"] for idx in existing_indices} index_exists = name in existing_names - except Exception: # pragma: no cover - list_indices() not available in older lance versions + except ( + Exception + ): # pragma: no cover - list_indices() not available in older lance versions pass if index_exists: raise ValueError( @@ -1107,7 +1115,9 @@ def optimize_indices( uri, ) - namespace_kwargs = get_namespace_kwargs(namespace_impl, namespace_properties, table_id) + namespace_kwargs = get_namespace_kwargs( + namespace_impl, namespace_properties, table_id + ) dataset = LanceDataset( uri, diff --git a/lance_ray/io.py b/lance_ray/io.py index 10e122b2..a8bcadb8 100644 --- a/lance_ray/io.py +++ b/lance_ray/io.py @@ -460,7 +460,9 @@ def add_columns( """ storage_options = storage_options or {} - namespace_kwargs = get_namespace_kwargs(namespace_impl, namespace_properties, table_id) + namespace_kwargs = get_namespace_kwargs( + namespace_impl, namespace_properties, table_id + ) lance_ds = LanceDataset( uri=uri, diff --git a/lance_ray/utils.py b/lance_ray/utils.py index 06d96765..00b02930 100644 --- a/lance_ray/utils.py +++ b/lance_ray/utils.py @@ -129,7 +129,9 @@ def _create_storage_options_provider( if not hasattr(lance, "LanceNamespaceStorageOptionsProvider"): return None - return lance.LanceNamespaceStorageOptionsProvider(namespace=namespace, table_id=table_id) + return lance.LanceNamespaceStorageOptionsProvider( + namespace=namespace, table_id=table_id + ) def get_namespace_kwargs( @@ -185,7 +187,9 @@ def get_write_fragments_kwargs( return {} return {"namespace_client": namespace, "table_id": table_id} - provider = _create_storage_options_provider(namespace_impl, namespace_properties, table_id) + provider = _create_storage_options_provider( + namespace_impl, namespace_properties, table_id + ) if provider is None: return {} return {"storage_options_provider": provider} diff --git a/pyproject.toml b/pyproject.toml index 5dd2f9f3..ba1bcd95 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -24,7 +24,7 @@ classifiers = [ dependencies = [ "ray[data]>=2.41.0", - "pylance>=4.0.0", + "pylance>=7.0.0b3", "lance-namespace", "packaging", "pyarrow>=17.0.0", diff --git a/tests/test_blob.py b/tests/test_blob.py index b7a811e8..c4dcb629 100755 --- a/tests/test_blob.py +++ b/tests/test_blob.py @@ -344,10 +344,7 @@ def test_stream_copy_basic_local(temp_dir): assert src.schema == dst.schema src_df = ( - ray.data.from_arrow(table) - .to_pandas() - .sort_values("id") - .reset_index(drop=True) + ray.data.from_arrow(table).to_pandas().sort_values("id").reset_index(drop=True) ) dst_df = ( lr.read_lance(str(dst_path)) @@ -367,7 +364,9 @@ def test_stream_copy_resume_local(temp_dir): # Legacy blob schema schema = pa.schema( [ - pa.field("blob", pa.large_binary(), metadata={"lance-encoding:blob": "true"}), + pa.field( + "blob", pa.large_binary(), metadata={"lance-encoding:blob": "true"} + ), pa.field("id", pa.int64()), pa.field("name", pa.string()), pa.field("val", pa.float64()), @@ -402,10 +401,7 @@ def test_stream_copy_resume_local(temp_dir): ) src_df = ( - ray.data.from_arrow(table) - .to_pandas() - .sort_values("id") - .reset_index(drop=True) + ray.data.from_arrow(table).to_pandas().sort_values("id").reset_index(drop=True) ) dst_df = ( lr.read_lance(str(dst_path)) diff --git a/tests/test_distributed_indexing.py b/tests/test_distributed_indexing.py index a900bba3..5c4c751f 100755 --- a/tests/test_distributed_indexing.py +++ b/tests/test_distributed_indexing.py @@ -465,9 +465,13 @@ def test_scalar_index_on_mixed_schema_list_indices(self, temp_dir): ) indices = updated_dataset.list_indices() - assert len(indices) >= 1, "list_indices should return at least the new scalar index" + assert len(indices) >= 1, ( + "list_indices should return at least the new scalar index" + ) names = [idx["name"] for idx in indices] - assert index_name in names, f"Expected index name {index_name!r} in list_indices: {names}" + assert index_name in names, ( + f"Expected index name {index_name!r} in list_indices: {names}" + ) label_index = next(idx for idx in indices if idx["name"] == index_name) assert label_index["type"] == "BTree", ( @@ -1018,7 +1022,9 @@ def test_optimize_indices_success_with_uri(self, multi_fragment_lance_dataset): assert result.count_rows() == lance.LanceDataset(dataset_uri).count_rows() indices = result.list_indices() - assert len(indices) >= 1, "list_indices should include at least the existing index" + assert len(indices) >= 1, ( + "list_indices should include at least the existing index" + ) names = [idx["name"] for idx in indices] assert "text_idx" in names, f"Expected 'text_idx' in list_indices: {names}" @@ -1029,9 +1035,10 @@ def test_optimize_indices_runtime_error_when_api_missing(self, temp_dir): lr.write_lance(ray.data.from_pandas(df), str(path)) ds = lance.LanceDataset(str(path)) - if getattr(ds, "optimize_indices", None) is not None or getattr( - ds, "optimize", None - ) is not None: + if ( + getattr(ds, "optimize_indices", None) is not None + or getattr(ds, "optimize", None) is not None + ): pytest.skip( "This lance version exposes optimize_indices/optimize; " "cannot test RuntimeError path." diff --git a/uv.lock b/uv.lock index 5cbbf34b..be9b33fc 100644 --- a/uv.lock +++ b/uv.lock @@ -326,19 +326,19 @@ wheels = [ [[package]] name = "lance-namespace" -version = "0.6.1" +version = "0.7.5" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "lance-namespace-urllib3-client" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/28/9f/7906ba4117df8d965510285eaf07264a77de2fd283b9d44ec7fc63a4a57a/lance_namespace-0.6.1.tar.gz", hash = "sha256:f0deea442bd3f1056a8e2fed056ae2778e3356517ec2e680db049058b824d131", size = 10666, upload-time = "2026-03-17T17:55:44.977Z" } +sdist = { url = "https://files.pythonhosted.org/packages/e8/bf/1eaf33cda3ebb37b013463e061e1c7666c92c2cab8e0ad96b23c529effcb/lance_namespace-0.7.5.tar.gz", hash = "sha256:8dbcea18a8ed88af3a5444d6a46d2786dda3d6763e90ee59f65245f7d3ae8f43", size = 10688, upload-time = "2026-05-05T06:23:39.65Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/d1/91/aee1c0a04d17f2810173bd304bd444eb78332045df1b0c1b07cebd01f530/lance_namespace-0.6.1-py3-none-any.whl", hash = "sha256:9699c9e3f12236e5e08ea979cc4e036a8e3c67ed2f37ae6f25c5353ab908e1be", size = 12498, upload-time = "2026-03-17T17:55:44.062Z" }, + { url = "https://files.pythonhosted.org/packages/9d/0e/624f202855ef8971e6b3b0a81aae4291e3218c9b71e06d681b96e797d576/lance_namespace-0.7.5-py3-none-any.whl", hash = "sha256:bb85e8f161e9ec76cc7fe9ba3484d1f0d61175c56b940b4e8a491f247290a77a", size = 12519, upload-time = "2026-05-05T06:23:35.52Z" }, ] [[package]] name = "lance-namespace-urllib3-client" -version = "0.6.1" +version = "0.7.5" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "pydantic" }, @@ -346,9 +346,9 @@ dependencies = [ { name = "typing-extensions" }, { name = "urllib3" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/63/a1/8706a2be25bd184acccc411e48f1a42a4cbf3b6556cba15b9fcf4c15cfcc/lance_namespace_urllib3_client-0.6.1.tar.gz", hash = "sha256:31fbd058ce1ea0bf49045cdeaa756360ece0bc61e9e10276f41af6d217debe87", size = 182567, upload-time = "2026-03-17T17:55:46.87Z" } +sdist = { url = "https://files.pythonhosted.org/packages/66/5f/8c1036ade66a7eda7c10da90dbbd9186e76992190ce5501cb96b15d00eff/lance_namespace_urllib3_client-0.7.5.tar.gz", hash = "sha256:a87fc8ea167886a38e57783f21d82ebbab8770798c522bf45beef9b13e3be1da", size = 195540, upload-time = "2026-05-05T06:23:36.847Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/cd/c7/cb9580602dec25f0fdd6005c1c9ba1d4c8c0c3dc8d543107e5a9f248bba8/lance_namespace_urllib3_client-0.6.1-py3-none-any.whl", hash = "sha256:b9c103e1377ad46d2bd70eec894bfec0b1e2133dae0964d7e4de543c6e16293b", size = 317111, upload-time = "2026-03-17T17:55:45.546Z" }, + { url = "https://files.pythonhosted.org/packages/c8/15/025dff007b428bcd4323e0b4072c770c95d61f5ed1435a9a984b41032e92/lance_namespace_urllib3_client-0.7.5-py3-none-any.whl", hash = "sha256:cec5a3d8279b92088740a44cafb9ffc398f4e5a32d771f20baa0bfc91da41512", size = 324604, upload-time = "2026-05-05T06:23:38.522Z" }, ] [[package]] @@ -358,6 +358,7 @@ source = { editable = "." } dependencies = [ { name = "lance-namespace" }, { name = "more-itertools", marker = "python_full_version < '3.12'" }, + { name = "packaging" }, { name = "pyarrow" }, { name = "pylance" }, { name = "pytest" }, @@ -384,8 +385,9 @@ requires-dist = [ { name = "mkdocs-awesome-pages-plugin", marker = "extra == 'docs'", specifier = ">=2.9.0" }, { name = "mkdocs-material", marker = "extra == 'docs'", specifier = ">=9.0.0" }, { name = "more-itertools", marker = "python_full_version < '3.12'", specifier = ">=2.6.0" }, + { name = "packaging" }, { name = "pyarrow", specifier = ">=17.0.0" }, - { name = "pylance", specifier = ">=4.0.0" }, + { name = "pylance", specifier = ">=7.0.0b3" }, { name = "pytest", specifier = ">=8.4.0" }, { name = "pytest-asyncio", marker = "extra == 'dev'", specifier = ">=1.0.0" }, { name = "pytest-cov", specifier = ">=5.0.0" }, @@ -1022,8 +1024,8 @@ wheels = [ [[package]] name = "pylance" -version = "4.0.0" -source = { registry = "https://pypi.org/simple" } +version = "7.0.0b3" +source = { registry = "https://pypi.fury.io/lance-format" } dependencies = [ { name = "lance-namespace" }, { name = "numpy", version = "2.2.6", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.11'" }, @@ -1031,12 +1033,12 @@ dependencies = [ { name = "pyarrow" }, ] wheels = [ - { url = "https://files.pythonhosted.org/packages/19/29/5152da1261a628c293876917b6185538bd68f4cf1420da6265b5be79d09b/pylance-4.0.0-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:7310892f3089eeddb1af1fe5c398b71cc483a3015646caceaa2f62fc92b227b2", size = 54420876, upload-time = "2026-03-30T18:18:37.525Z" }, - { url = "https://files.pythonhosted.org/packages/99/ae/7edbbfc18c3be43eedb886e74a17826c09fdf35588b35912f2733779ea43/pylance-4.0.0-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:57f6a521b1b4b77a62d791850213a854093719c7d76b9641e8abcd445eb73e56", size = 56752552, upload-time = "2026-03-30T18:24:21.331Z" }, - { url = "https://files.pythonhosted.org/packages/ef/88/6d8bda83224bac52806f09d3e211d8886b81500384948a753c4b24c11f35/pylance-4.0.0-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:e433d6bddd66de99c58e472bc3e8ed1590c7ff4ff7948479254c1c2111a601a8", size = 60305704, upload-time = "2026-03-30T18:35:23.425Z" }, - { url = "https://files.pythonhosted.org/packages/52/f3/8d8369c756c4173ea070f6964213f9b622ac278bd04a058c48d00a549177/pylance-4.0.0-cp39-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:f36dce83c11cd5d598cb0f64bad7c51fc21ed43df868b9029184a385c6bf4d84", size = 56771233, upload-time = "2026-03-30T18:25:40.012Z" }, - { url = "https://files.pythonhosted.org/packages/66/e6/53e0713440685b1c76e20d72755eca2e531cc182ea9a612b4cb6a15abe50/pylance-4.0.0-cp39-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:9ca03f97f22e0b75f06378c4006d587aba26408122fd066f0e43e2b7a019c67e", size = 60260813, upload-time = "2026-03-30T18:36:07.976Z" }, - { url = "https://files.pythonhosted.org/packages/1e/04/5f22b88c8965d3982f68f67bfe24d756e7b788e10392d2bec6f97f5eb0e3/pylance-4.0.0-cp39-abi3-win_amd64.whl", hash = "sha256:9261c32d3bd6aaab33025a45b20c2f2554804e1bc2a1ec2bfcb06f0c9d2e59b9", size = 65137830, upload-time = "2026-03-30T18:37:33.048Z" }, + { url = "https://pypi.fury.io/lance-format/-/ver_25eomQ/pylance-7.0.0b3-cp39-abi3-macosx_11_0_arm64.whl", hash = "sha256:0e4b4a3eb209cd78f00c464b41ad47928b3231eddbeca254938b440cbd933f73" }, + { url = "https://pypi.fury.io/lance-format/-/ver_1hzl2Q/pylance-7.0.0b3-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:d09fbe392260b831f54a22f7228818198b5f13a8b69f44eb61e047ead1a6716d" }, + { url = "https://pypi.fury.io/lance-format/-/ver_23dEmr/pylance-7.0.0b3-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:93926a9a751d6ab41941fb64d1562244be4770d5bfef72223fcec2bb4e06710e" }, + { url = "https://pypi.fury.io/lance-format/-/ver_1RgJMb/pylance-7.0.0b3-cp39-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:821547f905e627d4b8f7c54858060d15ed3e85837c3087e0ed14aceed16736a8" }, + { url = "https://pypi.fury.io/lance-format/-/ver_239zTY/pylance-7.0.0b3-cp39-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:546032ba4f902fa77296ca797f7ebf42eb96992555ac31b255f3973a90ac8d51" }, + { url = "https://pypi.fury.io/lance-format/-/ver_Khn7i/pylance-7.0.0b3-cp39-abi3-win_amd64.whl", hash = "sha256:6b05a5544b4394dbc0e66044f80c82fae71a35584f225cf42bd25649a7ccceb4" }, ] [[package]]