Skip to content

refactor: drop pylance compatibility shims from the read/write path - #5303

Open
jonasdedden wants to merge 1 commit into
lance-format:mainfrom
jonasdedden:refactor/pylance-12-write-path-shims
Open

jonasdedden wants to merge 1 commit into
lance-format:mainfrom
jonasdedden:refactor/pylance-12-write-path-shims

Conversation

@jonasdedden

Copy link
Copy Markdown
Contributor

Summary

Part 1/3 of splitting up #5301. Now that #5295 made pylance>=12.0.0 the minimum, this removes the pylance compatibility shims from the read/write path. Each removed shim guarded an API that every supported pylance release has.

  • utils.py: removed the pylance 4.x namespace / storage_options_provider path (_pylance_version, _create_storage_options_provider). LanceNamespaceStorageOptionsProvider doesn't exist in any supported release. get_write_fragments_kwargs was an alias of get_namespace_kwargs, so it's removed too.
  • fragment.py: no more probing of write_fragments' signature, and no more "installed pylance does not support ..." errors. The fragment write options are now passed directly.
    • pylance 12's defaults (None / "reference" / False) match what we used to leave out, so the behavior is unchanged.
    • prepare_fragment_write_options keeps its real validation: target_bases and target_all_bases are mutually exclusive, and it still warns when allow_external_blob_outside_bases is combined with ingest. It drops the base_store_params argument, which it only used for the removed probing.
  • datasource.py: removed the initial_storage_options and serialized_manifest fallbacks.
  • Tests:
    • Deleted tests/_utils.py and the skipifs that used it.
    • Removed the tests for "unsupported by the installed pylance" errors.
    • Removed the import fallbacks for DatasetBasePath / blob_array / blob_field.

Compatibility

  • The public API is unchanged: none of the removed helpers are exported from lance_ray or listed in a module's __all__.
  • The only behavior removed is the errors raised on pylance versions that pyproject.toml no longer allows.
  • pyproject.toml and uv.lock are untouched.

Testing

  • uv run mypy (strict), ruff check, ruff format --check: clean
  • pytest on this branch (test_basic_read_write, test_blob, test_blob_v2, test_fragment, namespace indexing): 70 passed, 0 skipped
  • Full suite with all three split PRs combined: 299 passed, 0 skipped (pylance 12.0.0, Python 3.12)

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

pylance 12 is now the minimum, and every API these shims probed for has
been available since well before it:

- utils: remove the pylance 4.x `namespace` / `storage_options_provider`
  path (`_pylance_version`, `_create_storage_options_provider`) and the
  `get_write_fragments_kwargs` alias of `get_namespace_kwargs`.
- fragment: stop probing `write_fragments`' signature and pass the fragment
  write options directly; their pylance defaults match the values we would
  otherwise have omitted. `prepare_fragment_write_options` keeps its real
  validation (mutually exclusive `target_bases` / `target_all_bases`, the
  ingest warning) and drops the now unused `base_store_params` argument.
- datasource: drop the `initial_storage_options` / `serialized_manifest`
  fallbacks.
- tests: remove `tests/_utils.py`, the skips built on it, the
  "unsupported by the installed pylance" tests and the import fallbacks for
  `DatasetBasePath` / `blob_array` / `blob_field`.
@jonasdedden
jonasdedden force-pushed the refactor/pylance-12-write-path-shims branch from 1bb3102 to d66f6cb Compare October 24, 2026 20:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant