This is an automated email from the ASF dual-hosted git repository. haonan pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push: new 2e99b064507 [PY-CLIENT] Use pyproject.toml to configurate python client project (#13027) 2e99b064507 is described below commit 2e99b0645074df67387d4c986d045b7822751e29 Author: Haonan <hhao...@outlook.com> AuthorDate: Thu Jul 25 17:18:21 2024 +0800 [PY-CLIENT] Use pyproject.toml to configurate python client project (#13027) --- iotdb-client/client-py/.gitignore | 5 +- iotdb-client/client-py/README.md | 8 +-- .../client-py/iotdb/template/MeasurementNode.py | 1 + iotdb-client/client-py/pom.xml | 8 +-- iotdb-client/client-py/release.sh | 3 +- iotdb-client/client-py/requirements_dev.txt | 5 +- .../client-py/{ => resources}/pyproject.toml | 42 +++++++++++++- iotdb-client/client-py/resources/setup.py | 64 ---------------------- .../integration/__init__.py} | 28 ---------- .../tablet_performance_comparison.py | 0 .../{ => integration}/test_aligned_timeseries.py | 0 .../tests/{ => integration}/test_dataframe.py | 0 .../tests/{ => integration}/test_delete_data.py | 0 .../tests/{ => integration}/test_one_device.py | 0 .../tests/{ => integration}/test_session.py | 0 .../tests/{ => integration}/test_session_pool.py | 0 .../tests/{ => integration}/test_tablet.py | 0 .../client-py/tests/{ => integration}/test_todf.py | 0 .../unit/__init__.py} | 11 ---- .../tests/{ => unit}/test_numpy_tablet.py | 0 20 files changed, 55 insertions(+), 120 deletions(-) diff --git a/iotdb-client/client-py/.gitignore b/iotdb-client/client-py/.gitignore index c2e6bdffad3..b28ef08e7e5 100644 --- a/iotdb-client/client-py/.gitignore +++ b/iotdb-client/client-py/.gitignore @@ -3,5 +3,6 @@ /build/ /dist/ /apache_iotdb.egg-info -/setup.py -!/resources/setup/py +/pyproject.toml +!/resources/pyproject.toml + diff --git a/iotdb-client/client-py/README.md b/iotdb-client/client-py/README.md index 8c6192834cc..ec0c5a65de9 100644 --- a/iotdb-client/client-py/README.md +++ b/iotdb-client/client-py/README.md @@ -21,7 +21,6 @@ # Apache IoTDB -[](https://github.com/apache/iotdb/actions/workflows/client-python.yml) [](https://github.com/apache/iotdb/releases) [](https://www.apache.org/licenses/LICENSE-2.0.html)  @@ -40,7 +39,7 @@ high-speed data ingestion and complex data analysis in the IoT industrial fields ### Requirements -You have to install thrift (>=0.13) before using the package. +You have to install thrift (>=0.14.1) before using the package. @@ -48,8 +47,6 @@ You have to install thrift (>=0.13) before using the package. First, download the latest package: `pip3 install apache-iotdb` -*Notice: If you are installing Python API v0.13.0, DO NOT install by `pip install apache-iotdb==0.13.0`, use `pip install apache-iotdb==0.13.0.post1` instead!* - You can get an example of using the package to read and write data at here: [Example](https://github.com/apache/iotdb/blob/master/client-py/SessionExample.py) An example of aligned timeseries: [Aligned Timeseries Session Example](https://github.com/apache/iotdb/blob/master/client-py/SessionAlignedTimeseriesExample.py) @@ -604,8 +601,7 @@ Namely, these are * Remove all transient directories from last release (if exists) * (Re-)generate all generated sources via mvn -* Run Linting (flake8) -* Run Tests via pytest +* Run Tests via pytest (optional) * Build * Release to pypi diff --git a/iotdb-client/client-py/iotdb/template/MeasurementNode.py b/iotdb-client/client-py/iotdb/template/MeasurementNode.py index 9c2de7a45b8..b1c6f50217d 100644 --- a/iotdb-client/client-py/iotdb/template/MeasurementNode.py +++ b/iotdb-client/client-py/iotdb/template/MeasurementNode.py @@ -33,6 +33,7 @@ class MeasurementNode(TemplateNode): encoding: TSEncoding, compression_type: Compressor, ): + super().__init__(name) warnings.warn( "The APIs about template are deprecated and will be removed in future versions. Use sql instead.", DeprecationWarning, diff --git a/iotdb-client/client-py/pom.xml b/iotdb-client/client-py/pom.xml index 1ce573da3c7..0d942986ac8 100644 --- a/iotdb-client/client-py/pom.xml +++ b/iotdb-client/client-py/pom.xml @@ -50,7 +50,7 @@ <filtering>true</filtering> <directory>${basedir}/resources</directory> <includes> - <include>setup.py</include> + <include>pyproject.toml</include> </includes> </resource> </resources> @@ -159,7 +159,7 @@ <resource> <directory>${basedir}/target/classes</directory> <includes> - <include>setup.py</include> + <include>pyproject.toml</include> </includes> </resource> </resources> @@ -172,13 +172,13 @@ <artifactId>build-helper-maven-plugin</artifactId> <executions> <execution> - <id>write-python-version</id> + <id>write-iotdb-version</id> <goals> <goal>regex-property</goal> </goals> <phase>generate-resources</phase> <configuration> - <name>python_version</name> + <name>iotdb_version</name> <regex>-SNAPSHOT</regex> <value>${project.version}</value> <replacement>\.dev0</replacement> diff --git a/iotdb-client/client-py/release.sh b/iotdb-client/client-py/release.sh index 4a3175d42a3..692047b8b57 100755 --- a/iotdb-client/client-py/release.sh +++ b/iotdb-client/client-py/release.sh @@ -35,7 +35,8 @@ if [ "$1" == "test" ]; then fi # See https://packaging.python.org/tutorials/packaging-projects/ -python3 setup.py sdist bdist_wheel +#python3 setup.py sdist bdist_wheel +python3 -m build if [ "$1" == "release" ]; then python3 -m twine upload dist/* fi diff --git a/iotdb-client/client-py/requirements_dev.txt b/iotdb-client/client-py/requirements_dev.txt index 53b73454f90..4408a9d4aeb 100644 --- a/iotdb-client/client-py/requirements_dev.txt +++ b/iotdb-client/client-py/requirements_dev.txt @@ -19,10 +19,11 @@ -r requirements.txt # Pytest to run tests pytest>=7.0.0 +testcontainers==3.4.2 +# For Linting flake8>=5.0.0 black>=22.8.0 -# Testcontainer -testcontainers==3.4.2 # For releases twine==3.4.1 wheel>=0.37.1 +build >= 0.9.0 diff --git a/iotdb-client/client-py/pyproject.toml b/iotdb-client/client-py/resources/pyproject.toml similarity index 50% copy from iotdb-client/client-py/pyproject.toml copy to iotdb-client/client-py/resources/pyproject.toml index 389b729d095..dcde7a7ed4f 100644 --- a/iotdb-client/client-py/pyproject.toml +++ b/iotdb-client/client-py/resources/pyproject.toml @@ -16,9 +16,48 @@ # under the License. # +[build-system] +requires = ["setuptools>=42", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "apache-iotdb" +version = "${iotdb_version}" +description = "Apache IoTDB client API" +readme = "README.md" +readme-content-type = "text/markdown" +authors = [ + { name = "Apache IoTDB", email = "d...@iotdb.apache.org" } +] +license = { text = "Apache License, Version 2.0", file = "LICENSE" } +homepage = "https://github.com/apache/iotdb" +keywords = ["iotdb", "apache", "client", "API"] +classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: Apache Software License", + "Operating System :: OS Independent", + "Topic :: Software Development :: Libraries", + "Topic :: Software Development :: Libraries :: Python Modules" +] +requires-python = ">=3.6" +dependencies = [ + "thrift>=0.14.1", + "pandas>=1.0.0", + "numpy>=1.0.0", + "sqlalchemy<1.5,>=1.4", + "sqlalchemy-utils>=0.37.8" +] + +[project.urls] +Homepage = "https://iotdb.apache.org" +Documentation = "https://github.com/apache/iotdb" + +[project.entry-points."sqlalchemy.dialects"] +iotdb = "iotdb.sqlalchemy.IoTDBDialect:IoTDBDialect" + [tool.black] line-length = 88 -target-version = ['py37'] +target-version = ['py36', 'py37', 'py38', 'py39', 'py310', 'py311', 'py312'] include = '\.pyi?$' exclude = ''' @@ -36,7 +75,6 @@ exclude = ''' | build | dist | migrations - | test | iotdb/thrift )/ | foo.py # also separately exclude a file named foo.py in diff --git a/iotdb-client/client-py/resources/setup.py b/iotdb-client/client-py/resources/setup.py deleted file mode 100644 index 202507af804..00000000000 --- a/iotdb-client/client-py/resources/setup.py +++ /dev/null @@ -1,64 +0,0 @@ -# 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. -# - -import setuptools -import io - - -try: - with io.open("README.md", encoding="utf-8") as f: - long_description = f.read() -except FileNotFoundError: - long_description = "" - - -print(long_description) - -setuptools.setup( - name="apache-iotdb", # Replace with your own username - version="${python_version}", - author=" Apache Software Foundation", - author_email="d...@iotdb.apache.org", - description="Apache IoTDB client API", - long_description=long_description, - long_description_content_type="text/markdown", - url="https://github.com/apache/iotdb", - packages=setuptools.find_packages(), - install_requires=[ - "thrift>=0.14.1", - "pandas>=1.0.0", - "numpy>=1.0.0", - "sqlalchemy<1.5,>=1.4", - "sqlalchemy-utils>=0.37.8", - ], - classifiers=[ - "Programming Language :: Python :: 3", - "License :: OSI Approved :: Apache Software License", - "Operating System :: OS Independent", - "Topic :: Software Development :: Libraries", - "Topic :: Software Development :: Libraries :: Python Modules", - ], - python_requires=">=3.6", - license="Apache License, Version 2.0", - website="https://iotdb.apache.org", - entry_points={ - "sqlalchemy.dialects": [ - "iotdb = iotdb.sqlalchemy.IoTDBDialect:IoTDBDialect", - ], - }, -) diff --git a/iotdb-client/client-py/pyproject.toml b/iotdb-client/client-py/tests/integration/__init__.py similarity index 61% rename from iotdb-client/client-py/pyproject.toml rename to iotdb-client/client-py/tests/integration/__init__.py index 389b729d095..2a1e720805f 100644 --- a/iotdb-client/client-py/pyproject.toml +++ b/iotdb-client/client-py/tests/integration/__init__.py @@ -15,31 +15,3 @@ # specific language governing permissions and limitations # under the License. # - -[tool.black] -line-length = 88 -target-version = ['py37'] -include = '\.pyi?$' -exclude = ''' - -( - /( - \.eggs # exclude a few common directories in the - | \.git # root of the project - | \.hg - | \.mypy_cache - | \.tox - | \.venv - | venv - | _build - | buck-out - | build - | dist - | migrations - | test - | iotdb/thrift - )/ - | foo.py # also separately exclude a file named foo.py in - # the root of the project -) -''' \ No newline at end of file diff --git a/iotdb-client/client-py/tests/tablet_performance_comparison.py b/iotdb-client/client-py/tests/integration/tablet_performance_comparison.py similarity index 100% rename from iotdb-client/client-py/tests/tablet_performance_comparison.py rename to iotdb-client/client-py/tests/integration/tablet_performance_comparison.py diff --git a/iotdb-client/client-py/tests/test_aligned_timeseries.py b/iotdb-client/client-py/tests/integration/test_aligned_timeseries.py similarity index 100% rename from iotdb-client/client-py/tests/test_aligned_timeseries.py rename to iotdb-client/client-py/tests/integration/test_aligned_timeseries.py diff --git a/iotdb-client/client-py/tests/test_dataframe.py b/iotdb-client/client-py/tests/integration/test_dataframe.py similarity index 100% rename from iotdb-client/client-py/tests/test_dataframe.py rename to iotdb-client/client-py/tests/integration/test_dataframe.py diff --git a/iotdb-client/client-py/tests/test_delete_data.py b/iotdb-client/client-py/tests/integration/test_delete_data.py similarity index 100% rename from iotdb-client/client-py/tests/test_delete_data.py rename to iotdb-client/client-py/tests/integration/test_delete_data.py diff --git a/iotdb-client/client-py/tests/test_one_device.py b/iotdb-client/client-py/tests/integration/test_one_device.py similarity index 100% rename from iotdb-client/client-py/tests/test_one_device.py rename to iotdb-client/client-py/tests/integration/test_one_device.py diff --git a/iotdb-client/client-py/tests/test_session.py b/iotdb-client/client-py/tests/integration/test_session.py similarity index 100% rename from iotdb-client/client-py/tests/test_session.py rename to iotdb-client/client-py/tests/integration/test_session.py diff --git a/iotdb-client/client-py/tests/test_session_pool.py b/iotdb-client/client-py/tests/integration/test_session_pool.py similarity index 100% rename from iotdb-client/client-py/tests/test_session_pool.py rename to iotdb-client/client-py/tests/integration/test_session_pool.py diff --git a/iotdb-client/client-py/tests/test_tablet.py b/iotdb-client/client-py/tests/integration/test_tablet.py similarity index 100% rename from iotdb-client/client-py/tests/test_tablet.py rename to iotdb-client/client-py/tests/integration/test_tablet.py diff --git a/iotdb-client/client-py/tests/test_todf.py b/iotdb-client/client-py/tests/integration/test_todf.py similarity index 100% rename from iotdb-client/client-py/tests/test_todf.py rename to iotdb-client/client-py/tests/integration/test_todf.py diff --git a/iotdb-client/client-py/requirements_dev.txt b/iotdb-client/client-py/tests/unit/__init__.py similarity index 82% copy from iotdb-client/client-py/requirements_dev.txt copy to iotdb-client/client-py/tests/unit/__init__.py index 53b73454f90..2a1e720805f 100644 --- a/iotdb-client/client-py/requirements_dev.txt +++ b/iotdb-client/client-py/tests/unit/__init__.py @@ -15,14 +15,3 @@ # specific language governing permissions and limitations # under the License. # - --r requirements.txt -# Pytest to run tests -pytest>=7.0.0 -flake8>=5.0.0 -black>=22.8.0 -# Testcontainer -testcontainers==3.4.2 -# For releases -twine==3.4.1 -wheel>=0.37.1 diff --git a/iotdb-client/client-py/tests/test_numpy_tablet.py b/iotdb-client/client-py/tests/unit/test_numpy_tablet.py similarity index 100% rename from iotdb-client/client-py/tests/test_numpy_tablet.py rename to iotdb-client/client-py/tests/unit/test_numpy_tablet.py