build(kernel): add optional [kernel] extra for use_kernel=True#839
Draft
vikrantpuppala wants to merge 1 commit into
Draft
build(kernel): add optional [kernel] extra for use_kernel=True#839vikrantpuppala wants to merge 1 commit into
vikrantpuppala wants to merge 1 commit into
Conversation
databricks-sql-kernel is now published to PyPI, so the kernel backend can ship as an optional dependency instead of a local-dev-only build. - pyproject: declare databricks-sql-kernel as an optional dependency gated to python>=3.10 (the wheel is cp310-abi3, Requires-Python >=3.10), and add the `[kernel]` extra. The extra also lists pyarrow: the kernel result path (backend/kernel/result_set.py) imports it unconditionally to wrap the Arrow batches the kernel returns. pyarrow is already pulled transitively via the kernel wheel's pyarrow>=23.0.1,<24, but naming it makes the connector-side requirement explicit and lets pip co-resolve both constraints at install time. - backend/kernel/_errors.py: update the use_kernel=True ImportError to point at `pip install "databricks-sql-connector[kernel]"` and note the python>=3.10 requirement (was the obsolete "not yet published, build locally" hint). - README: document the [kernel] extra, use_kernel=True usage, and the python>=3.10 / pyarrow notes. On python<3.10 the `[kernel]` extra resolves to nothing and use_kernel=True raises the friendly ImportError at runtime; the connector's own python floor (3.8) is unchanged. Verified locally (kernel served from a locally-built cp310-abi3 wheel, since the published package isn't yet mirrored on the dev proxy): - pip install "databricks-sql-connector[kernel]" -> connector + kernel + pyarrow all install; use_kernel=True runs a live query end-to-end (backend KernelDatabricksClient). - plain install -> use_kernel=True raises the friendly ImportError. NOTE: `poetry lock` still needs to be run to refresh poetry.lock with the databricks-sql-kernel entry; it is intentionally NOT included here because it requires the kernel to be resolvable on the index poetry/CI use (the JFrog db-pypi proxy). Confirm the package resolves there before merging. Co-authored-by: Isaac Signed-off-by: Vikrant Puppala <vikrant.puppala@databricks.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
databricks-sql-kernelis now published to PyPI, so the Rust kernel backend (use_kernel=True) can ship as an optional dependency instead of being a local-dev-only build. This adds the[kernel]extra:pip install "databricks-sql-connector[kernel]"Changes
pyproject.tomldatabricks-sql-kernel = {version = "^0.1.0", optional = true, python = ">=3.10"}. Gated to Python ≥ 3.10 because the wheel iscp310-abi3(Requires-Python: >=3.10). The connector's own floor (3.8) is unchanged; on 3.8/3.9 the extra resolves to nothing.kernel = ["databricks-sql-kernel", "pyarrow"]. pyarrow is listed explicitly: the kernel result path (backend/kernel/result_set.py) imports it unconditionally to wrap the Arrow batches the kernel returns. It's already pulled transitively via the kernel wheel'spyarrow>=23.0.1,<24, but naming it documents the connector-side requirement and lets pip co-resolve both constraints at install time.backend/kernel/_errors.py— theuse_kernel=TrueImportErrornow points atpip install "databricks-sql-connector[kernel]"and notes Python ≥ 3.10 (was the obsolete "not yet published, build locally" hint).README.md— document the extra, usage, and the Python ≥ 3.10 / pyarrow notes.How it works
use_kernel=Trueimportsdatabricks_sql_kernelat backend load. With the extra → import succeeds, kernel path is live. Without it → friendlyImportErrortelling the user to install[kernel]. The kernel stays a soft dependency: default installs don't pull the Rust wheel.Local verification
Kernel served from a locally-built
cp310-abi3wheel (the published package isn't yet mirrored on the dev PyPI proxy I have access to):pip install "databricks-sql-connector[kernel]"→ connector +databricks-sql-kernel 0.1.2+pyarrow 23.0.1all install;use_kernel=Trueruns a live query end-to-end (backendKernelDatabricksClient, result42).pip install databricks-sql-connector→use_kernel=Trueraises the friendlyImportError(mentions[kernel]+ Python ≥ 3.10).cp310-abi3, matching thepython>=3.10marker.poetry lock—poetry.lockmust be regenerated with thedatabricks-sql-kernelentry. Not included here: it requires the kernel to be resolvable on the index poetry/CI use (the JFrogdb-pypiproxy). Run it once the package resolves there.databricks-sql-kernelresolves ondb-pypi(mirrors public PyPI). If the publish hasn't propagated, declaring the dep will breakpoetry lockfor every CI job. (I could not verify this from my environment — public PyPI egress is blocked and JFrog needs CI's OIDC token.)pip install ".[kernel]"job (or extendingkernel-e2e.yml, which currently source-builds atKERNEL_REV) so the published-wheel install path is exercised.Opened as a draft pending items 1–2.