From a3d0c27b0aee38515aa5b9648cac7a507f1ba4f5 Mon Sep 17 00:00:00 2001 From: Ho Kim Date: Mon, 18 Nov 2024 18:36:20 +0000 Subject: [PATCH] feat: add support for rustls (#1842) Hello, this is a simple PR that supports `rustls-tls` feature. The `reqwest`\`s default TLS `default-tls` is enabled by default, to dismiss the side-effect. The user can use `rustls-tls` like this: ```toml lancedb = { version = "*", default-features = false, features = ["rustls-tls"] } ``` --- python/Cargo.toml | 9 +++++++-- rust/lancedb/Cargo.toml | 20 ++++++++++++++++---- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/python/Cargo.toml b/python/Cargo.toml index 0152ea33..925066a3 100644 --- a/python/Cargo.toml +++ b/python/Cargo.toml @@ -15,7 +15,7 @@ crate-type = ["cdylib"] [dependencies] arrow = { version = "52.1", features = ["pyarrow"] } -lancedb = { path = "../rust/lancedb" } +lancedb = { path = "../rust/lancedb", default-features = false } env_logger.workspace = true pyo3 = { version = "0.21", features = ["extension-module", "abi3-py38", "gil-refs"] } # Using this fork for now: https://github.com/awestlake87/pyo3-asyncio/issues/119 @@ -33,6 +33,11 @@ pyo3-build-config = { version = "0.20.3", features = [ ] } [features] -default = ["remote"] +default = ["default-tls", "remote"] fp16kernels = ["lancedb/fp16kernels"] remote = ["lancedb/remote"] + +# TLS +default-tls = ["lancedb/default-tls"] +native-tls = ["lancedb/native-tls"] +rustls-tls = ["lancedb/rustls-tls"] diff --git a/rust/lancedb/Cargo.toml b/rust/lancedb/Cargo.toml index 72b8af48..2c21e1b9 100644 --- a/rust/lancedb/Cargo.toml +++ b/rust/lancedb/Cargo.toml @@ -48,9 +48,16 @@ async-openai = { version = "0.20.0", optional = true } serde_with = { version = "3.8.1" } aws-sdk-bedrockruntime = { version = "1.27.0", optional = true } # For remote feature -reqwest = { version = "0.12.0", features = ["gzip", "json", "stream"], optional = true } -rand = { version = "0.8.3", features = ["small_rng"], optional = true} -http = { version = "1", optional = true } # Matching what is in reqwest +reqwest = { version = "0.12.0", default-features = false, features = [ + "charset", + "gzip", + "http2", + "json", + "macos-system-configuration", + "stream", +], optional = true } +rand = { version = "0.8.3", features = ["small_rng"], optional = true } +http = { version = "1", optional = true } # Matching what is in reqwest uuid = { version = "1.7.0", features = ["v4"], optional = true } polars-arrow = { version = ">=0.37,<0.40.0", optional = true } polars = { version = ">=0.37,<0.40.0", optional = true } @@ -75,7 +82,7 @@ http-body = "1" # Matching reqwest [features] -default = [] +default = ["default-tls"] remote = ["dep:reqwest", "dep:http", "dep:rand", "dep:uuid"] fp16kernels = ["lance-linalg/fp16kernels"] s3-test = [] @@ -90,6 +97,11 @@ sentence-transformers = [ "dep:tokenizers" ] +# TLS +default-tls = ["reqwest?/default-tls"] +native-tls = ["reqwest?/native-tls"] +rustls-tls = ["reqwest?/rustls-tls"] + [[example]] name = "openai" required-features = ["openai"]