Elffuss BraidHub

kikocis/lancedb public

b5f7336ae52e · 1.6 KiBRawPermalink
1// Copyright 2024 Lance Developers.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7// http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15use arrow::RecordBatchStream;
16use connection::{connect, Connection};
17use env_logger::Env;
18use index::{Index, IndexConfig};
19use pyo3::{pymodule, types::PyModule, wrap_pyfunction, PyResult, Python};
20use query::{Query, VectorQuery};
21use table::Table;
22
23pub mod arrow;
24pub mod connection;
25pub mod error;
26pub mod index;
27pub mod query;
28pub mod table;
29pub mod util;
30
31#[pymodule]
32pub fn _lancedb(_py: Python, m: &PyModule) -> PyResult<()> {
33 let env = Env::new()
34 .filter_or("LANCEDB_LOG", "warn")
35 .write_style("LANCEDB_LOG_STYLE");
36 env_logger::init_from_env(env);
37 m.add_class::<Connection>()?;
38 m.add_class::<Table>()?;
39 m.add_class::<Index>()?;
40 m.add_class::<IndexConfig>()?;
41 m.add_class::<Query>()?;
42 m.add_class::<VectorQuery>()?;
43 m.add_class::<RecordBatchStream>()?;
44 m.add_function(wrap_pyfunction!(connect, m)?)?;
45 m.add_function(wrap_pyfunction!(util::validate_table_name, m)?)?;
46 m.add("__version__", env!("CARGO_PKG_VERSION"))?;
47 Ok(())
48}