This is an automated email from the ASF dual-hosted git repository.

dockerzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/inlong.git


The following commit(s) were added to refs/heads/master by this push:
     new 5a731c9b5b [INLONG-12090][SDK] Build standard Python Dataproxy SDK 
wheels based on PEP-517 (#12091)
5a731c9b5b is described below

commit 5a731c9b5baeb663b849425e8d3fb1d686c9ebf1
Author: hzqmwne <[email protected]>
AuthorDate: Thu Mar 5 22:57:01 2026 +0800

    [INLONG-12090][SDK] Build standard Python Dataproxy SDK wheels based on 
PEP-517 (#12091)
---
 .../dataproxy-sdk-docker/Dockerfile_python         | 53 +++++++++++++++
 .../dataproxy-sdk-docker/README.md                 |  7 ++
 .../dataproxy-sdk-python/CMakeLists.txt            | 15 +++-
 .../dataproxy-sdk-python/README.md                 | 17 +++++
 .../dataproxy-sdk-python/inlong_dataproxy.pyi      | 37 ++++++++++
 .../dataproxy-sdk-python/pyproject.toml            | 79 ++++++++++++++++++++++
 6 files changed, 207 insertions(+), 1 deletion(-)

diff --git 
a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-docker/Dockerfile_python 
b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-docker/Dockerfile_python
new file mode 100644
index 0000000000..5f72c09185
--- /dev/null
+++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-docker/Dockerfile_python
@@ -0,0 +1,53 @@
+#
+# 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.
+#
+
+FROM quay.io/pypa/manylinux2014_x86_64:latest
+
+ENV CMAKE_POLICY_VERSION_MINIMUM=3.5
+
+# build cpp sdk
+
+COPY dataproxy-sdk-cpp 
/workspace/inlong/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp
+WORKDIR /workspace/inlong/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-cpp
+
+RUN ./build_third_party.sh
+RUN ./build.sh
+
+# prepare python sdk source tree
+
+COPY dataproxy-sdk-python 
/workspace/inlong/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-python
+WORKDIR /workspace/inlong/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-python
+
+RUN cp -r ../dataproxy-sdk-cpp ./
+
+# build python sdk wheels using PEP-517
+
+RUN /opt/python/cp38-cp38/bin/python3 -m build --sdist
+
+RUN /opt/python/cp38-cp38/bin/python3 -m pip wheel --no-deps --wheel-dir dist 
dist/*.tar.gz
+RUN /opt/python/cp39-cp39/bin/python3 -m pip wheel --no-deps --wheel-dir dist 
dist/*.tar.gz
+RUN /opt/python/cp310-cp310/bin/python3 -m pip wheel --no-deps --wheel-dir 
dist dist/*.tar.gz
+RUN /opt/python/cp311-cp311/bin/python3 -m pip wheel --no-deps --wheel-dir 
dist dist/*.tar.gz
+RUN /opt/python/cp312-cp312/bin/python3 -m pip wheel --no-deps --wheel-dir 
dist dist/*.tar.gz
+RUN /opt/python/cp313-cp313/bin/python3 -m pip wheel --no-deps --wheel-dir 
dist dist/*.tar.gz
+RUN /opt/python/cp314-cp314/bin/python3 -m pip wheel --no-deps --wheel-dir 
dist dist/*.tar.gz
+
+RUN auditwheel repair dist/*.whl
+
+# now target sdist is in dist/, and target wheels are in wheelhouse/. ignore 
wheels in dist/.
diff --git a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-docker/README.md 
b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-docker/README.md
index b7569c405d..3968dfb008 100644
--- a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-docker/README.md
+++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-docker/README.md
@@ -62,3 +62,10 @@ docker build -t inlong/dataproxy-sdk-build:latest .
 ```bash
 docker build --build-arg PYTHON_VERSION=3.9.18 -t 
inlong/dataproxy-sdk-build:py39 .
 ```
+
+### Build Python SDK wheels
+
+```bash
+cd inlong-sdk/dataproxy-sdk-twins
+docker build -f dataproxy-sdk-docker/Dockerfile_python .
+```
diff --git a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-python/CMakeLists.txt 
b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-python/CMakeLists.txt
index b7060bd210..0ef3ffde14 100644
--- a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-python/CMakeLists.txt
+++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-python/CMakeLists.txt
@@ -30,7 +30,13 @@ 
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/dataproxy-sdk-cpp/third_party/l
 
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/dataproxy-sdk-cpp/third_party/lib64")
 
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/dataproxy-sdk-cpp/release/lib")
 
-add_subdirectory(pybind11)
+# Prefer local pybind11/ if present for legacy build; otherwise use pybind11 
from PyPI via PEP-517.
+if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/pybind11/CMakeLists.txt")
+    add_subdirectory(pybind11)
+else ()
+    set(PYBIND11_FINDPYTHON ON)
+    find_package(pybind11 CONFIG REQUIRED)
+endif ()
 
 
link_directories("${CMAKE_CURRENT_SOURCE_DIR}/dataproxy-sdk-cpp/third_party/lib")
 
link_directories("${CMAKE_CURRENT_SOURCE_DIR}/dataproxy-sdk-cpp/third_party/lib64")
@@ -39,3 +45,10 @@ 
link_directories("${CMAKE_CURRENT_SOURCE_DIR}/dataproxy-sdk-cpp/release/lib")
 pybind11_add_module(inlong_dataproxy inlong_dataproxy.cpp)
 
 target_link_libraries(inlong_dataproxy PRIVATE 
"${CMAKE_CURRENT_SOURCE_DIR}/dataproxy-sdk-cpp/release/lib/dataproxy_sdk.a" 
liblog4cplusS.a libsnappy.a libcurl.a libssl.a libcrypto.a)
+
+# For scikit-build wheels: install into the Python platlib directory, include 
target so and other required files like pyi.
+# It is good that cmake removes rpath in so during install.
+if (DEFINED SKBUILD_PLATLIB_DIR)
+    install(TARGETS inlong_dataproxy LIBRARY DESTINATION 
"${SKBUILD_PLATLIB_DIR}")
+    install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/inlong_dataproxy.pyi" 
DESTINATION "${SKBUILD_PLATLIB_DIR}")
+endif ()
diff --git a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-python/README.md 
b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-python/README.md
index 9d5285077e..3a6043e88c 100644
--- a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-python/README.md
+++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-python/README.md
@@ -86,6 +86,23 @@ After the build process finished, you can import the package 
(`import inlong_dat
 
 > **Note**: When the C++ SDK or the version of Python you're using is updated, 
 > you'll need to rebuild it using either of the above methods (Native Build or 
 > Docker Build).
 
+### Method 3: PEP 517 Build
+
+1. Build the C++ SDK. see 
[dataproxy-sdk-cpp/README.md](../dataproxy-sdk-cpp/README.md)  
+
+2. Copy `dataproxy-sdk-cpp` dir into `dataproxy-sdk-python`  
+   ```bash
+   cp -r ../dataproxy-sdk-cpp ./
+   ```
+
+3. Go to the `dataproxy-sdk-python` directory, build the Python SDK  
+   ```bash
+   python3 -m pip install build
+   python3 -m build
+   ```
+
+Also, you can refer 
[dataproxy-sdk-docker/README.md](../dataproxy-sdk-docker/README.md) to build 
python sdk wheels for manylinux.  
+
 ## Config Parameters
 
 Refer to `demo/config_example.json`.
diff --git 
a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-python/inlong_dataproxy.pyi 
b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-python/inlong_dataproxy.pyi
new file mode 100644
index 0000000000..5a77e8ba81
--- /dev/null
+++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-python/inlong_dataproxy.pyi
@@ -0,0 +1,37 @@
+#
+# 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.
+#
+
+from collections.abc import Callable
+from typing import Optional
+
+UserCallBack = Callable[[str, str, str, int, int, str], int]
+# e.g. def callback_func(inlong_group_id: str, inlong_stream_id: str, msg: 
str, msg_len: int, report_time: int, ip: str) -> int:
+
+class InLongApi:
+    def __init__(self) -> None: ...
+    def init_api(self, config_path: str) -> int: ...
+    def send(
+        self,
+        groupId: str,
+        streamId: str,
+        msg: str,
+        msgLen: int,
+        pyCallback: Optional[UserCallBack] = ...,  # None means no callback
+    ) -> int: ...
+    def close_api(self, timeout_ms: int) -> int: ...
diff --git a/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-python/pyproject.toml 
b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-python/pyproject.toml
new file mode 100644
index 0000000000..b2edf1cf8f
--- /dev/null
+++ b/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-python/pyproject.toml
@@ -0,0 +1,79 @@
+#
+# 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 = [
+  "scikit-build-core>=0.12", "pybind11",
+]
+build-backend = "scikit_build_core.build"
+
+[project]
+name = "inlong-dataproxy-sdk"
+version = "2.3.0"
+description = "Python bindings for Apache InLong DataProxy SDK"
+readme = "README.md"
+requires-python = ">=3.8"
+license = { text = "Apache-2.0" }
+authors = [
+  { name = "Apache InLong" },
+]
+classifiers = [
+  "License :: OSI Approved :: Apache Software License",
+  "Programming Language :: Python :: 3",
+  "Programming Language :: C++",
+  "Operating System :: POSIX :: Linux",
+]
+
+[project.urls]
+Homepage = "https://github.com/apache/inlong";
+Source = 
"https://github.com/apache/inlong/tree/master/inlong-sdk/dataproxy-sdk-twins/dataproxy-sdk-python";
+
+[tool.scikit-build]
+minimum-version = "0.12"
+
+# Do NOT run CMake when building sdist.
+sdist.cmake = false
+
+# Make sdist minimal via a strict allowlist.
+
+sdist.inclusion-mode = "manual"
+
+# First exclude all files
+sdist.exclude = [
+  "**/*",
+]
+
+# Then only include necessary files
+# NOTICE: sdist.include always takes precedence over sdist.exclude
+sdist.include = [
+  # --- Python binding sources/build config ---
+  "/pyproject.toml",
+  "/CMakeLists.txt",
+  "/inlong_dataproxy.cpp",
+  "/inlong_dataproxy.pyi",
+  "/README.md",
+
+  # Headers referenced by current CMake include_directories
+  "/dataproxy-sdk-cpp/src/core/*.h",
+
+  # Static libraries used by linking
+  "/dataproxy-sdk-cpp/release/lib/*.a",
+  "/dataproxy-sdk-cpp/third_party/lib/*.a",
+  "/dataproxy-sdk-cpp/third_party/lib64/*.a",
+]

Reply via email to