Repository navigation
build(pyo3): build against the kernel with tls-rustls, not tls-native - #124
Merged
Merged
Conversation
vikrantpuppala
approved these changes
Jun 4, 2026
The pyo3 wheel is built inside a manylinux container that ships no OpenSSL, so the kernel's default `tls-native` feature (reqwest's native-tls -> openssl-sys) fails to compile: The system library `openssl` required by crate `openssl-sys` was not found. Disable the kernel's default feature and opt into `tls-rustls` (pure-Rust rustls + ring) on the pyo3 dependency, exactly as the napi crate already does. No system OpenSSL is needed and the published wheel stays self-contained / portable. Direct-Rust users and the C-ABI keep `tls-native` via the kernel's default feature; only the pyo3 binding opts out. Verified: `cargo check -p databricks-sql-kernel-pyo3` passes and `cargo tree -i openssl-sys` now matches no packages (rustls throughout). Co-authored-by: Isaac Signed-off-by: Gopal Lal <gopal.lal@databricks.com>
…LS feature The previous commit changed `pyo3/Cargo.toml`'s kernel dep to `default-features = false, features = ["tls-rustls"]`. While pyo3 was a member of the kernel's root workspace, `cargo build/test --workspace` (run by `pr-checks.yml`'s `cargo test` job and `coverage.yml`'s `cargo llvm-cov`) unified the kernel's feature set to `tls-native ∪ tls-rustls` across all workspace members and tripped the mutual-exclusion `compile_error!` in `src/lib.rs:87`: error: `tls-native` and `tls-rustls` are mutually exclusive — enabling both links two TLS stacks and defeats the napi crate's rustls switch. The kernel root's existing comment on `[workspace]` already explained why napi is NOT a workspace member (same feature-union reason). With pyo3 now ALSO needing `tls-rustls`, it has the same constraint and the same fix: standalone workspace. Changes: - `Cargo.toml`: `members = ["."]` (was `[".", "pyo3"]`). Header comment updated to describe both pyo3 and napi as standalone workspaces with the same per-binding-TLS rationale. - `pyo3/Cargo.toml`: add a `[workspace] members = ["."]` block with a comment mirroring `napi/Cargo.toml`'s rationale. - `pyo3/Cargo.lock`: new (pyo3 now has its own lockfile, same as `napi/Cargo.lock`). - `Cargo.lock`: shrinks by ~148 lines (pyo3-only deps moved to `pyo3/Cargo.lock`). - `.github/workflows/pyo3-checks.yml`: `cargo test -p databricks-sql-kernel-pyo3` (run from repo root, relied on workspace membership) → `cargo test` with `working-directory: pyo3`. Mirrors how the napi workflow invokes cargo. Verified locally: - `cargo test --workspace --lib` from root: 620/620 lib tests pass. - `cargo clippy --all-targets -- -D warnings` clean (root + pyo3). - `cargo +stable fmt --all` clean. Also fixes the DCO sign-off on the previous commit (`c21d0b2` → amended to `bfd7090`). Signed-off-by: Gopal Lal <gopal.lal@databricks.com>
gopalldb
force-pushed
the
ci/pyo3-tls-rustls
branch
from
June 4, 2026 16:30
c21d0b2 to
efd5002
Compare
After splitting pyo3 into a standalone workspace (commit efd5002), the security-scan workflow's `cargo cyclonedx` invocation at the kernel root no longer walks the pyo3 sub-crate — the kernel root's workspace now has `members = ["."]`, so cyclonedx emits one SBOM (kernel root) instead of two (kernel + pyo3). The downstream `test … -ge 3` count check then fails: expected >=3 SBOMs (root crate + pyo3 + napi), got 2 Fix: invoke `cargo cyclonedx` once per workspace — once at the root, once from `pyo3/`, once from `napi/`. This mirrors the napi pattern that was already in place. Also rewrite the workflow header comment + step comment to describe the new three-standalone-workspaces shape, so a future reader doesn't have to reverse-engineer the rationale from behaviour. Verified locally — the SBOM-gen block now produces: databricks-sql-kernel.cdx.json (kernel root) databricks-sql-kernel-pyo3.cdx.json (pyo3 standalone workspace) databricks-sql-kernel-napi.cdx.json (napi standalone workspace) YAML validates. Signed-off-by: Gopal Lal <gopal.lal@databricks.com>
This branch was previously deployed
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.
Summary
The pyo3 wheel is built inside a
manylinux_2_28container (insecure-public-registry-releases-eng'speco-databricks-sql-kernel-pythonrelease workflow) that ships no OpenSSL. The kernel's defaulttls-nativefeature pulls inreqwest/native-tls→openssl-sys, which fails to compile there:This change disables the kernel's default feature on the pyo3 dependency and opts into
tls-rustls(pure-Rust rustls + ring) — exactly as thenapicrate already does. No system OpenSSL is needed and the published wheel stays self-contained / portable.Direct-Rust users and the C-ABI (future ODBC) keep
tls-nativevia the kernel's default feature; only the pyo3 binding opts out.Change
(Mirrors
napi/Cargo.toml, which already usesdefault-features = false, features = ["tls-rustls"].)Verification
cargo check -p databricks-sql-kernel-pyo3passes.cargo tree -p databricks-sql-kernel-pyo3 -i openssl-sys→ "did not match any packages" (openssl-sys fully removed; rustls throughout the tree).Cargo.lockunchanged.Follow-up
Once this lands and a new kernel tag is cut, the
peco-databricks-sql-kernel-pythonrelease workflow's Linux (manylinux) wheel builds will compile cleanly — this was the last blocker for that pipeline.This pull request and its description were written by Isaac.