Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #743 +/- ##
===========================================
- Coverage 62.25% 62.15% -0.10%
===========================================
Files 702 702
Lines 40598 40680 +82
Branches 5763 5780 +17
===========================================
+ Hits 25273 25286 +13
- Misses 14544 14613 +69
Partials 781 781 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
0ef6c88 to
e8fe520
Compare
There was a problem hiding this comment.
Pull request overview
This PR updates the Python packaging/build setup to support producing distributable wheels (including Windows), aligns Cython header includes with the C++ exported include layout, and adds CI workflows to build wheels across platforms.
Changes:
- Reworked
python/setup.pyto package C++ headers/libs fromcpp/target/buildand to support Windows wheel builds (including DLL preloading support). - Added
python/pyproject.toml(PEP 517/518) and updated version-sync logic to keep it aligned with Maven. - Added a multi-platform wheel build workflow and adjusted existing CI to install uuid system deps where needed.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| python/tsfile/tsfile_cpp.pxd | Switches Cython extern from includes to match exported include tree (cwrapper/..., common/...). |
| python/tsfile/init.py | Updates Windows DLL loading strategy using os.add_dll_directory + absolute-path preload. |
| python/setup.py | Refactors build to copy headers/libs from cpp/target/build, set rpaths, and handle Windows artifacts. |
| python/requirements.txt | Updates NumPy constraint to >=2,<3. |
| python/pyproject.toml | Introduces PEP 621/517 metadata and package-data configuration for wheels. |
| python/VersionUpdater.groovy | Extends version sync to also update pyproject.toml. |
| pom.xml | Adds RAT/formatter excludes and alters Windows Python execution properties. |
| cpp/third_party/zlib-1.3.1/zlib-1.3.1/treebuild.xml | Removes unused third-party build metadata file. |
| cpp/third_party/zlib-1.3.1/treebuild.xml | Removes unused third-party build metadata file. |
| cpp/pom.xml | Removes the linux-install-uuid-dev profile. |
| cpp/CMakeLists.txt | Removes a BOM/encoding artifact at the file start. |
| .gitignore | Updates ignores related to bundled zlib. |
| .github/workflows/wheels.yml | Adds CI workflow to build wheels for Linux/macOS and a Windows wheel pipeline. |
| .github/workflows/unit-test-python.yml | Adds Python setup + extra dependency installation. |
| .github/workflows/unit-test-cpp.yml | Adds conditional uuid install logic on Linux. |
Comments suppressed due to low confidence (1)
.github/workflows/unit-test-cpp.yml:122
- This Linux dependency logic is internally inconsistent: even if the
yumbranch runs, the script still unconditionally executesapt-getlater in the same block. That defeats the intent of addingyumsupport and would fail on a yum-based Linux runner. Either fully gate theapt-getcommands behind theapt-getcheck, or factor theuuidinstall andclang-formatsetup so only the correct package manager is used.
if [[ "$RUNNER_OS" == "Linux" ]]; then
if command -v apt-get >/dev/null 2>&1; then
sudo apt-get update
sudo apt-get install -y uuid-dev
elif command -v yum >/dev/null 2>&1; then
sudo yum install -y libuuid-devel
fi
sudo update-alternatives --install /usr/bin/clang-format clang-format /usr/bin/clang-format-17 100
sudo update-alternatives --set clang-format /usr/bin/clang-format-17
sudo apt-get update
sudo apt-get install -y uuid-dev
elif [[ "$RUNNER_OS" == "Windows" ]]; then
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
pom.xml
Outdated
| <exclude>**/**venv-py**/**</exclude> | ||
| <exclude>**/.python-version</exclude> | ||
| <exclude>python/.python-version</exclude> |
pom.xml
Outdated
| <cmake.generator>MinGW Makefiles</cmake.generator> | ||
| <python.venv.bin>venv/Scripts/</python.venv.bin> | ||
| <python.exe.bin>python</python.exe.bin> | ||
| <python.venv.bin/> |
| - name: Install dependencies | ||
| shell: bash | ||
| run: | | ||
| if [[ "$RUNNER_OS" == "Linux" ]]; then | ||
| if command -v apt-get >/dev/null 2>&1; then | ||
| sudo apt-get update | ||
| sudo apt-get install -y uuid-dev | ||
| elif command -v yum >/dev/null 2>&1; then | ||
| sudo yum install -y libuuid-devel | ||
| fi | ||
| fi |
python/tsfile/__init__.py
Outdated
| @@ -19,9 +19,16 @@ | |||
| import ctypes | |||
| import os | |||
| import platform | |||
python/setup.py
Outdated
| (PKG / "include").mkdir(exist_ok=True) | ||
| if (PKG / "include").exists() and CPP_INC.exists(): | ||
| shutil.rmtree(PKG / "include") | ||
| shutil.copytree(CPP_INC, PKG / "include") |
python/setup.py
Outdated
| extra_compile_args += ["-O3", "-std=c++11", "-fvisibility=hidden", "-fPIC"] | ||
| extra_link_args += ["-Wl,-rpath,@loader_path", "-stdlib=libc++"] | ||
| elif sys.platform == "win32": | ||
| libraries = ["Tsfile"] |
| import os | ||
| import platform | ||
| import shutil | ||
|
|
||
| import sys | ||
| import numpy as np | ||
|
|
||
| from pathlib import Path | ||
| from Cython.Build import cythonize | ||
| from setuptools import setup, Extension | ||
| from setuptools.command.build_ext import build_ext | ||
|
|
||
| ROOT = Path(__file__).parent.resolve() | ||
| PKG = ROOT / "tsfile" | ||
| CPP_OUT = ROOT / ".." / "cpp" / "target" / "build" | ||
| CPP_LIB = CPP_OUT / "lib" | ||
| CPP_INC = CPP_OUT / "include" | ||
|
|
||
| version = "2.2.1.dev" | ||
| system = platform.system() | ||
|
|
|
I don't have additional comments. LGTM. |
| - name: Install dependencies | ||
| shell: bash | ||
| run: | | ||
| if [[ "$RUNNER_OS" == "Linux" ]]; then | ||
| if command -v apt-get >/dev/null 2>&1; then | ||
| sudo apt-get update | ||
| sudo apt-get install -y uuid-dev | ||
| elif command -v yum >/dev/null 2>&1; then | ||
| sudo yum install -y libuuid-devel | ||
| fi | ||
| fi |
There was a problem hiding this comment.
Pull request overview
This PR updates the Python packaging/build configuration to support releasing prebuilt wheels across Linux/macOS/Windows CI, while aligning Python’s build inputs with the C++ build outputs and removing UUID installation wiring from the C++ Maven profile.
Changes:
- Reworked
python/setup.pyand addedpython/pyproject.tomlto support modern wheel builds (including Windows/MinGW artifacts handling). - Added a multi-platform GitHub Actions workflow to build and validate wheels, plus small CI adjustments for Python/C++ unit test jobs.
- Adjusted Cython header include paths to match exported C++ include layout and updated Python dependency constraints.
Reviewed changes
Copilot reviewed 14 out of 15 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| python/tsfile/tsfile_cpp.pxd | Update Cython extern header paths to match exported include tree (cpp/target/build/include/...). |
| python/tsfile/init.py | Change Windows DLL loading strategy to use add_dll_directory + preloading. |
| python/setup.py | Rework packaging build to copy exported C++ headers/libs into the Python package and build extensions per-platform. |
| python/requirements.txt | Update numpy constraint to >=2,<3. |
| python/pyproject.toml | Add PEP 517/621 build + project metadata and package-data inclusion rules for native libs/headers. |
| python/VersionUpdater.groovy | Extend version synchronization to also update pyproject.toml. |
| pom.xml | Add excludes for .python-version and venv-like paths in license/style tooling. |
| cpp/third_party/zlib-1.3.1/zlib-1.3.1/treebuild.xml | Remove obsolete third-party build metadata file. |
| cpp/third_party/zlib-1.3.1/treebuild.xml | Remove obsolete third-party build metadata file. |
| cpp/pom.xml | Remove the Linux UUID install profile. |
| cpp/CMakeLists.txt | Remove/normalize stray BOM at file start. |
| .gitignore | Update ignore patterns related to zlib third-party content. |
| .github/workflows/wheels.yml | Add CI workflow to build/verify wheels across platforms (including Windows split build). |
| .github/workflows/unit-test-python.yml | Ensure Python is set up in the Python unit test workflow. |
| .github/workflows/unit-test-cpp.yml | Add UUID dev package installation for Linux runners. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| if sys.platform == "win32": | ||
| _pkg_dir = os.path.dirname(os.path.abspath(__file__)) | ||
| os.add_dll_directory(_pkg_dir) | ||
| # Preload libtsfile.dll with absolute path to bypass DLL search issues. | ||
| # This ensures it's already in memory when .pyd extensions reference it. | ||
| _tsfile_dll = os.path.join(_pkg_dir, "libtsfile.dll") | ||
| if os.path.isfile(_tsfile_dll): | ||
| ctypes.CDLL(_tsfile_dll) |
| if [[ "$RUNNER_OS" == "Linux" ]]; then | ||
| if command -v apt-get >/dev/null 2>&1; then | ||
| sudo apt-get update | ||
| sudo apt-get install -y uuid-dev | ||
| elif command -v yum >/dev/null 2>&1; then | ||
| sudo yum install -y libuuid-devel | ||
| fi |
| @@ -19,151 +19,134 @@ | |||
| import os | |||
| import platform | |||
| <!-- Exclude third_party--> | ||
| <exclude>**/third_party/**</exclude> | ||
| <exclude>**/.python-version</exclude> | ||
| <exclude>**/**venv-py**/**</exclude> |
* support release python by ci. * fix format. * fix comment.

I refined setup.py in this pr and enabled compiling wheels for win-py on ci.
For detailed action workflow: https://github.com/ColinLeeo/tsfile/actions/runs/23084354062.
UUID installation is removed from pom.xml.