This is an automated email from the ASF dual-hosted git repository. colinlee pushed a commit to branch rc_release_2.2.0 in repository https://gitbox.apache.org/repos/asf/tsfile.git
commit 20411874b020b26f0b676532d93babdb3a04762b Author: shuolin_l <[email protected]> AuthorDate: Thu Nov 6 15:13:12 2025 +0800 bump version . --- cpp/pom.xml | 23 +----- pom.xml | 15 ++-- python/pom.xml | 38 ++------- python/pyproject.toml | 69 ++++++++++++++++ python/setup.py | 221 ++++++++++++++++++++++---------------------------- 5 files changed, 180 insertions(+), 186 deletions(-) diff --git a/cpp/pom.xml b/cpp/pom.xml index 3ea67e7a..390a0b87 100644 --- a/cpp/pom.xml +++ b/cpp/pom.xml @@ -22,7 +22,7 @@ <parent> <groupId>org.apache.tsfile</groupId> <artifactId>tsfile-parent</artifactId> - <version>2.2.0</version> + <version>2.1.4</version> </parent> <artifactId>tsfile-cpp</artifactId> <packaging>pom</packaging> @@ -34,12 +34,6 @@ <coverage.enabled>OFF</coverage.enabled> <build.type>Release</build.type> <enable.asan>OFF</enable.asan> - <build.test>ON</build.test> - <enable.snappy>ON</enable.snappy> - <enable.lz4>ON</enable.lz4> - <enable.lzokay>ON</enable.lzokay> - <enable.zlib>ON</enable.zlib> - <enable.antlr4>ON</enable.antlr4> </properties> <build> <sourceDirectory>${project.basedir}</sourceDirectory> @@ -80,12 +74,6 @@ <option>-DCOV_ENABLED=${coverage.enabled}</option> <option>-DCMAKE_BUILD_TYPE=${build.type}</option> <option>-DENABLE_ASAN=${enable.asan}</option> - <option>-DBUILD_TEST=${build.test}</option> - <option>-DENABLE_ANTLR4=${enable.antlr4}</option> - <option>-DENABLE_SNAPPY=${enable.snappy}</option> - <option>-DENABLE_LZ4=${enable.lz4}</option> - <option>-DENABLE_LZOKAY=${enable.lzokay}</option> - <option>-DENABLE_ZLIB=${enable.zlib}</option> </options> <sourcePath/> <targetPath/> @@ -163,15 +151,6 @@ </plugins> </build> <profiles> - <profile> - <id>linux-install-uuid-dev</id> - <activation> - <os> - <family>unix</family> - <name>Linux</name> - </os> - </activation> - </profile> <!-- When running on jenkins, download the sonar build-wrapper, so we can do a code analysis --> <profile> <id>jenkins-build</id> diff --git a/pom.xml b/pom.xml index 01d4902a..208c5755 100644 --- a/pom.xml +++ b/pom.xml @@ -28,7 +28,7 @@ </parent> <groupId>org.apache.tsfile</groupId> <artifactId>tsfile-parent</artifactId> - <version>2.2.0</version> + <version>2.1.4</version> <packaging>pom</packaging> <name>Apache TsFile Project Parent POM</name> <properties> @@ -135,6 +135,10 @@ <exclude>**/tsfile.egg-info/**</exclude> <!-- Exclude third_party--> <exclude>**/third_party/**</exclude> + <exclude>**/.python-version</exclude> + <exclude>**/**venv-py**/**</exclude> + <exclude>**/.python-version</exclude> + <exclude>python/.python-version</exclude> </excludes> </configuration> </plugin> @@ -445,6 +449,8 @@ <indentSize>4</indentSize> <excludes> <exclude>**/target/**</exclude> + <exclude>python/.python-version</exclude> + <exclude>**/.python-version</exclude> </excludes> </configuration> </execution> @@ -562,7 +568,7 @@ <connection>scm:git:ssh://[email protected]/apache/tsfile.git</connection> <developerConnection>scm:git:ssh://[email protected]/apache/tsfile.git</developerConnection> <url>ssh://[email protected]:apache/tsfile.git</url> - <tag>v2.2.0</tag> + <tag>HEAD</tag> </scm> <issueManagement> <system>GitHub Issues</system> @@ -587,7 +593,6 @@ <profile> <id>with-python</id> <modules> - <module>cpp</module> <module>python</module> </modules> </profile> @@ -751,8 +756,8 @@ <os.suffix>win</os.suffix> <os.classifier>windows-amd64</os.classifier> <cmake.generator>MinGW Makefiles</cmake.generator> - <python.venv.bin>venv/Scripts/</python.venv.bin> - <python.exe.bin>python</python.exe.bin> + <python.venv.bin/> + <python.exe.bin>python.exe</python.exe.bin> </properties> </profile> <!-- profile for windows aarch64 (mainly VM on newer Mac) (Self-Enabling) --> diff --git a/python/pom.xml b/python/pom.xml index a5eb9706..59907c25 100644 --- a/python/pom.xml +++ b/python/pom.xml @@ -41,21 +41,6 @@ <artifactId>exec-maven-plugin</artifactId> <executions> <!-- Create python virtual environment --> - <execution> - <id>python-venv</id> - <phase>initialize</phase> - <goals> - <goal>exec</goal> - </goals> - <configuration> - <executable>${python.exe.bin}</executable> - <arguments> - <argument>-m</argument> - <argument>venv</argument> - <argument>${project.basedir}/venv</argument> - </arguments> - </configuration> - </execution> <execution> <id>python-upgrade-pip</id> <phase>initialize</phase> @@ -63,7 +48,7 @@ <goal>exec</goal> </goals> <configuration> - <executable>${python.venv.bin}${python.exe.bin}</executable> + <executable>${python.exe.bin}</executable> <arguments> <argument>-m</argument> <argument>pip</argument> @@ -80,7 +65,7 @@ <goal>exec</goal> </goals> <configuration> - <executable>${python.venv.bin}${python.exe.bin}</executable> + <executable>${python.exe.bin}</executable> <arguments> <argument>-m</argument> <argument>pip</argument> @@ -97,7 +82,7 @@ <goal>exec</goal> </goals> <configuration> - <executable>${python.venv.bin}${python.exe.bin}</executable> + <executable>${python.exe.bin}</executable> <arguments> <argument>setup.py</argument> <argument>build_ext</argument> @@ -112,7 +97,7 @@ <goal>exec</goal> </goals> <configuration> - <executable>${python.venv.bin}${python.exe.bin}</executable> + <executable>${python.exe.bin}</executable> <arguments> <argument>-m</argument> <argument>pip</argument> @@ -121,19 +106,6 @@ </arguments> </configuration> </execution> - <execution> - <id>run-python-tests</id> - <phase>test</phase> - <goals> - <goal>exec</goal> - </goals> - <configuration> - <executable>${python.venv.bin}pytest</executable> - <arguments> - <argument>${project.basedir}/tests</argument> - </arguments> - </configuration> - </execution> <execution> <id>build-whl</id> <phase>package</phase> @@ -141,7 +113,7 @@ <goal>exec</goal> </goals> <configuration> - <executable>${python.venv.bin}${python.exe.bin}</executable> + <executable>${python.exe.bin}</executable> <arguments> <argument>setup.py</argument> <argument>bdist_wheel</argument> diff --git a/python/pyproject.toml b/python/pyproject.toml new file mode 100644 index 00000000..09a80bdd --- /dev/null +++ b/python/pyproject.toml @@ -0,0 +1,69 @@ +# 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 = [ + "setuptools>=69", + "wheel", + "Cython>=3", + "numpy>=1.20" + ] + +build-backend = "setuptools.build_meta" + +[project] +name = "tsfile" +version = "2.1.4" +requires-python = ">=3.9" +description = "TsFile Python" +readme = {file = "README.md", content-type = "text/markdown"} +maintainers = [ + {name = "Apache TsFile Developers", email = "[email protected]"} +] +dependencies = [ + "numpy>=1.20", + "pandas>=2.0" +] + +[project.urls] +Homepage = "https://tsfile.apache.org/" +Documentation = "https://tsfile.apache.org/zh/UserGuide/latest/QuickStart/Navigating_Time_Series_Data.html" +Repository = "https://github.com/apache/tsfile" +Issues = "https://github.com/apache/tsfile/issues" + +[tool.setuptools] +package-dir = {"" = "."} + +[tool.setuptools.packages.find] +where = ["."] +include = ["tsfile*"] + +[tool.setuptools.package-data] +tsfile = [ + "*.pxd", + "*.pxi", + "*.so", + "*.so.*", + "*.dylib", + "*.dylib.*", + "*.dll", + "*.dll.a", + "*.lib", + "*.lib.a", + "include/**/*" +] diff --git a/python/setup.py b/python/setup.py index 6e77474f..f7b1f9bd 100644 --- a/python/setup.py +++ b/python/setup.py @@ -19,151 +19,120 @@ 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 -version = "2.2.0" -system = platform.system() - - -def copy_tsfile_lib(source_dir, target_dir, suffix): - lib_file_name = f"libtsfile.{suffix}" - source = os.path.join(source_dir, lib_file_name) - target = os.path.join(target_dir, lib_file_name) - - if os.path.exists(source): - shutil.copyfile(source, target) - - if system == "Linux": - link_name = os.path.join(target_dir, "libtsfile.so") - if os.path.exists(link_name): - os.remove(link_name) - os.symlink(lib_file_name, link_name) - elif system == "Darwin": - link_name = os.path.join(target_dir, "libtsfile.dylib") - if os.path.exists(link_name): - os.remove(link_name) - os.symlink(lib_file_name, link_name) - - -project_dir = os.path.dirname(os.path.abspath(__file__)) -tsfile_py_include = os.path.join(project_dir, "tsfile", "include") - -if os.path.exists(tsfile_py_include): - shutil.rmtree(tsfile_py_include) - -shutil.copytree( - os.path.join(project_dir, "..", "cpp", "target", "build", "include"), - os.path.join(tsfile_py_include, ""), -) - - -def copy_tsfile_header(source): - for file in source: - if os.path.exists(file): - target = os.path.join(tsfile_py_include, os.path.basename(file)) - shutil.copyfile(file, target) +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.0.dev" +system = platform.system() -## Copy C wrapper header. -# tsfile/cpp/src/cwrapper/tsfile_cwrapper.h -source_headers = [ - os.path.join(project_dir, "..", "cpp", "src", "cwrapper", "tsfile_cwrapper.h"), -] - -copy_tsfile_header(source_headers) - -## Copy shared library -tsfile_shared_source_dir = os.path.join(project_dir, "..", "cpp", "target", "build", "lib") -tsfile_shared_dir = os.path.join(project_dir, "tsfile") - -if system == "Darwin": - copy_tsfile_lib(tsfile_shared_source_dir, tsfile_shared_dir, version + ".dylib") -elif system == "Linux": - copy_tsfile_lib(tsfile_shared_source_dir, tsfile_shared_dir, "so." + version) +(PKG / "include").mkdir(exist_ok=True) +if (PKG / "include").exists() and CPP_INC.exists(): + shutil.rmtree(PKG / "include") + shutil.copytree(CPP_INC, PKG / "include") +if sys.platform.startswith("linux"): + candidates = sorted(CPP_LIB.glob("libtsfile.so*"), key=lambda p: len(p.name), reverse=True) + if not candidates: + raise FileNotFoundError("missing libtsfile.so* in build output") + src = candidates[0] + dst = PKG / src.name + shutil.copy2(src, dst) + link_name = PKG / "libtsfile.so" + shutil.copy2(src, link_name) + +elif sys.platform == "darwin": + candidates = sorted(CPP_LIB.glob("libtsfile.*.dylib")) or list(CPP_LIB.glob("libtsfile.dylib")) + if not candidates: + raise FileNotFoundError("missing libtsfile*.dylib in build output") + src = candidates[0] + dst = PKG / src.name + shutil.copy2(src, dst) + link_name = PKG / "libtsfile.dylib" + shutil.copy2(src, link_name) +elif sys.platform == "win32": + for base_name in ("libtsfile",): + dll_candidates = sorted(CPP_LIB.glob(f"{base_name}*.dll"), key=lambda p: len(p.name), reverse=True) + dll_a_candidates = sorted(CPP_LIB.glob(f"{base_name}*.dll.a"), key=lambda p: len(p.name), reverse=True) + + if not dll_candidates: + raise FileNotFoundError(f"missing {base_name}*.dll in build output") + if not dll_a_candidates: + raise FileNotFoundError(f"missing {base_name}*.dll.a in build output") + + dll_src = dll_candidates[0] + dll_a_src = dll_a_candidates[0] + + shutil.copy2(dll_src, PKG / f"{base_name}.dll") + shutil.copy2(dll_a_src, PKG / f"{base_name}.dll.a") else: - copy_tsfile_lib(tsfile_shared_source_dir, tsfile_shared_dir, "dll") - -tsfile_include_dir = os.path.join(project_dir, "tsfile", "include") - -ext_modules_tsfile = [ - # utils: from python to c or c to python. - Extension( - "tsfile.tsfile_py_cpp", - sources=[os.path.join("tsfile", "tsfile_py_cpp.pyx")], - libraries=["tsfile"], - library_dirs=[tsfile_shared_dir], - include_dirs=[tsfile_include_dir, np.get_include()], - runtime_library_dirs=[tsfile_shared_dir] if system != "Windows" else None, - extra_compile_args=( - ["-std=c++11"] if system != "Windows" else ["-std=c++11", "-DMS_WIN64"] - ), - language="c++", - ), - # query data and describe schema: tsfile reader module - Extension( - "tsfile.tsfile_reader", - sources=[os.path.join("tsfile", "tsfile_reader.pyx")], - libraries=["tsfile"], - library_dirs=[tsfile_shared_dir], - depends=[os.path.join("tsfile", "tsfile_py_cpp.pxd")], - include_dirs=[tsfile_include_dir, np.get_include()], - runtime_library_dirs=[tsfile_shared_dir] if system != "Windows" else None, - extra_compile_args=( - ["-std=c++11"] if system != "Windows" else ["-std=c++11", "-DMS_WIN64"] - ), - language="c++", - ), - # write data and register schema: tsfile writer module - Extension( - "tsfile.tsfile_writer", - sources=[os.path.join("tsfile", "tsfile_writer.pyx")], - libraries=["tsfile"], - library_dirs=[tsfile_shared_dir], - depends=[os.path.join("tsfile", "tsfile_py_cpp.pxd")], - include_dirs=[tsfile_include_dir, np.get_include()], - runtime_library_dirs=[tsfile_shared_dir] if system != "Windows" else None, - extra_compile_args=( - ["-std=c++11"] if system != "Windows" else ["-std=c++11", "-DMS_WIN64"] - ), - language="c++", - ) -] + raise RuntimeError(f"Unsupported platform: {sys.platform}") class BuildExt(build_ext): - def build_extensions(self): - numpy_include = np.get_include() - for ext in self.extensions: - ext.include_dirs.append(numpy_include) - super().build_extensions() + def run(self): + super().run() def finalize_options(self): - if system == "Windows": + if sys.platform == "win32": self.compiler = "mingw32" super().finalize_options() +extra_compile_args = [] +extra_link_args = [] +runtime_library_dirs = [] +libraries = [] +library_dirs = [str(PKG)] +include_dirs = [str(PKG), np.get_include(), str(PKG / "include")] + +if sys.platform.startswith("linux"): + libraries = ["tsfile"] + extra_compile_args += ["-O3", "-std=c++11", "-fvisibility=hidden", "-fPIC"] + runtime_library_dirs = ["$ORIGIN"] + extra_link_args += ["-Wl,-rpath,$ORIGIN"] +elif sys.platform == "darwin": + libraries = ["tsfile"] + 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"] + extra_compile_args += ["-O2", "-std=c++11", "-DSIZEOF_VOID_P=8", "-D__USE_MINGW_ANSI_STDIO=1", "-DMS_WIN64", + "-D_WIN64"] +else: + raise RuntimeError(f"Unsupported platform: {sys.platform}") + +common = dict( + language="c++", + include_dirs=include_dirs, + library_dirs=library_dirs, + libraries=libraries, + extra_compile_args=extra_compile_args, + extra_link_args=extra_link_args, + runtime_library_dirs=runtime_library_dirs, +) + +exts = [ + Extension("tsfile.tsfile_py_cpp", ["tsfile/tsfile_py_cpp.pyx"], **common), + Extension("tsfile.tsfile_reader", ["tsfile/tsfile_reader.pyx"], **common), + Extension("tsfile.tsfile_writer", ["tsfile/tsfile_writer.pyx"], **common), +] + setup( name="tsfile", - version=version, - description="Tsfile reader and writer for python", - url="https://tsfile.apache.org", - author='"Apache TsFile"', + version="2.1.0", packages=["tsfile"], - license="Apache 2.0", - ext_modules=cythonize(ext_modules_tsfile), - cmdclass={"build_ext": BuildExt}, - include_dirs=[np.get_include()], - package_dir={"tsfile": "./tsfile"}, - package_data={ - "tsfile": [ - "libtsfile.*", - "*.pxd" - ] - }, + package_dir={"": "."}, include_package_data=True, + ext_modules=cythonize(exts, compiler_directives={"language_level": 3}), + cmdclass={"build_ext": BuildExt}, )
