diff --git a/.bumpversion.toml b/.bumpversion.toml index 1c85cb734..d29ba8e75 100644 --- a/.bumpversion.toml +++ b/.bumpversion.toml @@ -1,5 +1,5 @@ [tool.bumpversion] -current_version = "0.42.0-beta.32" +current_version = "0.42.0-beta.35" parse = """(?x) (?P0|[1-9]\\d*)\\. (?P0|[1-9]\\d*)\\. diff --git a/Cargo.lock b/Cargo.lock index af35c7522..111a170da 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3885,8 +3885,8 @@ checksum = "42703706b716c37f96a77aea830392ad231f44c9e9a67872fa5548707e11b11c" [[package]] name = "fsst" -version = "15.1.0-beta.2" -source = "git+https://github.com/lance-format/lance.git?tag=v15.1.0-beta.2#fc8f59e53233a46f0d73604d66254142802389c9" +version = "16.0.0-beta.2" +source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.2#9eb4b09226b252f0d3d58448aa5f435147bcef13" dependencies = [ "arrow-array", "rand 0.9.5", @@ -5364,8 +5364,8 @@ checksum = "e037a2e1d8d5fdbd49b16a4ea09d5d6401c1f29eca5ff29d03d3824dba16256a" [[package]] name = "lance" -version = "15.1.0-beta.2" -source = "git+https://github.com/lance-format/lance.git?tag=v15.1.0-beta.2#fc8f59e53233a46f0d73604d66254142802389c9" +version = "16.0.0-beta.2" +source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.2#9eb4b09226b252f0d3d58448aa5f435147bcef13" dependencies = [ "arc-swap", "arrow", @@ -5441,8 +5441,8 @@ dependencies = [ [[package]] name = "lance-arrow" -version = "15.1.0-beta.2" -source = "git+https://github.com/lance-format/lance.git?tag=v15.1.0-beta.2#fc8f59e53233a46f0d73604d66254142802389c9" +version = "16.0.0-beta.2" +source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.2#9eb4b09226b252f0d3d58448aa5f435147bcef13" dependencies = [ "arrow-array", "arrow-buffer", @@ -5465,8 +5465,8 @@ dependencies = [ [[package]] name = "lance-bitpacking" -version = "15.1.0-beta.2" -source = "git+https://github.com/lance-format/lance.git?tag=v15.1.0-beta.2#fc8f59e53233a46f0d73604d66254142802389c9" +version = "16.0.0-beta.2" +source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.2#9eb4b09226b252f0d3d58448aa5f435147bcef13" dependencies = [ "arrayref", "crunchy", @@ -5476,8 +5476,8 @@ dependencies = [ [[package]] name = "lance-core" -version = "15.1.0-beta.2" -source = "git+https://github.com/lance-format/lance.git?tag=v15.1.0-beta.2#fc8f59e53233a46f0d73604d66254142802389c9" +version = "16.0.0-beta.2" +source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.2#9eb4b09226b252f0d3d58448aa5f435147bcef13" dependencies = [ "arrow-array", "arrow-buffer", @@ -5515,8 +5515,8 @@ dependencies = [ [[package]] name = "lance-datafusion" -version = "15.1.0-beta.2" -source = "git+https://github.com/lance-format/lance.git?tag=v15.1.0-beta.2#fc8f59e53233a46f0d73604d66254142802389c9" +version = "16.0.0-beta.2" +source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.2#9eb4b09226b252f0d3d58448aa5f435147bcef13" dependencies = [ "arrow", "arrow-array", @@ -5547,8 +5547,8 @@ dependencies = [ [[package]] name = "lance-datafusion-exec" -version = "15.1.0-beta.2" -source = "git+https://github.com/lance-format/lance.git?tag=v15.1.0-beta.2#fc8f59e53233a46f0d73604d66254142802389c9" +version = "16.0.0-beta.2" +source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.2#9eb4b09226b252f0d3d58448aa5f435147bcef13" dependencies = [ "arrow", "arrow-array", @@ -5574,8 +5574,8 @@ dependencies = [ [[package]] name = "lance-datagen" -version = "15.1.0-beta.2" -source = "git+https://github.com/lance-format/lance.git?tag=v15.1.0-beta.2#fc8f59e53233a46f0d73604d66254142802389c9" +version = "16.0.0-beta.2" +source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.2#9eb4b09226b252f0d3d58448aa5f435147bcef13" dependencies = [ "arrow", "arrow-array", @@ -5592,8 +5592,8 @@ dependencies = [ [[package]] name = "lance-derive" -version = "15.1.0-beta.2" -source = "git+https://github.com/lance-format/lance.git?tag=v15.1.0-beta.2#fc8f59e53233a46f0d73604d66254142802389c9" +version = "16.0.0-beta.2" +source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.2#9eb4b09226b252f0d3d58448aa5f435147bcef13" dependencies = [ "proc-macro2", "quote", @@ -5602,8 +5602,8 @@ dependencies = [ [[package]] name = "lance-encoding" -version = "15.1.0-beta.2" -source = "git+https://github.com/lance-format/lance.git?tag=v15.1.0-beta.2#fc8f59e53233a46f0d73604d66254142802389c9" +version = "16.0.0-beta.2" +source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.2#9eb4b09226b252f0d3d58448aa5f435147bcef13" dependencies = [ "arrow-arith", "arrow-array", @@ -5637,8 +5637,8 @@ dependencies = [ [[package]] name = "lance-file" -version = "15.1.0-beta.2" -source = "git+https://github.com/lance-format/lance.git?tag=v15.1.0-beta.2#fc8f59e53233a46f0d73604d66254142802389c9" +version = "16.0.0-beta.2" +source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.2#9eb4b09226b252f0d3d58448aa5f435147bcef13" dependencies = [ "arrow-arith", "arrow-array", @@ -5668,8 +5668,8 @@ dependencies = [ [[package]] name = "lance-geo" -version = "15.1.0-beta.2" -source = "git+https://github.com/lance-format/lance.git?tag=v15.1.0-beta.2#fc8f59e53233a46f0d73604d66254142802389c9" +version = "16.0.0-beta.2" +source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.2#9eb4b09226b252f0d3d58448aa5f435147bcef13" dependencies = [ "arrow-array", "arrow-schema", @@ -5700,8 +5700,8 @@ dependencies = [ [[package]] name = "lance-index" -version = "15.1.0-beta.2" -source = "git+https://github.com/lance-format/lance.git?tag=v15.1.0-beta.2#fc8f59e53233a46f0d73604d66254142802389c9" +version = "16.0.0-beta.2" +source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.2#9eb4b09226b252f0d3d58448aa5f435147bcef13" dependencies = [ "arc-swap", "arrow", @@ -5773,8 +5773,8 @@ dependencies = [ [[package]] name = "lance-index-core" -version = "15.1.0-beta.2" -source = "git+https://github.com/lance-format/lance.git?tag=v15.1.0-beta.2#fc8f59e53233a46f0d73604d66254142802389c9" +version = "16.0.0-beta.2" +source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.2#9eb4b09226b252f0d3d58448aa5f435147bcef13" dependencies = [ "arrow-array", "arrow-schema", @@ -5797,8 +5797,8 @@ dependencies = [ [[package]] name = "lance-io" -version = "15.1.0-beta.2" -source = "git+https://github.com/lance-format/lance.git?tag=v15.1.0-beta.2#fc8f59e53233a46f0d73604d66254142802389c9" +version = "16.0.0-beta.2" +source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.2#9eb4b09226b252f0d3d58448aa5f435147bcef13" dependencies = [ "arrow", "arrow-array", @@ -5843,8 +5843,8 @@ dependencies = [ [[package]] name = "lance-jsonb" -version = "15.1.0-beta.2" -source = "git+https://github.com/lance-format/lance.git?tag=v15.1.0-beta.2#fc8f59e53233a46f0d73604d66254142802389c9" +version = "16.0.0-beta.2" +source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.2#9eb4b09226b252f0d3d58448aa5f435147bcef13" dependencies = [ "byteorder", "ethnum", @@ -5861,7 +5861,7 @@ dependencies = [ [[package]] name = "lance-linalg" -version = "15.1.0-beta.2" +version = "16.0.0-beta.2" dependencies = [ "approx", "argminmax 0.7.1", @@ -5883,8 +5883,8 @@ dependencies = [ [[package]] name = "lance-namespace" -version = "15.1.0-beta.2" -source = "git+https://github.com/lance-format/lance.git?tag=v15.1.0-beta.2#fc8f59e53233a46f0d73604d66254142802389c9" +version = "16.0.0-beta.2" +source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.2#9eb4b09226b252f0d3d58448aa5f435147bcef13" dependencies = [ "arrow", "async-trait", @@ -5898,8 +5898,8 @@ dependencies = [ [[package]] name = "lance-namespace-impls" -version = "15.1.0-beta.2" -source = "git+https://github.com/lance-format/lance.git?tag=v15.1.0-beta.2#fc8f59e53233a46f0d73604d66254142802389c9" +version = "16.0.0-beta.2" +source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.2#9eb4b09226b252f0d3d58448aa5f435147bcef13" dependencies = [ "arc-swap", "arrow", @@ -5953,8 +5953,8 @@ dependencies = [ [[package]] name = "lance-select" -version = "15.1.0-beta.2" -source = "git+https://github.com/lance-format/lance.git?tag=v15.1.0-beta.2#fc8f59e53233a46f0d73604d66254142802389c9" +version = "16.0.0-beta.2" +source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.2#9eb4b09226b252f0d3d58448aa5f435147bcef13" dependencies = [ "arrow-array", "arrow-buffer", @@ -5968,8 +5968,8 @@ dependencies = [ [[package]] name = "lance-table" -version = "15.1.0-beta.2" -source = "git+https://github.com/lance-format/lance.git?tag=v15.1.0-beta.2#fc8f59e53233a46f0d73604d66254142802389c9" +version = "16.0.0-beta.2" +source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.2#9eb4b09226b252f0d3d58448aa5f435147bcef13" dependencies = [ "arrow", "arrow-array", @@ -6010,8 +6010,8 @@ dependencies = [ [[package]] name = "lance-table-runtime" -version = "15.1.0-beta.2" -source = "git+https://github.com/lance-format/lance.git?tag=v15.1.0-beta.2#fc8f59e53233a46f0d73604d66254142802389c9" +version = "16.0.0-beta.2" +source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.2#9eb4b09226b252f0d3d58448aa5f435147bcef13" dependencies = [ "arrow-array", "arrow-buffer", @@ -6055,8 +6055,8 @@ dependencies = [ [[package]] name = "lance-testing" -version = "15.1.0-beta.2" -source = "git+https://github.com/lance-format/lance.git?tag=v15.1.0-beta.2#fc8f59e53233a46f0d73604d66254142802389c9" +version = "16.0.0-beta.2" +source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.2#9eb4b09226b252f0d3d58448aa5f435147bcef13" dependencies = [ "arrow-array", "arrow-schema", @@ -6069,8 +6069,8 @@ dependencies = [ [[package]] name = "lance-tokenizer" -version = "15.1.0-beta.2" -source = "git+https://github.com/lance-format/lance.git?tag=v15.1.0-beta.2#fc8f59e53233a46f0d73604d66254142802389c9" +version = "16.0.0-beta.2" +source = "git+https://github.com/lance-format/lance.git?tag=v16.0.0-beta.2#9eb4b09226b252f0d3d58448aa5f435147bcef13" dependencies = [ "frostem", "icu_segmenter", @@ -6083,7 +6083,7 @@ dependencies = [ [[package]] name = "lancedb" -version = "0.42.0-beta.32" +version = "0.42.0-beta.35" dependencies = [ "ahash", "anyhow", @@ -6194,7 +6194,7 @@ dependencies = [ [[package]] name = "lancedb-cli" -version = "0.42.0-beta.32" +version = "0.42.0-beta.35" dependencies = [ "anyhow", "arrow-array", @@ -6237,7 +6237,7 @@ dependencies = [ [[package]] name = "lancedb-nodejs" -version = "0.42.0-beta.32" +version = "0.42.0-beta.35" dependencies = [ "arrow-array", "arrow-buffer", @@ -6263,7 +6263,7 @@ dependencies = [ [[package]] name = "lancedb-python" -version = "0.42.0-beta.32" +version = "0.42.0-beta.35" dependencies = [ "arc-swap", "arrow", diff --git a/Cargo.toml b/Cargo.toml index cd69b40b3..40185303e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -20,20 +20,20 @@ categories = ["database-implementations"] rust-version = "1.98.0" [workspace.dependencies] -lance = { "version" = "=15.1.0-beta.2", default-features = false, "tag" = "v15.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } -lance-core = { "version" = "=15.1.0-beta.2", "tag" = "v15.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } -lance-datagen = { "version" = "=15.1.0-beta.2", "tag" = "v15.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } -lance-file = { "version" = "=15.1.0-beta.2", "tag" = "v15.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } -lance-io = { "version" = "=15.1.0-beta.2", default-features = false, "tag" = "v15.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } -lance-index = { "version" = "=15.1.0-beta.2", "tag" = "v15.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } -lance-jsonb = { "version" = "=15.1.0-beta.2", "tag" = "v15.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } -lance-namespace = { "version" = "=15.1.0-beta.2", "tag" = "v15.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } -lance-namespace-impls = { "version" = "=15.1.0-beta.2", default-features = false, "tag" = "v15.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } -lance-table = { "version" = "=15.1.0-beta.2", "tag" = "v15.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } -lance-testing = { "version" = "=15.1.0-beta.2", "tag" = "v15.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } -lance-datafusion = { "version" = "=15.1.0-beta.2", "tag" = "v15.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } -lance-encoding = { "version" = "=15.1.0-beta.2", "tag" = "v15.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } -lance-arrow = { "version" = "=15.1.0-beta.2", "tag" = "v15.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } +lance = { "version" = "=16.0.0-beta.2", default-features = false, "tag" = "v16.0.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } +lance-core = { "version" = "=16.0.0-beta.2", "tag" = "v16.0.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } +lance-datagen = { "version" = "=16.0.0-beta.2", "tag" = "v16.0.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } +lance-file = { "version" = "=16.0.0-beta.2", "tag" = "v16.0.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } +lance-io = { "version" = "=16.0.0-beta.2", default-features = false, "tag" = "v16.0.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } +lance-index = { "version" = "=16.0.0-beta.2", "tag" = "v16.0.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } +lance-jsonb = { "version" = "=16.0.0-beta.2", "tag" = "v16.0.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } +lance-namespace = { "version" = "=16.0.0-beta.2", "tag" = "v16.0.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } +lance-namespace-impls = { "version" = "=16.0.0-beta.2", default-features = false, "tag" = "v16.0.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } +lance-table = { "version" = "=16.0.0-beta.2", "tag" = "v16.0.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } +lance-testing = { "version" = "=16.0.0-beta.2", "tag" = "v16.0.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } +lance-datafusion = { "version" = "=16.0.0-beta.2", "tag" = "v16.0.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } +lance-encoding = { "version" = "=16.0.0-beta.2", "tag" = "v16.0.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } +lance-arrow = { "version" = "=16.0.0-beta.2", "tag" = "v16.0.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } lancedb = { path = "rust/lancedb", default-features = false } ahash = "0.8" anyhow = "1" diff --git a/docs/src/java/java.md b/docs/src/java/java.md index 65023c55b..c3e6df1d0 100644 --- a/docs/src/java/java.md +++ b/docs/src/java/java.md @@ -14,7 +14,7 @@ Add the following dependency to your `pom.xml`: com.lancedb lancedb-core - 0.42.0-beta.32 + 0.42.0-beta.35 ``` diff --git a/docs/src/python/python.md b/docs/src/python/python.md index a8ac45844..39e599184 100644 --- a/docs/src/python/python.md +++ b/docs/src/python/python.md @@ -690,6 +690,10 @@ with BlobReader(read_range, len(payload)) as reader: ::: lancedb.functions.PythonEnvironmentSpec +::: lancedb.functions.RequestedPythonEnvironment + +::: lancedb.functions.PythonEnvironmentBuild + ::: lancedb.functions.function ::: lancedb.functions.FunctionDefinition @@ -724,6 +728,8 @@ with BlobReader(read_range, len(payload)) as reader: ::: lancedb.functions.PythonRuntimeSpec +::: lancedb.functions.RequestedPythonRuntime + ::: lancedb.GpuClass ::: lancedb.functions.FunctionVersionRef diff --git a/java/lancedb-core/pom.xml b/java/lancedb-core/pom.xml index 030ed7027..03b4e1828 100644 --- a/java/lancedb-core/pom.xml +++ b/java/lancedb-core/pom.xml @@ -8,7 +8,7 @@ com.lancedb lancedb-parent - 0.42.0-beta.32 + 0.42.0-beta.35 ../pom.xml diff --git a/java/pom.xml b/java/pom.xml index 2db5fb815..cc9b0d98c 100644 --- a/java/pom.xml +++ b/java/pom.xml @@ -6,7 +6,7 @@ com.lancedb lancedb-parent - 0.42.0-beta.32 + 0.42.0-beta.35 pom ${project.artifactId} LanceDB Java SDK Parent POM @@ -28,7 +28,7 @@ UTF-8 15.0.0 - 15.1.0-beta.2 + 16.0.0-beta.2 2.18.12 false 2.30.0 diff --git a/nodejs/Cargo.toml b/nodejs/Cargo.toml index 82bcdf427..14e53f6d7 100644 --- a/nodejs/Cargo.toml +++ b/nodejs/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "lancedb-nodejs" edition.workspace = true -version = "0.42.0-beta.32" +version = "0.42.0-beta.35" publish = false license.workspace = true description.workspace = true diff --git a/nodejs/npm/darwin-arm64/package.json b/nodejs/npm/darwin-arm64/package.json index 763fa2683..b55506d8f 100644 --- a/nodejs/npm/darwin-arm64/package.json +++ b/nodejs/npm/darwin-arm64/package.json @@ -1,6 +1,6 @@ { "name": "@lancedb/lancedb-darwin-arm64", - "version": "0.42.0-beta.32", + "version": "0.42.0-beta.35", "os": ["darwin"], "cpu": ["arm64"], "main": "lancedb.darwin-arm64.node", diff --git a/nodejs/npm/linux-arm64-gnu/package.json b/nodejs/npm/linux-arm64-gnu/package.json index a83a459cb..d2506ae9d 100644 --- a/nodejs/npm/linux-arm64-gnu/package.json +++ b/nodejs/npm/linux-arm64-gnu/package.json @@ -1,6 +1,6 @@ { "name": "@lancedb/lancedb-linux-arm64-gnu", - "version": "0.42.0-beta.32", + "version": "0.42.0-beta.35", "os": ["linux"], "cpu": ["arm64"], "main": "lancedb.linux-arm64-gnu.node", diff --git a/nodejs/npm/linux-arm64-musl/package.json b/nodejs/npm/linux-arm64-musl/package.json index 3e2626431..682c4b20d 100644 --- a/nodejs/npm/linux-arm64-musl/package.json +++ b/nodejs/npm/linux-arm64-musl/package.json @@ -1,6 +1,6 @@ { "name": "@lancedb/lancedb-linux-arm64-musl", - "version": "0.42.0-beta.32", + "version": "0.42.0-beta.35", "os": ["linux"], "cpu": ["arm64"], "main": "lancedb.linux-arm64-musl.node", diff --git a/nodejs/npm/linux-x64-gnu/package.json b/nodejs/npm/linux-x64-gnu/package.json index ff4c4df58..18899a635 100644 --- a/nodejs/npm/linux-x64-gnu/package.json +++ b/nodejs/npm/linux-x64-gnu/package.json @@ -1,6 +1,6 @@ { "name": "@lancedb/lancedb-linux-x64-gnu", - "version": "0.42.0-beta.32", + "version": "0.42.0-beta.35", "os": ["linux"], "cpu": ["x64"], "main": "lancedb.linux-x64-gnu.node", diff --git a/nodejs/npm/linux-x64-musl/package.json b/nodejs/npm/linux-x64-musl/package.json index 260338c33..6d5d03bfa 100644 --- a/nodejs/npm/linux-x64-musl/package.json +++ b/nodejs/npm/linux-x64-musl/package.json @@ -1,6 +1,6 @@ { "name": "@lancedb/lancedb-linux-x64-musl", - "version": "0.42.0-beta.32", + "version": "0.42.0-beta.35", "os": ["linux"], "cpu": ["x64"], "main": "lancedb.linux-x64-musl.node", diff --git a/nodejs/npm/win32-arm64-msvc/package.json b/nodejs/npm/win32-arm64-msvc/package.json index 1de3b801f..5b493c0f5 100644 --- a/nodejs/npm/win32-arm64-msvc/package.json +++ b/nodejs/npm/win32-arm64-msvc/package.json @@ -1,6 +1,6 @@ { "name": "@lancedb/lancedb-win32-arm64-msvc", - "version": "0.42.0-beta.32", + "version": "0.42.0-beta.35", "os": [ "win32" ], diff --git a/nodejs/npm/win32-x64-msvc/package.json b/nodejs/npm/win32-x64-msvc/package.json index db7c3c4a4..8a8895333 100644 --- a/nodejs/npm/win32-x64-msvc/package.json +++ b/nodejs/npm/win32-x64-msvc/package.json @@ -1,6 +1,6 @@ { "name": "@lancedb/lancedb-win32-x64-msvc", - "version": "0.42.0-beta.32", + "version": "0.42.0-beta.35", "os": ["win32"], "cpu": ["x64"], "main": "lancedb.win32-x64-msvc.node", diff --git a/nodejs/package.json b/nodejs/package.json index 96e4ee9a6..fc101485f 100644 --- a/nodejs/package.json +++ b/nodejs/package.json @@ -11,7 +11,7 @@ "ann" ], "private": false, - "version": "0.42.0-beta.32", + "version": "0.42.0-beta.35", "main": "dist/index.js", "exports": { ".": "./dist/index.js", diff --git a/python/Cargo.toml b/python/Cargo.toml index 67bbfd8d4..6860e66f0 100644 --- a/python/Cargo.toml +++ b/python/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lancedb-python" -version = "0.42.0-beta.32" +version = "0.42.0-beta.35" publish = false edition.workspace = true description = "Python bindings for LanceDB" diff --git a/python/pyproject.toml b/python/pyproject.toml index 8824272b1..294ea4d39 100644 --- a/python/pyproject.toml +++ b/python/pyproject.toml @@ -45,7 +45,7 @@ repository = "https://github.com/lancedb/lancedb" [project.optional-dependencies] pylance = [ # Keep the minimum in the bundled Lance major and compatible with tests below. - "pylance>=15.0.0b3", + "pylance>=16.0.0b2", ] # A library only needs the OpenTelemetry API; the application supplies and # configures the SDK (the actual exporter/reader). See @@ -64,7 +64,7 @@ tests = [ "polars>=0.19, <=1.32.3", "pyarrow>=16", "pyarrow-stubs>=16.0", - "pylance==15.1.0b2", + "pylance==16.0.0b2", "requests>=2.31.0", "datafusion>=54,<55", "opentelemetry-sdk>=1.30.0", diff --git a/python/python/lancedb/functions.py b/python/python/lancedb/functions.py index 4134c9e7b..b2e4cb0eb 100644 --- a/python/python/lancedb/functions.py +++ b/python/python/lancedb/functions.py @@ -405,6 +405,54 @@ class PythonEnvironmentSpec(_RemoteValue): image: Optional[str] = None system_packages: tuple[str, ...] = () + @model_validator(mode="before") + @classmethod + def _validate_registration_build(cls, value): + if isinstance(value, Mapping): + build = value.get("build") + if build is not None and (not isinstance(build, Mapping) or build): + raise TypeError( + "runtime.environment.build is unsupported " + "in typed Function registration" + ) + return value + + +class PythonEnvironmentBuild(_RemoteValue): + """Explicit primary package index URL reported on a Function version.""" + + index_url: str + + +class RequestedPythonEnvironment(PythonEnvironmentSpec): + """Python environment metadata reported on a Function version. + + ``build`` contains only the explicitly requested primary package index URL. + An omitted ``build`` can still accompany extra indexes, other sources, or + service defaults. See + [ResolvedEnvironmentProvenance][lancedb.functions.ResolvedEnvironmentProvenance] + for the sources reported by the build. + """ + + build: Optional[PythonEnvironmentBuild] = None + + @model_validator(mode="before") + @classmethod + def _validate_registration_build(cls, value): + # Inspection accepts an authored model or a wire document with a build field. + if isinstance(value, PythonEnvironmentSpec) and not isinstance(value, cls): + return value._known_dict() + return value + + @field_validator("build", mode="before") + @classmethod + def _read_primary_index(cls, build): + if isinstance(build, PythonEnvironmentBuild): + return build + if isinstance(build, Mapping) and isinstance(build.get("index_url"), str): + return {"index_url": build["index_url"]} + return None + _HUGGING_FACE_MODEL_REPO = re.compile( r"^[A-Za-z0-9][A-Za-z0-9._-]*/[A-Za-z0-9][A-Za-z0-9._-]*$" @@ -543,10 +591,11 @@ class PythonRuntimeSpec(_RemoteValue): Covers Python version, environment sources, environment variables, and GPU settings. Package and system-package order is ignored; conda channel - order is preserved. Compare with ``runtime_digest`` on - [FunctionVersion][lancedb.functions.FunctionVersion]. - This identifies build inputs, not the resolved contents of unpinned - dependencies or the deployment's default base image. + order is preserved. Compare an authored runtime's digest with + ``runtime_digest`` on [FunctionVersion][lancedb.functions.FunctionVersion]. + A version's projected runtime fields can omit inputs from that digest. + This identity covers declared inputs; the installed contents of unpinned + dependencies and the deployment's default base image can vary. """ if self.kind not in {"python", "python_v2"}: raise ValueError(f"cannot digest unknown runtime kind {self.kind!r}") @@ -567,6 +616,25 @@ class PythonRuntimeSpec(_RemoteValue): return f"sha256:{hashlib.sha256(encoded).hexdigest()}" +class RequestedPythonRuntime(PythonRuntimeSpec): + """Requested runtime metadata available during Function version inspection. + + The build view contains only an explicit primary package index URL. Other + sources can be present even when the build view is absent. Compare the + server's ``FunctionVersion.runtime_digest`` with the digest of an authored + runtime. The inspection view can omit inputs needed to reproduce that digest. + """ + + environment: Optional[RequestedPythonEnvironment] = None + + @model_validator(mode="before") + @classmethod + def _discard_unknown_runtime_payload(cls, value): + if isinstance(value, PythonRuntimeSpec) and not isinstance(value, cls): + value = value._known_dict() + return super()._discard_unknown_runtime_payload(value) + + class FunctionImage(_RemoteValue): """A complete OCI Function image identified by its exact manifest digest. @@ -685,12 +753,12 @@ class FunctionEnvironment(NamedTuple): and [FunctionVersion.resolved_environment][lancedb.functions.FunctionVersion.resolved_environment]. It adds no wire field and performs no second parse. ``requested`` is the - runtime specification supplied at registration; ``resolved`` is measured - data and is ``None`` when unknown. For per-platform multiarchitecture + server's view of the runtime requested at registration. ``resolved`` is + measured data and is ``None`` when unknown. For per-platform multiarchitecture measurements, use ``FunctionVersion.environment_report``. """ - requested: Optional[PythonRuntimeSpec] + requested: Optional[RequestedPythonRuntime] resolved: Optional[ResolvedEnvironment] @@ -745,16 +813,16 @@ class FunctionVersion(_RemoteValue): catalog. They are ``None`` for versions registered before the corresponding declaration. - ``runtime`` is the runtime specification requested at registration. It is - not evidence of what was installed. ``resolved_environment`` is measured - data for a single-platform image: actual package names and complete - versions, optional per-package source, provenance, and registration - warnings. ``resolved_environments`` is the corresponding map for a - multiarchitecture image, keyed by OCI ``os/architecture``. It is never - flattened into an aggregate package list. ``None`` or an empty map means - unknown data, not an empty installed environment. ``environment`` is a - convenience view with ``requested`` and ``resolved`` members over the same - fields. + ``runtime`` contains the requested runtime fields exposed by the SDK. + The canonical runtime identity comes from ``runtime_digest``. + ``resolved_environment`` is measured data for a single-platform image: + actual package names and complete versions, optional per-package source, + provenance, and registration warnings. ``resolved_environments`` is the + corresponding map for a multiarchitecture image, keyed by OCI + ``os/architecture``. It is never flattened into an aggregate package list. + ``None`` or an empty map means the measurement is unknown. ``environment`` + is a convenience view with ``requested`` and ``resolved`` members over the + same fields. """ name: str @@ -778,7 +846,7 @@ class FunctionVersion(_RemoteValue): total_gpu_count: Optional[_UInt32] = None row_timeout_seconds: Optional[float] = None result_stability: Optional[str] = None - runtime: Optional[PythonRuntimeSpec] = None + runtime: Optional[RequestedPythonRuntime] = None resolved_environment: Optional[ResolvedEnvironment] = None resolved_environments: Mapping[str, ResolvedEnvironment] = Field( default_factory=dict @@ -957,9 +1025,10 @@ class FunctionRegistrationRequest(_RemoteValue): Credential values deliberately have no field here. The only secret-shaped thing a client sends is ``secret_bindings``: the name of a Secret the database already holds, which the remote service resolves at execution. - ``refresh_lock`` is a per-registration action, not part of the Function's - source or runtime identity; its false default is omitted from canonical - JSON. + ``refresh_lock`` is a per-registration action that leaves the Function's + source and runtime identities unchanged. Its false default is omitted from + canonical JSON. The typed registration API accepts authored runtimes and + rejects nonempty ``runtime.environment.build`` settings. """ name: str @@ -997,6 +1066,24 @@ class FunctionRegistrationRequest(_RemoteValue): def _validate_refresh_lock(cls, value): return _validate_refresh_lock(value) + @field_validator("runtime", mode="before") + @classmethod + def _require_authored_runtime(cls, runtime): + if isinstance(runtime, RequestedPythonRuntime) or ( + isinstance(runtime, PythonRuntimeSpec) + and isinstance(runtime.environment, RequestedPythonEnvironment) + ): + raise TypeError( + "Function version runtime metadata is for inspection only; " + "register an authored @function definition" + ) + return runtime + + def to_canonical_json(self) -> str: + """Encode the authored request for Function registration.""" + self._require_authored_runtime(self.runtime) + return super().to_canonical_json() + def with_refresh_lock(self, refresh_lock: bool) -> FunctionRegistrationRequest: """Return this request with the registration-time refresh action set.""" refresh_lock = _validate_refresh_lock(refresh_lock) @@ -4148,7 +4235,10 @@ __all__ = [ "OutputMapping", "PythonEnvironmentSpec", "PythonAdapterSpec", + "PythonEnvironmentBuild", "PythonRuntimeSpec", + "RequestedPythonEnvironment", + "RequestedPythonRuntime", "ResolvedEnvironment", "ResolvedEnvironmentProvenance", "ResolvedPackage", diff --git a/python/python/tests/test_first_class_function_slice2.py b/python/python/tests/test_first_class_function_slice2.py index b3662e582..751b24cb3 100644 --- a/python/python/tests/test_first_class_function_slice2.py +++ b/python/python/tests/test_first_class_function_slice2.py @@ -33,6 +33,7 @@ from lancedb.functions import ( FunctionSignature, FunctionVersion, HuggingFaceModel, + PythonEnvironmentBuild, PythonRuntimeSpec, SecretBinding, SecretReference, @@ -2640,6 +2641,52 @@ def test_function_version_reads_requested_and_resolved_environments(): FunctionVersion.from_json(json.dumps(invalid)) +@pytest.mark.asyncio +@pytest.mark.parametrize( + "build", + [ + {}, + {"build": None}, + {"build": {}}, + {"build": {"index_url": None}}, + {"build": {"index_url": 1}}, + {"build": "invalid-build"}, + { + "build": { + "index_url": "https://requested.example/simple/", + "find_links": ["https://downloads.example/wheels"], + }, + }, + ], +) +async def test_get_pinned_function_preserves_only_the_requested_index_url(build): + payload = _function_version_with_resolved_environment() + payload["runtime"]["environment"].update(build) + catalog = _RawFunctionCatalog(payload, encode=True) + connection = AsyncConnection(catalog) + + version = await connection.get_function(payload["name"], version=1) + + assert catalog.requested_versions == ["1"] + assert version.version == "1" + requested = version.runtime.environment.build + raw_build = build.get("build") + index_url = raw_build.get("index_url") if isinstance(raw_build, dict) else None + canonical = version.to_canonical_json() + encoded = json.loads(canonical)["runtime"]["environment"] + if not isinstance(index_url, str): + assert requested is None + assert "build" not in encoded + else: + assert isinstance(requested, PythonEnvironmentBuild) + assert requested.index_url == index_url + assert encoded["build"] == {"index_url": index_url} + assert version.resolved_environment.provenance.configured_index_urls == ( + "https://packages.example/simple", + ) + assert FunctionVersion.from_json(canonical) == version + + def test_function_version_reads_resolved_environments_by_platform(): legacy = json.loads( (FIXTURES / "remote_function_version.canonical.json").read_text() diff --git a/python/python/tests/test_function_creation.py b/python/python/tests/test_function_creation.py index 43e7319e2..0d9669693 100644 --- a/python/python/tests/test_function_creation.py +++ b/python/python/tests/test_function_creation.py @@ -8,7 +8,22 @@ import pyarrow as pa import pytest import lancedb -from lancedb.functions import BlobWriter, function +from lancedb.functions import ( + BlobWriter, + FunctionDefinition, + FunctionRegistrationRequest, + FunctionVersion, + function, +) + + +def _stored_function_version(): + fixture = ( + Path(__file__).parents[3] + / "rust/lancedb/tests/fixtures/first_class_functions/v1" + / "remote_function_version.canonical.json" + ) + return json.loads(fixture.read_text()) @pytest.mark.asyncio @@ -16,12 +31,7 @@ from lancedb.functions import BlobWriter, function @pytest.mark.parametrize("exist_ok", [None, False, True]) async def test_function_exist_ok_forwards_sql_and_keeps_stored_version(entry, exist_ok): flight = pytest.importorskip("pyarrow.flight") - fixture = ( - Path(__file__).parents[3] - / "rust/lancedb/tests/fixtures/first_class_functions/v1" - / "remote_function_version.canonical.json" - ) - stored = json.loads(fixture.read_text()) + stored = _stored_function_version() result = pa.table({"definition": [json.dumps(stored)]}) @function(name=stored["name"]) @@ -66,12 +76,7 @@ async def test_function_exist_ok_forwards_sql_and_keeps_stored_version(entry, ex @pytest.mark.asyncio async def test_blob_writer_paths_round_trip_through_function_registration(): flight = pytest.importorskip("pyarrow.flight") - fixture = ( - Path(__file__).parents[3] - / "rust/lancedb/tests/fixtures/first_class_functions/v1" - / "remote_function_version.canonical.json" - ) - stored = json.loads(fixture.read_text()) + stored = _stored_function_version() expected_paths = [[{"field": "item"}], [{"field": "variants"}, "item"]] output_schema = pa.schema( [ @@ -131,3 +136,110 @@ async def test_blob_writer_paths_round_trip_through_function_registration(): application = version(text=lancedb.col("text")).rename(columns={"item": "payload"}) assert json.loads(application.to_canonical_json())["output"] == expected_output assert application.columns == {"item": "payload"} + + +@pytest.mark.asyncio +@pytest.mark.parametrize("with_primary", [False, True]) +async def test_function_index_inspection_is_separate_from_registration(with_primary): + flight = pytest.importorskip("pyarrow.flight") + primary = "https://primary.example/simple/" + extra = "https://extra.example/simple/" + stored = _stored_function_version() + name = stored["name"] + + def scale(value: float) -> float: + return 2 * value + + authored = function(name=name, pip=["example==1.0"], python_version="3.12")(scale) + request = authored.registration_request + expected_runtime = { + "kind": "python", + "python_version": "3.12", + "environment": {"kind": "pip", "packages": ["example==1.0"]}, + } + stored["runtime"] = json.loads(request.runtime.to_canonical_json()) + build = {"extra_index_urls": [extra]} + if with_primary: + build["index_url"] = primary + stored["runtime"]["environment"]["build"] = build + stored["runtime_digest"] = "sha256:" + "1" * 64 + stored["resolved_environment"] = { + "packages": [], + "provenance": {"configured_index_urls": [extra]}, + } + + class FunctionServer(flight.FlightServerBase): + def __init__(self): + super().__init__("grpc://127.0.0.1:0") + self.requests = [] + + def do_get(self, context, ticket): + self.requests.append(ticket.ticket) + return flight.RecordBatchStream( + pa.table({"definition": [json.dumps(stored)]}) + ) + + class IndexedDefinition(FunctionDefinition): + def bind_secrets(self, secrets): + payload = json.loads(super().bind_secrets(secrets).to_canonical_json()) + payload["runtime"]["environment"]["build"] = build + return FunctionRegistrationRequest.from_json(json.dumps(payload)) + + definition = IndexedDefinition( + scale, + name=name, + input_schema=None, + output_schema=None, + pip=("example==1.0",), + env={}, + python_version="3.12", + ) + + with FunctionServer() as server: + options = { + "api_key": "test-key", + "host_override": "http://127.0.0.1:1", + "sql_host_override": f"grpc://127.0.0.1:{server.port}", + } + db = lancedb.connect("db://analytics", **options) + async_db = await lancedb.connect_async("db://analytics", **options) + + message = r"runtime\.environment\.build is unsupported" + with pytest.raises(TypeError, match=message): + db.create_function(definition) + with pytest.raises(TypeError, match=message): + await async_db.create_function_async(definition) + assert server.requests == [] + + version = db.get_function(name, version=1) + assert await async_db.get_function(name, version="1") == version + assert all( + f"DESCRIBE FUNCTION \"{name}\" WITH (version = '1')".encode() in ticket + for ticket in server.requests + ) + assert len(server.requests) == 2 + assert version.runtime_digest == stored["runtime_digest"] + assert version.resolved_environment.provenance.configured_index_urls == (extra,) + canonical = version.to_canonical_json() + encoded = json.loads(canonical) + assert FunctionVersion.from_json(canonical) == version + if with_primary: + assert version.runtime.environment.build.index_url == primary + assert encoded["runtime"]["environment"]["build"] == {"index_url": primary} + else: + assert version.runtime.environment.build is None + assert "build" not in encoded["runtime"]["environment"] + with pytest.raises(TypeError, match="runtime metadata is for inspection only"): + FunctionRegistrationRequest.model_validate( + {**request.model_dump(), "runtime": version.runtime} + ) + with pytest.raises(TypeError, match="runtime metadata is for inspection only"): + request.model_copy(update={"runtime": version.runtime}).to_canonical_json() + + job = await async_db.create_function_async(authored, refresh_lock=True) + assert await job.wait() == version + _, marker, body = server.requests[-1].partition(b" FROM '{") + assert marker + sent, _ = json.JSONDecoder().raw_decode("{" + body.decode(errors="replace")) + assert sent["refresh_lock"] is True + assert sent["runtime"] == expected_runtime diff --git a/python/uv.lock b/python/uv.lock index 5b76d5139..1d794954b 100644 --- a/python/uv.lock +++ b/python/uv.lock @@ -1911,8 +1911,8 @@ requires-dist = [ { name = "pyarrow", marker = "extra == 'tests'", specifier = ">=16" }, { name = "pyarrow-stubs", marker = "extra == 'tests'", specifier = ">=16.0" }, { name = "pydantic", specifier = ">=2.7.4,<3" }, - { name = "pylance", marker = "extra == 'pylance'", specifier = ">=15.0.0b3" }, - { name = "pylance", marker = "extra == 'tests'", specifier = "==15.1.0b2" }, + { name = "pylance", marker = "extra == 'pylance'", specifier = ">=16.0.0b2" }, + { name = "pylance", marker = "extra == 'tests'", specifier = "==16.0.0b2" }, { name = "pyright", marker = "extra == 'dev'", specifier = ">=1.1.350" }, { name = "pytest", marker = "extra == 'tests'", specifier = ">=7.0" }, { name = "pytest-asyncio", marker = "extra == 'tests'", specifier = ">=0.21" }, @@ -3649,20 +3649,20 @@ crypto = [ [[package]] name = "pylance" -version = "15.1.0b2" +version = "16.0.0b2" source = { registry = "https://pypi.fury.io/lance-format/" } dependencies = [ { name = "lance-namespace" }, { name = "pyarrow" }, ] wheels = [ - { url = "https://pypi.fury.io/lance-format/-/ver_vSWFg/pylance-15.1.0b2-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:297f8d3059be999ade63b04d9ce592b71f3c6d5d7fd70cdbb3d2f6a65bc310f2" }, - { url = "https://pypi.fury.io/lance-format/-/ver_28KJav/pylance-15.1.0b2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:414bfef47bd01a159f392a8e8e099fee7c9ab1be2c847ca2cd224f623fdd277e" }, - { url = "https://pypi.fury.io/lance-format/-/ver_7FE7R/pylance-15.1.0b2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:841c44301b060aeb4309bc64c8b60be17b5a12c4801aca2a7f6ded1dd2e414e9" }, - { url = "https://pypi.fury.io/lance-format/-/ver_2jMYDF/pylance-15.1.0b2-cp310-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:5979250018dc7ccabb8193f9f4c01b3c581d48adedd7a73b9ebfcc0104bb7d19" }, - { url = "https://pypi.fury.io/lance-format/-/ver_1XQt8E/pylance-15.1.0b2-cp310-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:bd67e0ada56f9574c12a4300e0ceccb16830d2b16ebc7dabaf1ced38cc7d8593" }, - { url = "https://pypi.fury.io/lance-format/-/ver_H8fyY/pylance-15.1.0b2-cp310-abi3-win_amd64.whl", hash = "sha256:120ed03b30176db76fa1c25223531a59abb77e5a80a9c85923914ad161132904" }, - { url = "https://pypi.fury.io/lance-format/-/ver_zdLur/pylance-15.1.0b2-cp310-abi3-win_arm64.whl", hash = "sha256:5eebf0d2eba1d32ab3ef43c1d69614e265bf7e428480601a4287e3fb33290292" }, + { url = "https://pypi.fury.io/lance-format/-/ver_ZecaD/pylance-16.0.0b2-cp310-abi3-macosx_11_0_arm64.whl", hash = "sha256:f3e5b62af3f7deb3a300a0db8403c773aea1c09b9994133f6c0ec27a7f8dd8f1" }, + { url = "https://pypi.fury.io/lance-format/-/ver_24wBy9/pylance-16.0.0b2-cp310-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:c3c49dc4d9d7b8b6a7dca52f256214e842268c22b5de99e4ec66387964947534" }, + { url = "https://pypi.fury.io/lance-format/-/ver_Ku99Z/pylance-16.0.0b2-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:07da197567e65e9337b748f3f23e5dd0bcc449e8102c77c4725f4cab38c0ac0d" }, + { url = "https://pypi.fury.io/lance-format/-/ver_1ap2tM/pylance-16.0.0b2-cp310-abi3-manylinux_2_28_aarch64.whl", hash = "sha256:6d52963f7a11995008dc4918709557e1e92411112143b9a9b60fc984a94689ce" }, + { url = "https://pypi.fury.io/lance-format/-/ver_fHVmi/pylance-16.0.0b2-cp310-abi3-manylinux_2_28_x86_64.whl", hash = "sha256:6da78f342c182b28c4761ed95d2659cb03c315f3442f48d0b15e2fbb2f785319" }, + { url = "https://pypi.fury.io/lance-format/-/ver_o64X/pylance-16.0.0b2-cp310-abi3-win_amd64.whl", hash = "sha256:4937c4101e6ad28872117f3709f38104f1e20f53fd36146f434e8c04e36cbfc6" }, + { url = "https://pypi.fury.io/lance-format/-/ver_11mfKl/pylance-16.0.0b2-cp310-abi3-win_arm64.whl", hash = "sha256:32af551a7a8cc278dc06acf0e4bcbed9623c3b8fd854c3bed2f5ebd30d574f5d" }, ] [[package]] diff --git a/rust/lancedb/Cargo.toml b/rust/lancedb/Cargo.toml index a9a6c72dc..79ad73355 100644 --- a/rust/lancedb/Cargo.toml +++ b/rust/lancedb/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lancedb" -version = "0.42.0-beta.32" +version = "0.42.0-beta.35" edition.workspace = true description = "LanceDB: A serverless, low-latency vector database for AI applications" license.workspace = true @@ -46,7 +46,7 @@ lance-io = { workspace = true } lance-index = { workspace = true, features = ["tokenizer-jieba", "tokenizer-lindera"] } lance-table = { workspace = true } # Keep the upstream source for downstream SDKs, where workspace patches do not apply. -lance-linalg = { "version" = "=15.1.0-beta.2", "tag" = "v15.1.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } +lance-linalg = { "version" = "=16.0.0-beta.2", "tag" = "v16.0.0-beta.2", "git" = "https://github.com/lance-format/lance.git" } lance-encoding = { workspace = true } lance-arrow = { workspace = true } lance-namespace = { workspace = true } diff --git a/rust/lancedb/cli/Cargo.toml b/rust/lancedb/cli/Cargo.toml index 200b5e67a..b0cfbea4f 100644 --- a/rust/lancedb/cli/Cargo.toml +++ b/rust/lancedb/cli/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lancedb-cli" -version = "0.42.0-beta.32" +version = "0.42.0-beta.35" edition = "2021" license.workspace = true repository.workspace = true diff --git a/rust/lancedb/src/function.rs b/rust/lancedb/src/function.rs index 4c865ae8d..5e50abecb 100644 --- a/rust/lancedb/src/function.rs +++ b/rust/lancedb/src/function.rs @@ -681,6 +681,39 @@ impl<'de> Deserialize<'de> for RowTimeoutSeconds { } } +// Function inspection includes this build setting alongside the SDK's authored +// runtime spec. Keep it on the readback model so registration keeps its own wire shape. +#[derive(Debug, Clone, PartialEq, Eq)] +struct RequestedPythonRuntime { + spec: PythonRuntimeSpec, + index_url: Option, +} + +impl<'de> Deserialize<'de> for RequestedPythonRuntime { + fn deserialize>(deserializer: D) -> std::result::Result { + let document = Value::deserialize(deserializer)?; + let index_url = document + .pointer("/environment/build/index_url") + .and_then(Value::as_str) + .map(str::to_owned); + let spec: PythonRuntimeSpec = + serde_json::from_value(document).map_err(de::Error::custom)?; + let index_url = spec.environment().and(index_url); + Ok(Self { spec, index_url }) + } +} + +impl Serialize for RequestedPythonRuntime { + fn serialize(&self, serializer: S) -> std::result::Result { + let Some(index_url) = &self.index_url else { + return self.spec.serialize(serializer); + }; + let mut document = serde_json::to_value(&self.spec).map_err(serde::ser::Error::custom)?; + document["environment"]["build"] = serde_json::json!({"index_url": index_url}); + document.serialize(serializer) + } +} + /// One immutable Function object revision and its executable artifact. /// /// The Function is named by its parts, `name` and `namespace_path`, the way a @@ -764,7 +797,7 @@ pub struct FunctionVersion { /// [`Self::resolved_environment`] when the caller needs actual package /// versions. #[serde(default, skip_serializing_if = "Option::is_none")] - runtime: Option, + runtime: Option, /// Actual installed distributions, provenance, and registration warnings. /// /// This is the single-platform compatibility field. `None` on a @@ -838,7 +871,8 @@ impl FunctionVersion { /// Digest of canonical runtime inputs, when provided by the server. /// - /// Includes Python version, environment sources, variables, and GPU settings. + /// Compare it with the digest of a locally authored runtime. The runtime + /// projection on this version can omit inputs needed to reproduce the digest. /// A missing digest cannot establish that a local runtime matches. Reusing a /// version also requires matching its source and other registration inputs. pub fn runtime_digest(&self) -> Option<&str> { @@ -885,12 +919,21 @@ impl FunctionVersion { self.result_stability.as_deref() } - /// The runtime specification requested at registration, when exposed by the - /// server. + /// Runtime metadata requested at registration and exposed by the server. /// - /// This is the requested configuration, not evidence of what was installed. + /// This view can omit input needed to reproduce [`Self::runtime_digest`]. + /// Read the explicit primary package index with [`Self::requested_index_url`], + /// and inspect installed distributions with [`Self::resolved_environment`]. pub fn runtime(&self) -> Option<&PythonRuntimeSpec> { - self.runtime.as_ref() + self.runtime.as_ref().map(|runtime| &runtime.spec) + } + + /// Explicit primary package index URL requested for this Function version. + /// + /// An absent value can still accompany extra indexes, other sources, or + /// service defaults. For build provenance, see [`ResolvedEnvironmentProvenance`]. + pub fn requested_index_url(&self) -> Option<&str> { + self.runtime.as_ref()?.index_url.as_deref() } /// Actual installed distributions and registration warnings for a @@ -1083,6 +1126,7 @@ pub struct FunctionRegistrationRequest { pub name: String, pub artifact: FunctionArtifactRequest, pub signature: FunctionSignature, + #[serde(deserialize_with = "deserialize_registration_runtime")] pub runtime: PythonRuntimeSpec, /// Maximum rows in one execution batch; the executor may use fewer. #[serde( @@ -1144,8 +1188,25 @@ pub struct FunctionRegistrationRequest { pub refresh_lock: bool, } +fn deserialize_registration_runtime<'de, D: Deserializer<'de>>( + deserializer: D, +) -> std::result::Result { + let document = Value::deserialize(deserializer)?; + match document.pointer("/environment/build") { + None | Some(Value::Null) => {} + Some(Value::Object(build)) if build.is_empty() => {} + Some(_) => { + return Err(de::Error::custom( + "runtime.environment.build is unsupported in typed Function registration", + )); + } + } + serde_json::from_value(document).map_err(de::Error::custom) +} + impl FunctionRegistrationRequest { /// Decode a registration request supplied by an SDK language binding. + /// Nonempty environment build settings are rejected by this typed API. pub fn from_json(json: &str) -> Result { from_json(json) } @@ -1960,6 +2021,84 @@ mod tests { assert!(FunctionVersion::from_json(&document.to_string()).is_err()); } + #[test] + fn function_version_exposes_the_explicit_primary_index() { + const VERSION: &str = include_str!( + "../tests/fixtures/first_class_functions/v1/remote_function_version.canonical.json" + ); + const PRIMARY: &str = "https://primary.example/simple/"; + const EXTRA: &str = "https://extra.example/simple/"; + const DIGEST: &str = "sha256:requested-runtime"; + let mut document: Value = serde_json::from_str(VERSION).unwrap(); + document["runtime"] = serde_json::json!({ + "kind": "python", + "python_version": "3.12", + "environment": {"kind": "pip", "packages": ["example==1.0"]}, + }); + document["runtime_digest"] = serde_json::json!(DIGEST); + document["resolved_environment"] = serde_json::json!({ + "packages": [], + "provenance": {"configured_index_urls": [EXTRA]}, + }); + + let legacy = FunctionVersion::from_json(&document.to_string()).unwrap(); + assert_eq!(legacy.requested_index_url(), None); + let legacy_json = legacy.to_canonical_json().unwrap(); + for (build, index) in [ + (Value::Null, None), + (serde_json::json!({}), None), + (serde_json::json!({"extra_index_urls": [EXTRA]}), None), + (serde_json::json!({"index_url": 1}), None), + (serde_json::json!("invalid-build"), None), + ( + serde_json::json!({"index_url": PRIMARY, "extra_index_urls": [EXTRA]}), + Some(PRIMARY), + ), + ] { + document["runtime"]["environment"]["build"] = build; + let version = FunctionVersion::from_json(&document.to_string()).unwrap(); + assert_eq!(version.requested_index_url(), index); + assert_eq!(version.runtime_digest(), Some(DIGEST)); + let canonical = version.to_canonical_json().unwrap(); + if let Some(index) = index { + let mut expected: Value = serde_json::from_str(&legacy_json).unwrap(); + expected["runtime"]["environment"]["build"] = + serde_json::json!({"index_url": index}); + assert_eq!(serde_json::from_str::(&canonical).unwrap(), expected); + } else { + assert_eq!(canonical, legacy_json); + } + assert_eq!(FunctionVersion::from_json(&canonical).unwrap(), version); + } + } + + #[test] + fn typed_registration_rejects_environment_build_settings() { + const REQUEST: &str = include_str!( + "../tests/fixtures/first_class_functions/v1/remote_function_registration_request.json" + ); + let mut document: Value = serde_json::from_str(REQUEST).unwrap(); + let expected = FunctionRegistrationRequest::from_json(REQUEST).unwrap(); + for build in [Value::Null, serde_json::json!({})] { + document["runtime"]["environment"]["build"] = build; + assert_eq!( + FunctionRegistrationRequest::from_json(&document.to_string()).unwrap(), + expected + ); + } + for build in [ + serde_json::json!({"index_url": "https://primary.example/simple/"}), + serde_json::json!({"extra_index_urls": ["https://extra.example/simple/"]}), + serde_json::json!("invalid-build"), + ] { + document["runtime"]["environment"]["build"] = build; + let error = FunctionRegistrationRequest::from_json(&document.to_string()).unwrap_err(); + assert!(error.to_string().contains( + "runtime.environment.build is unsupported in typed Function registration" + )); + } + } + #[test] fn function_version_preserves_requested_and_resolved_environments() { const VERSION: &str = include_str!( diff --git a/rust/lancedb/src/remote/sql_test.rs b/rust/lancedb/src/remote/sql_test.rs index 277ec16ae..770fe32fc 100644 --- a/rust/lancedb/src/remote/sql_test.rs +++ b/rust/lancedb/src/remote/sql_test.rs @@ -3406,6 +3406,11 @@ async fn function_creation_and_description_use_sql_query_handles() { version_json["row_timeout_seconds"] = serde_json::json!(8.0); version_json["result_stability"] = serde_json::json!("input_and_context"); version_json["runtime"] = request_json["runtime"].clone(); + let requested_index_url = "https://requested.example/simple/"; + version_json["runtime"]["environment"]["build"] = serde_json::json!({ + "index_url": requested_index_url, + "find_links": ["https://downloads.example/wheels"], + }); version_json["resolved_environment"] = serde_json::json!({ "packages": [ { @@ -3551,6 +3556,7 @@ async fn function_creation_and_description_use_sql_query_handles() { assert_eq!(described.row_timeout_seconds(), Some(8.0)); assert_eq!(described.result_stability(), Some("input_and_context")); assert_eq!(described.runtime().unwrap().kind(), "python"); + assert_eq!(described.requested_index_url(), Some(requested_index_url)); assert_eq!( described .resolved_environment() @@ -3570,6 +3576,14 @@ async fn function_creation_and_description_use_sql_query_handles() { assert_eq!(described_json["max_concurrency"], 4); assert_eq!(described_json["row_timeout_seconds"], 8.0); assert_eq!(described_json["result_stability"], "input_and_context"); + assert_eq!( + described_json["runtime"]["environment"]["build"], + serde_json::json!({"index_url": requested_index_url}) + ); + assert_eq!( + described_json["resolved_environment"]["provenance"]["configured_index_urls"], + serde_json::json!(["https://packages.example/simple"]) + ); let latest = db .get_function_latest("embed", &["team".into()]) .await diff --git a/rust/lancedb/src/table.rs b/rust/lancedb/src/table.rs index aa6b68747..0f1e7bb1c 100644 --- a/rust/lancedb/src/table.rs +++ b/rust/lancedb/src/table.rs @@ -3618,6 +3618,43 @@ impl NativeTable { .await } + /// Open a native table at a retained version of the dataset at `uri`. + /// + /// The version is selected during the dataset open. The returned handle is + /// read-only until it checks out the latest version. `params` supplies the + /// session, storage options, and commit handler for the dataset. + /// + /// ``` + /// use lancedb::table::{BaseTable, NativeTable}; + /// + /// async fn count_snapshot(uri: &str, version: u64) -> lancedb::Result { + /// let table = NativeTable::open_at_version(uri, "events", version, Default::default()).await?; + /// let rows = table.count_rows(None).await?; + /// table.checkout_latest().await?; + /// Ok(rows) + /// } + /// ``` + pub async fn open_at_version( + uri: &str, + name: &str, + version: u64, + params: ReadParams, + ) -> Result { + Self::open_native( + uri, + name, + Vec::new(), + None, + Some(params), + None, + None, + HashSet::new(), + None, + Some(version), + ) + .await + } + /// Opens an existing Table /// /// # Arguments @@ -3644,6 +3681,34 @@ impl NativeTable { namespace_client: Option>, pushdown_operations: HashSet, managed_versioning: Option, + ) -> Result { + Self::open_native( + uri, + name, + namespace, + write_store_wrapper, + params, + read_consistency_interval, + namespace_client, + pushdown_operations, + managed_versioning, + None, + ) + .await + } + + #[allow(clippy::too_many_arguments)] + async fn open_native( + uri: &str, + name: &str, + namespace: Vec, + write_store_wrapper: Option>, + params: Option, + read_consistency_interval: Option, + namespace_client: Option>, + pushdown_operations: HashSet, + managed_versioning: Option, + version: Option, ) -> Result { let params = params.unwrap_or_default(); // patch the params if we have a write store wrapper @@ -3682,6 +3747,9 @@ impl NativeTable { }; let mut builder = DatasetBuilder::from_uri(uri).with_read_params(params); + if let Some(version) = version { + builder = builder.with_version(version); + } // Set up commit handler when managed_versioning is enabled if managed_versioning && let Some(ref ns_client) = namespace_client { @@ -3709,9 +3777,12 @@ impl NativeTable { Err(e) => return Err(e.into()), }; - crate::docs::check_table_maintenance_warnings(&dataset, uri).await; - - let dataset = DatasetConsistencyWrapper::new_latest(dataset, read_consistency_interval); + let dataset = if version.is_some() { + DatasetConsistencyWrapper::new_time_travel(dataset, read_consistency_interval) + } else { + crate::docs::check_table_maintenance_warnings(&dataset, uri).await; + DatasetConsistencyWrapper::new_latest(dataset, read_consistency_interval) + }; let id = Self::build_id(&namespace, name); Ok(Self { @@ -5308,6 +5379,41 @@ mod tests { assert_eq!(table.name, "test") } + #[tokio::test] + async fn opens_a_retained_native_version_with_an_unreadable_latest_manifest() { + let dir = tempdir().unwrap(); + let path = dir.path().join("events.lance"); + let uri = path.to_str().unwrap(); + let batch = make_test_batches(); + let rows = batch.num_rows(); + let mut dataset = Dataset::write( + RecordBatchIterator::new([Ok(batch.clone())], batch.schema()), + uri, + None, + ) + .await + .unwrap(); + let retained = dataset.version().version; + dataset + .append( + RecordBatchIterator::new([Ok(batch.clone())], batch.schema()), + None, + ) + .await + .unwrap(); + assert_eq!(dataset.count_rows(None).await.unwrap(), rows * 2); + let latest = dataset.manifest_location().path.filename().unwrap(); + std::fs::write(path.join("_versions").join(latest), b"unreadable manifest").unwrap(); + assert!(NativeTable::open(uri).await.is_err()); + + let pinned = NativeTable::open_at_version(uri, "events", retained, ReadParams::default()) + .await + .unwrap(); + assert_eq!(pinned.version().await.unwrap(), retained); + assert_eq!(pinned.count_rows(None).await.unwrap(), rows); + assert!(pinned.dataset.ensure_mutable().is_err()); + } + /// The per-row error store is a server feature; a LanceDB Embedded table says so /// rather than answering with an empty listing. #[tokio::test] diff --git a/rust/lancedb/vendor/lance-linalg/Cargo.toml b/rust/lancedb/vendor/lance-linalg/Cargo.toml index 8ed8d3ca9..959d9554d 100644 --- a/rust/lancedb/vendor/lance-linalg/Cargo.toml +++ b/rust/lancedb/vendor/lance-linalg/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "lance-linalg" -version = "15.1.0-beta.2" +version = "16.0.0-beta.2" publish = false edition = { workspace = true } license = { workspace = true } diff --git a/rust/lancedb/vendor/lance-linalg/README.lancedb.md b/rust/lancedb/vendor/lance-linalg/README.lancedb.md index 9998cb4ca..69e449137 100644 --- a/rust/lancedb/vendor/lance-linalg/README.lancedb.md +++ b/rust/lancedb/vendor/lance-linalg/README.lancedb.md @@ -1,5 +1,5 @@ -This directory contains `rust/lance-linalg` from Lance tag `v15.1.0-beta.2` -(commit `fc8f59e53233a46f0d73604d66254142802389c9`), licensed under Apache-2.0. +This directory contains `rust/lance-linalg` from Lance tag `v16.0.0-beta.2` +(commit `9eb4b09226b252f0d3d58448aa5f435147bcef13`), licensed under Apache-2.0. LanceDB patches `src/distance/cosine.rs` to recompute FLOAT32 cosine distances in FLOAT64 when squared norms or dot products overflow or underflow. Ordinary