This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/tsfile.git
The following commit(s) were added to refs/heads/develop by this push:
new 6679b9ab Optimize CI and Fix Python < 3.12 on Windows cannot build the
python wrapper (#174)
6679b9ab is described below
commit 6679b9aba95131789c83b71c1110f245eae31142
Author: Haonan <[email protected]>
AuthorDate: Fri Jul 12 22:13:28 2024 +0800
Optimize CI and Fix Python < 3.12 on Windows cannot build the python
wrapper (#174)
---
.github/workflows/codeql.yml | 2 ++
.github/workflows/unit-test.yml | 16 ++++++----------
python/setup.py | 40 ++++++++++++----------------------------
python/test.py | 6 ------
python/tsfile/tsfile.py | 18 +++++++++---------
5 files changed, 29 insertions(+), 53 deletions(-)
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
index 0c968ef3..d0d3fc9c 100644
--- a/.github/workflows/codeql.yml
+++ b/.github/workflows/codeql.yml
@@ -14,6 +14,8 @@ name: "CodeQL"
on:
push:
branches: [ "develop" ]
+ paths-ignore:
+ - 'docs/**'
jobs:
analyze:
diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml
index a529989d..2192e465 100644
--- a/.github/workflows/unit-test.yml
+++ b/.github/workflows/unit-test.yml
@@ -7,11 +7,15 @@ on:
push:
branches:
- develop
- - 'rel/*'
+ - iotdb
+ paths-ignore:
+ - 'docs/**'
pull_request:
branches:
- develop
- - 'rel/*'
+ - iotdb
+ paths-ignore:
+ - 'docs/**'
# Enable manually starting builds, and allow forcing updating of SNAPSHOT
dependencies.
workflow_dispatch:
inputs:
@@ -73,14 +77,6 @@ jobs:
core.setOutput('platform_suffix', ``)
}
- # Use python 3.12 to avoid Cython files don't compile on Mingw-w64 64-bit
- # https://bugs.python.org/issue40167
- - name: Set up python 3.12 for windows
- if: ${{ matrix.os == 'windows-latest'}}
- uses: actions/setup-python@v5
- with:
- python-version: '3.12'
-
# Run the actual maven build including all unit- and integration-tests.
- name: Build and test with Maven (All others)
shell: bash
diff --git a/python/setup.py b/python/setup.py
index 3d57e55f..a356000c 100644
--- a/python/setup.py
+++ b/python/setup.py
@@ -64,7 +64,6 @@ elif platform.system() == "Linux":
copy_lib_files("Linux", libtsfile_shard_dir, libtsfile_dir, "so.1.0")
else:
copy_lib_files("Windows", libtsfile_shard_dir, libtsfile_dir, "dll")
- copy_lib_files("Windows", libtsfile_shard_dir, libtsfile_dir, "dll.a")
source_include_dir = os.path.join(
@@ -73,32 +72,18 @@ source_include_dir = os.path.join(
target_include_dir = os.path.join(project_dir, "tsfile", "TsFile-cwrapper.h")
copy_header(source_include_dir, target_include_dir)
-
-if platform.system() == "Windows":
- ext_modules_tsfile = [
- Extension(
- "tsfile.tsfile_pywrapper",
- sources=[source_file],
- libraries=["tsfile"],
- library_dirs=[libtsfile_dir],
- include_dirs=[include_dir, np.get_include()],
- extra_compile_args=["-std=c++11"],
- language="c++",
- )
- ]
-else:
- ext_modules_tsfile = [
- Extension(
- "tsfile.tsfile_pywrapper",
- sources=[source_file],
- libraries=["tsfile"],
- library_dirs=[libtsfile_dir],
- include_dirs=[include_dir, np.get_include()],
- runtime_library_dirs=[libtsfile_dir],
- extra_compile_args=["-std=c++11"],
- language="c++",
- )
- ]
+ext_modules_tsfile = [
+ Extension(
+ "tsfile.tsfile_pywrapper",
+ sources=[source_file],
+ libraries=["tsfile"],
+ library_dirs=[libtsfile_dir],
+ include_dirs=[include_dir, np.get_include()],
+ runtime_library_dirs=[libtsfile_dir] if platform.system() != "Windows"
else None,
+ extra_compile_args=["-std=c++11"] if platform.system() != "Windows"
else ["-std=c++11", "-DMS_WIN64"],
+ language="c++",
+ )
+]
setup(
name="tsfile",
@@ -117,7 +102,6 @@ setup(
os.path.join("*tsfile", "*.dylib"),
os.path.join("*tsfile", "*.pyd"),
os.path.join("*tsfile", "*.dll"),
- os.path.join("*tsfile", "*.dll.a"),
os.path.join("tsfile", "tsfile.py"),
]
},
diff --git a/python/test.py b/python/test.py
index 7b0786c1..e4838742 100644
--- a/python/test.py
+++ b/python/test.py
@@ -19,17 +19,11 @@
import os
import platform
import shutil
-import glob
import unittest as ut
import numpy as np
import pandas as pd
-if platform.system() == "Windows":
- extra_dll_dir = os.path.join(os.path.dirname(__file__), "tsfile")
- os.add_dll_directory(extra_dll_dir)
- print(extra_dll_dir)
- print(glob.glob(extra_dll_dir + "/*"))
import tsfile as ts
from tsfile.tsfile import EmptyFileError
diff --git a/python/tsfile/tsfile.py b/python/tsfile/tsfile.py
index 0edb1bd5..3e92f052 100644
--- a/python/tsfile/tsfile.py
+++ b/python/tsfile/tsfile.py
@@ -22,7 +22,7 @@ import ctypes
if platform.system() == "Windows":
ctypes.CDLL(os.path.join(os.path.dirname(__file__), "libtsfile.dll"),
winmode=0)
from .tsfile_pywrapper import tsfile_reader, tsfile_writer
-from typing import overload
+from typing import overload, Union
from pandas import DataFrame
TIMESTAMP_STR = "Time"
@@ -38,7 +38,7 @@ class EmptyFileError(Exception):
def read_tsfile(
file_path: str,
table_name: str,
- columns: list[str] | str,
+ columns: Union[list[str], str],
) -> DataFrame: ...
@@ -47,7 +47,7 @@ def read_tsfile(
def read_tsfile(
file_path: str,
table_name: str,
- columns: list[str] | str,
+ columns: Union[list[str], str],
filter: str,
start_time: int,
end_time: int,
@@ -59,7 +59,7 @@ def read_tsfile(
def read_tsfile(
file_path: str,
table_name: str,
- columns: list[str] | str,
+ columns: Union[list[str], str],
chunksize: int,
) -> DataFrame: ...
@@ -68,7 +68,7 @@ def read_tsfile(
def read_tsfile(
file_path: str,
table_name: str,
- columns: list[str] | str,
+ columns: Union[list[str], str],
filter: str,
start_time: int,
end_time: int,
@@ -81,7 +81,7 @@ def read_tsfile(
def read_tsfile(
file_path: str,
table_name: str,
- columns: list[str] | str,
+ columns: Union[list[str], str],
iterator: bool,
chunksize: int,
) -> tsfile_reader: ...
@@ -91,7 +91,7 @@ def read_tsfile(
def read_tsfile(
file_path: str,
table_name: str,
- columns: list[str] | str,
+ columns: Union[list[str], str],
start_time: int,
end_time: int,
iterator: bool,
@@ -102,12 +102,12 @@ def read_tsfile(
def read_tsfile(
file_path: str,
table_name: str,
- columns: list[str] | str,
+ columns: Union[list[str], str],
start_time: int = None,
end_time: int = None,
chunksize: int = None,
iterator: bool = False,
-) -> DataFrame | tsfile_reader:
+) -> Union[DataFrame, tsfile_reader]:
if not os.path.exists(file_path):
raise FileNotFoundError(f"File '{file_path}' does not exist")
if os.path.getsize(file_path) == 0: