luoyuxia commented on code in PR #7: URL: https://github.com/apache/fluss-rust/pull/7#discussion_r2348182394
########## bindings/python/Cargo.toml: ########## @@ -0,0 +1,39 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +[package] +name = "fluss_python" +edition = "2024" +version = "0.1.0" +license = "apache-2.0" +rust-version = "1.85" + +[lib] +name = "fluss_python" Review Comment: Have gone through other projects, we should use `fluss` ```suggestion name = "fluss" ``` ########## bindings/python/Cargo.toml: ########## @@ -0,0 +1,39 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +[package] +name = "fluss_python" +edition = "2024" +version = "0.1.0" +license = "apache-2.0" +rust-version = "1.85" + +[lib] +name = "fluss_python" +crate-type = ["cdylib"] + +[workspace] + +[dependencies] +pyo3 = { version = "0.24", features = ["extension-module"] } +fluss = { path = "../../crates/fluss" } +tokio = { version = "1.44.2", features = ["full"] } Review Comment: ``` tokio = { workspace = true } ``` ########## bindings/python/pyproject.toml: ########## @@ -0,0 +1,98 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +[build-system] +requires = ["maturin>=1.0,<2.0"] +build-backend = "maturin" + +[project] +name = "fluss_python" +description = "Python bindings for Fluss" Review Comment: ```suggestion description = "Python bindings for Fluss on fluss-rust with Pandas integration" ``` ########## bindings/python/Cargo.toml: ########## @@ -0,0 +1,39 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +[package] +name = "fluss_python" +edition = "2024" +version = "0.1.0" +license = "apache-2.0" +rust-version = "1.85" + +[lib] +name = "fluss_python" +crate-type = ["cdylib"] + +[workspace] + +[dependencies] +pyo3 = { version = "0.24", features = ["extension-module"] } +fluss = { path = "../../crates/fluss" } +tokio = { version = "1.44.2", features = ["full"] } +arrow = "55.1.0" +arrow-pyarrow = "55.1.0" +pyo3-async-runtimes = { version = "0.24.0", features = ["tokio-runtime"] } +chrono = "0.4.41" Review Comment: dito. use { workspace = true } ########## bindings/python/README.md: ########## @@ -0,0 +1,147 @@ +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. +--> + +# Fluss Python Bindings + +Python bindings for Fluss using PyO3 and Maturin. + +## System Requirements + +- Python 3.9+ +- Rust 1.70+ +- uv package manager +- MacOS + +> **⚠️ Before you start:** +> Please make sure you can successfully build and run the [Fluss Rust client](../../crates/fluss/README.md) on your machine. +> The Python bindings require a working Fluss Rust backend and compatible environment. + +## Development Environment Setup + +### 1. Install Dependencies-dev + +```bash +cd bindings/python +uv sync --all-extras +``` + +### 2. Build Development Version + +```bash +source .venv/bin/activate +uv run maturin develop +``` + +### 3. Build Release Version + +```bash +uv run maturin build --release +``` + +### 4. Code Formatting and Linting + +```bash +uv run ruff format python/ +uv run ruff check python/ +``` + +### 5. Type Checking + +```bash +uv run mypy python/ +``` + +### 6. Run Examples + +```bash +uv run python example/example.py +``` + +### 7. Build API docs: + +```bash +uv run pdoc fluss_python +``` + +## Project Structure +``` +bindings/python/ +├── Cargo.toml # Rust dependency configuration +├── pyproject.toml # Python project configuration +├── README.md # This file +├── src/ # Rust source code +│ ├── lib.rs # Main entry module +│ ├── config.rs # Configuration related +│ ├── connection.rs # Connection management +│ ├── admin.rs # Admin operations +│ ├── table.rs # Table operations +│ ├── types.rs # Data types +│ └── error.rs # Error handling +├── python/ # Python package source +│ └── fluss_python/ +│ ├── __init__.py # Python package entry + ├── __init__.pyi # Stub file +│ └── py.typed # Type declarations +└── example/ # Example code + └── example.py +``` + +## API Overview + +### Basic Usage + Review Comment: add todo in here ########## bindings/python/Cargo.toml: ########## @@ -0,0 +1,39 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +[package] +name = "fluss_python" +edition = "2024" +version = "0.1.0" +license = "apache-2.0" +rust-version = "1.85" + +[lib] +name = "fluss_python" +crate-type = ["cdylib"] + +[workspace] + +[dependencies] +pyo3 = { version = "0.24", features = ["extension-module"] } +fluss = { path = "../../crates/fluss" } +tokio = { version = "1.44.2", features = ["full"] } +arrow = "55.1.0" Review Comment: See what delta did https://github.com/delta-io/delta-rs/blob/main/python/Cargo.toml ########## bindings/python/Cargo.toml: ########## @@ -0,0 +1,39 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +[package] +name = "fluss_python" +edition = "2024" +version = "0.1.0" +license = "apache-2.0" +rust-version = "1.85" + +[lib] +name = "fluss_python" +crate-type = ["cdylib"] + +[workspace] + +[dependencies] +pyo3 = { version = "0.24", features = ["extension-module"] } +fluss = { path = "../../crates/fluss" } +tokio = { version = "1.44.2", features = ["full"] } +arrow = "55.1.0" Review Comment: I'd like to suggestion arrow also use `{ workspace = true }` ########## bindings/python/Cargo.toml: ########## @@ -0,0 +1,39 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +[package] +name = "fluss_python" +edition = "2024" +version = "0.1.0" +license = "apache-2.0" +rust-version = "1.85" + +[lib] +name = "fluss_python" +crate-type = ["cdylib"] + +[workspace] + +[dependencies] +pyo3 = { version = "0.24", features = ["extension-module"] } +fluss = { path = "../../crates/fluss" } +tokio = { version = "1.44.2", features = ["full"] } +arrow = "55.1.0" +arrow-pyarrow = "55.1.0" +pyo3-async-runtimes = { version = "0.24.0", features = ["tokio-runtime"] } +chrono = "0.4.41" +once_cell = "1.21.3" Review Comment: why `once_cell` is needed? If needed, we can attach it in following pull requests. ########## bindings/python/pyproject.toml: ########## @@ -0,0 +1,98 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +[build-system] +requires = ["maturin>=1.0,<2.0"] +build-backend = "maturin" + +[project] +name = "fluss_python" +description = "Python bindings for Fluss" +authors = [{name = "Fluss Team"}] +license = {text = "Apache-2.0"} +readme = "README.md" +requires-python = ">=3.9" +classifiers = [ + "Programming Language :: Rust", + "Programming Language :: Python :: Implementation :: CPython", +] + +dynamic = ["version"] + +dependencies = [ + "pandas>=2.3.1", + "pyarrow>=10.0.0", +] + +[project.urls] +Repository = "https://github.com/apache/fluss-rust" + +[project.optional-dependencies] +dev = [ + "mypy>=1.17.1", + "pytest>=8.3.5", + "pytest-asyncio>=0.25.3", + "ruff>=0.9.10", + "maturin>=1.8.2", +] +docs = [ + "pdoc>=15.0.4", +] +extra = [ + "tqdm>=4.67.1", + "duckdb>=0.9.0", + "pylance>=0.33.0", +] + +[tool.maturin] +python-source = "python" +module-name = "fluss_python" +features = ["pyo3/extension-module"] + +[tool.uv] +cache-keys = [ + { file = "pyproject.toml" }, + { file = "Cargo.toml" }, + { file = "src/**/*.rs" }, + { file = "../../crates/**/*.rs" }, +] + +[tool.ruff] +line-length = 88 +fix = true + +[tool.ruff.lint] +ignore = ["E402", "F403", "F405"] +select = ["E", "F", "I"] + +[tool.ruff.lint.pycodestyle] +max-doc-length = 88 + +[tool.ruff.lint.pydocstyle] +convention = "numpy" + +[tool.ruff.format] +docstring-code-format = true + +[tool.ruff.lint.isort] +known-first-party = ["fluss_python"] Review Comment: ```suggestion known-first-party = ["fluss"] ```? ########## .licenserc.yaml: ########## @@ -26,4 +26,5 @@ header: - 'LICENSE' - 'NOTICE' - 'DISCLAIMER' + - 'bindings/python/uv.lock' Review Comment: why we need to add `uv.lock`, haven't seen any python binding project include it. I think we don't need to include it since cargo.lock is also ignored by us ########## bindings/python/pyproject.toml: ########## @@ -0,0 +1,98 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +[build-system] +requires = ["maturin>=1.0,<2.0"] +build-backend = "maturin" + +[project] +name = "fluss_python" +description = "Python bindings for Fluss" +authors = [{name = "Fluss Team"}] +license = {text = "Apache-2.0"} +readme = "README.md" +requires-python = ">=3.9" +classifiers = [ Review Comment: ```suggestion classifiers = [ "License :: OSI Approved :: Apache Software License", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", ] ``` I found it from delta-rs https://github.com/delta-io/delta-rs/blob/main/python/pyproject.toml#L12 I think delta-rs is much better ########## bindings/python/README.md: ########## @@ -0,0 +1,147 @@ +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. +--> + +# Fluss Python Bindings + +Python bindings for Fluss using PyO3 and Maturin. + +## System Requirements + +- Python 3.9+ +- Rust 1.70+ +- uv package manager +- MacOS Review Comment: nit: Linux or macOs ########## bindings/python/pyproject.toml: ########## @@ -0,0 +1,98 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +[build-system] +requires = ["maturin>=1.0,<2.0"] +build-backend = "maturin" + +[project] +name = "fluss_python" Review Comment: ```suggestion name = "fluss" ``` ########## bindings/python/pyproject.toml: ########## @@ -0,0 +1,98 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +[build-system] +requires = ["maturin>=1.0,<2.0"] +build-backend = "maturin" + +[project] +name = "fluss_python" +description = "Python bindings for Fluss" +authors = [{name = "Fluss Team"}] +license = {text = "Apache-2.0"} +readme = "README.md" +requires-python = ">=3.9" +classifiers = [ + "Programming Language :: Rust", + "Programming Language :: Python :: Implementation :: CPython", +] + +dynamic = ["version"] + +dependencies = [ + "pandas>=2.3.1", + "pyarrow>=10.0.0", +] + +[project.urls] +Repository = "https://github.com/apache/fluss-rust" + +[project.optional-dependencies] +dev = [ + "mypy>=1.17.1", + "pytest>=8.3.5", + "pytest-asyncio>=0.25.3", + "ruff>=0.9.10", + "maturin>=1.8.2", +] +docs = [ + "pdoc>=15.0.4", +] +extra = [ Review Comment: why do we need these. IIUC, fluss-python should incldue `tqdm`, `duckdb`, `pylance`. Users are expected to install them by themself ########## bindings/python/README.md: ########## @@ -0,0 +1,147 @@ +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. +--> + +# Fluss Python Bindings + +Python bindings for Fluss using PyO3 and Maturin. + +## System Requirements Review Comment: The `System Requirements` should be requirements for developer, right? Users don't need to install `Rust`. ########## bindings/python/pyproject.toml: ########## @@ -0,0 +1,98 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +[build-system] +requires = ["maturin>=1.0,<2.0"] +build-backend = "maturin" + +[project] +name = "fluss_python" +description = "Python bindings for Fluss" +authors = [{name = "Fluss Team"}] +license = {text = "Apache-2.0"} +readme = "README.md" +requires-python = ">=3.9" +classifiers = [ + "Programming Language :: Rust", + "Programming Language :: Python :: Implementation :: CPython", +] + +dynamic = ["version"] + +dependencies = [ + "pandas>=2.3.1", + "pyarrow>=10.0.0", +] + +[project.urls] +Repository = "https://github.com/apache/fluss-rust" + +[project.optional-dependencies] +dev = [ + "mypy>=1.17.1", + "pytest>=8.3.5", + "pytest-asyncio>=0.25.3", + "ruff>=0.9.10", + "maturin>=1.8.2", +] +docs = [ + "pdoc>=15.0.4", +] +extra = [ + "tqdm>=4.67.1", + "duckdb>=0.9.0", + "pylance>=0.33.0", +] + +[tool.maturin] +python-source = "python" +module-name = "fluss_python" Review Comment: ```suggestion module-name = "fluss._fluss" ```? ########## bindings/python/README.md: ########## @@ -0,0 +1,147 @@ +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. +--> + +# Fluss Python Bindings + +Python bindings for Fluss using PyO3 and Maturin. + +## System Requirements + +- Python 3.9+ +- Rust 1.70+ +- uv package manager +- MacOS + +> **⚠️ Before you start:** +> Please make sure you can successfully build and run the [Fluss Rust client](../../crates/fluss/README.md) on your machine. +> The Python bindings require a working Fluss Rust backend and compatible environment. + +## Development Environment Setup + +### 1. Install Dependencies-dev + +```bash +cd bindings/python +uv sync --all-extras +``` + +### 2. Build Development Version + +```bash +source .venv/bin/activate +uv run maturin develop +``` + +### 3. Build Release Version + +```bash +uv run maturin build --release +``` + +### 4. Code Formatting and Linting + +```bash +uv run ruff format python/ +uv run ruff check python/ +``` + +### 5. Type Checking + +```bash +uv run mypy python/ +``` + +### 6. Run Examples + +```bash +uv run python example/example.py +``` + +### 7. Build API docs: + +```bash +uv run pdoc fluss_python +``` + +## Project Structure +``` +bindings/python/ +├── Cargo.toml # Rust dependency configuration +├── pyproject.toml # Python project configuration +├── README.md # This file +├── src/ # Rust source code +│ ├── lib.rs # Main entry module +│ ├── config.rs # Configuration related +│ ├── connection.rs # Connection management +│ ├── admin.rs # Admin operations +│ ├── table.rs # Table operations +│ ├── types.rs # Data types +│ └── error.rs # Error handling +├── python/ # Python package source +│ └── fluss_python/ +│ ├── __init__.py # Python package entry + ├── __init__.pyi # Stub file +│ └── py.typed # Type declarations +└── example/ # Example code + └── example.py +``` + +## API Overview Review Comment: we shuld always put user-faced api into first. So, let's organize it as, assuming `System Requirements` is only for developer: ``` <!-- ~ Licensed to the Apache Software Foundation (ASF) under one ~ or more contributor license agreements. See the NOTICE file ~ distributed with this work for additional information ~ regarding copyright ownership. The ASF licenses this file ~ to you under the Apache License, Version 2.0 (the ~ "License"); you may not use this file except in compliance ~ with the License. You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, ~ software distributed under the License is distributed on an ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY ~ KIND, either express or implied. See the License for the ~ specific language governing permissions and limitations ~ under the License. --> # Apache Fluss™ Python Bindings Python bindings for Fluss using PyO3 and Maturin. ## API Overview ### Basic Usage ### Core Classes #### `Config` Configuration for Fluss connection parameters #### `FlussConnection` Main interface for connecting to Fluss cluster #### `FlussAdmin` Administrative operations for managing tables (create, delete, etc.) #### `FlussTable` Represents a Fluss table, providing read and write operations #### `TableWriter` Used for writing data to tables, supports PyArrow and Pandas #### `LogScanner` Used for scanning table log data ### Release ```bash # Build wheel uv run maturin build --release # Publish to PyPI uv run maturin publish ``` ## Development ### Requirements - Python 3.9+ - Rust 1.70+ - uv package manager - MacOS > **⚠️ Before you start:** > Please make sure you can successfully build and run the [Fluss Rust client](../../crates/fluss/README.md) on your machine. > The Python bindings require a working Fluss Rust backend and compatible environment. ### Install Dependencies-dev ```bash cd bindings/python uv sync --all-extras ``` ### Build Development Version ```bash source .venv/bin/activate uv run maturin develop ``` ### Build Release Version ```bash uv run maturin build --release ``` ### Code Formatting and Linting ```bash uv run ruff format python/ uv run ruff check python/ ``` ### Type Checking ```bash uv run mypy python/ ``` ### Run Examples ```bash uv run python example/example.py ``` ### Build API docs: ```bash uv run pdoc fluss_python ``` ### Project Structure ``` bindings/python/ ├── Cargo.toml # Rust dependency configuration ├── pyproject.toml # Python project configuration ├── README.md # This file ├── src/ # Rust source code │ ├── lib.rs # Main entry module │ ├── config.rs # Configuration related │ ├── connection.rs # Connection management │ ├── admin.rs # Admin operations │ ├── table.rs # Table operations │ ├── types.rs # Data types │ └── error.rs # Error handling ├── python/ # Python package source │ └── fluss_python/ │ ├── __init__.py # Python package entry ├── __init__.pyi # Stub file │ └── py.typed # Type declarations └── example/ # Example code └── example.py ``` ## License Apache 2.0 License ``` ########## bindings/python/README.md: ########## @@ -0,0 +1,147 @@ +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. +--> + +# Fluss Python Bindings Review Comment: nit: # Apache Fluss™ Python Bindings ########## bindings/python/README.md: ########## @@ -0,0 +1,147 @@ +<!-- + ~ Licensed to the Apache Software Foundation (ASF) under one + ~ or more contributor license agreements. See the NOTICE file + ~ distributed with this work for additional information + ~ regarding copyright ownership. The ASF licenses this file + ~ to you under the Apache License, Version 2.0 (the + ~ "License"); you may not use this file except in compliance + ~ with the License. You may obtain a copy of the License at + ~ + ~ http://www.apache.org/licenses/LICENSE-2.0 + ~ + ~ Unless required by applicable law or agreed to in writing, + ~ software distributed under the License is distributed on an + ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + ~ KIND, either express or implied. See the License for the + ~ specific language governing permissions and limitations + ~ under the License. +--> + +# Fluss Python Bindings + +Python bindings for Fluss using PyO3 and Maturin. + +## System Requirements + +- Python 3.9+ +- Rust 1.70+ +- uv package manager Review Comment: add a link for uv package manager? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
