From 82546287ea49fab015bc1856802b8e0a8ca16e9e Mon Sep 17 00:00:00 2001 From: Yong Date: Mon, 27 Jan 2025 21:41:34 -0600 Subject: [PATCH 1/4] PEP 621 and Poetry v2 --- regtests/client/python/pyproject.toml | 84 ++++++++------------------- regtests/client/python/setup.cfg | 21 ------- regtests/client/python/setup.py | 67 --------------------- regtests/pyspark-setup.sh | 2 +- regtests/requirements.txt | 2 +- 5 files changed, 25 insertions(+), 151 deletions(-) delete mode 100644 regtests/client/python/setup.cfg delete mode 100644 regtests/client/python/setup.py diff --git a/regtests/client/python/pyproject.toml b/regtests/client/python/pyproject.toml index f6c248a418..b4802acab1 100644 --- a/regtests/client/python/pyproject.toml +++ b/regtests/client/python/pyproject.toml @@ -17,75 +17,37 @@ # under the License. # -[tool.poetry] +[project] name = "polaris" version = "1.0.0" description = "Apache Polaris Management Service" -authors = ["Apache Software Foundation "] -license = "Apache License 2.0" +authors = [ + {name = "Apache Software Foundation", email = "dev@polaris.apache.org"} +] readme = "README.md" -repository = "https://github.com/apache/polaris/" +requires-python = ">=3.8" +license = {text = "Apache License 2.0"} keywords = ["Polaris", "Polaris Management Service"] -include = ["polaris.management/py.typed"] -package-mode = true +dynamic = ["classifiers"] +dependencies = [ + "urllib3>=1.25.3,<2.0", + "python-dateutil>=2.8.2", + "pydantic>=2.0.0", + "typing-extensions>=4.7.1", + "boto3==1.36.6", +] -[tool.poetry.dependencies] -python = "^3.8" +[project.urls] +homepage = "https://polaris.apache.org/" +repository = "https://github.com/apache/polaris/" -urllib3 = "^1.25.3" -python-dateutil = ">=2.8.2" -pydantic = ">=2" -typing-extensions = ">=4.7.1" -boto3 = "==1.36.6" +[tool.poetry] +requires-poetry = ">=2.0" +packages = [{ include = "polaris" }] -[tool.poetry.dev-dependencies] +[tool.poetry.group.test.dependencies] pytest = ">=7.2.1" -flake8 = ">=4.0.0" -types-python-dateutil = ">=2.8.19.14" -mypy = "1.14.1" - [build-system] -requires = ["setuptools"] -build-backend = "setuptools.build_meta" - -[tool.pylint.'MESSAGES CONTROL'] -extension-pkg-whitelist = "pydantic" - -[tool.mypy] -files = [ - "polaris", - #"test", # auto-generated tests - "tests", # hand-written tests -] -# TODO: enable "strict" once all these individual checks are passing -# strict = true - -# List from: https://mypy.readthedocs.io/en/stable/existing_code.html#introduce-stricter-options -warn_unused_configs = true -warn_redundant_casts = true -warn_unused_ignores = true - -## Getting these passing should be easy -strict_equality = true -strict_concatenate = true - -## Strongly recommend enabling this one as soon as you can -check_untyped_defs = true - -## These shouldn't be too much additional work, but may be tricky to -## get passing if you use a lot of untyped libraries -disallow_subclassing_any = true -disallow_untyped_decorators = true -disallow_any_generics = true - -### These next few are various gradations of forcing use of type annotations -#disallow_untyped_calls = true -#disallow_incomplete_defs = true -#disallow_untyped_defs = true -# -### This one isn't too hard to get passing, but return on investment is lower -#no_implicit_reexport = true -# -### This one can be tricky to get passing if you use a lot of untyped libraries -#warn_return_any = true +requires = ["poetry-core>=2.0.0,<3.0.0"] +build-backend = "poetry.core.masonry.api" diff --git a/regtests/client/python/setup.cfg b/regtests/client/python/setup.cfg deleted file mode 100644 index ec48b3de4f..0000000000 --- a/regtests/client/python/setup.cfg +++ /dev/null @@ -1,21 +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. -# - -[flake8] -max-line-length=99 diff --git a/regtests/client/python/setup.py b/regtests/client/python/setup.py deleted file mode 100644 index 60f6cb2dcc..0000000000 --- a/regtests/client/python/setup.py +++ /dev/null @@ -1,67 +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. -# -# coding: utf-8 - -""" - Polaris Management Service - - Defines the management APIs for using Polaris to create and manage Iceberg catalogs and their principals - - The version of the OpenAPI document: 0.0.1 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from setuptools import setup, find_packages # noqa: H301 - -# To install the library, run the following -# -# python setup.py install -# -# prerequisite: setuptools -# http://pypi.python.org/pypi/setuptools -NAME = "polaris.management" -VERSION = "1.0.0" -PYTHON_REQUIRES = ">=3.7" -REQUIRES = [ - "urllib3 >= 1.25.3, < 2.1.0", - "python-dateutil", - "pydantic >= 2", - "typing-extensions >= 4.7.1", -] - -setup( - name=NAME, - version=VERSION, - description="Polaris Management Service", - author="OpenAPI Generator community", - author_email="team@openapitools.org", - url="", - keywords=["OpenAPI", "OpenAPI-Generator", "Polaris Management Service"], - install_requires=REQUIRES, - packages=find_packages(exclude=["test", "tests"]), - include_package_data=True, - long_description_content_type='text/markdown', - long_description="""\ - Defines the management APIs for using Polaris to create and manage Iceberg catalogs and their principals - """, # noqa: E501 - package_data={"polaris.management": ["py.typed"]}, -) diff --git a/regtests/pyspark-setup.sh b/regtests/pyspark-setup.sh index 7f7189a6dd..028d5e10bf 100755 --- a/regtests/pyspark-setup.sh +++ b/regtests/pyspark-setup.sh @@ -27,5 +27,5 @@ fi pip install -r requirements.txt cd client/python -python3 -m poetry install +python3 -m poetry install --with test deactivate diff --git a/regtests/requirements.txt b/regtests/requirements.txt index 1beb63bca0..1c4979e1bd 100644 --- a/regtests/requirements.txt +++ b/regtests/requirements.txt @@ -17,4 +17,4 @@ # under the License. # -poetry==1.8.5 +poetry==2.0.1 From e03bb16c86d1b1e3f093001c55d311e42341f39d Mon Sep 17 00:00:00 2001 From: Yong Date: Mon, 27 Jan 2025 23:38:56 -0600 Subject: [PATCH 2/4] PEP 621 and Poetry v2 --- regtests/client/python/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regtests/client/python/pyproject.toml b/regtests/client/python/pyproject.toml index b4802acab1..705d9ecb4d 100644 --- a/regtests/client/python/pyproject.toml +++ b/regtests/client/python/pyproject.toml @@ -26,7 +26,7 @@ authors = [ ] readme = "README.md" requires-python = ">=3.8" -license = {text = "Apache License 2.0"} +license = "Apache-2.0" keywords = ["Polaris", "Polaris Management Service"] dynamic = ["classifiers"] dependencies = [ From c1ee3b460a8bdaaa3991b2b7e1ba18ca74945146 Mon Sep 17 00:00:00 2001 From: Yong Zheng Date: Mon, 27 Jan 2025 23:52:29 -0600 Subject: [PATCH 3/4] Update min python to 3.9 --- regtests/client/python/pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/regtests/client/python/pyproject.toml b/regtests/client/python/pyproject.toml index 705d9ecb4d..539a220841 100644 --- a/regtests/client/python/pyproject.toml +++ b/regtests/client/python/pyproject.toml @@ -25,7 +25,7 @@ authors = [ {name = "Apache Software Foundation", email = "dev@polaris.apache.org"} ] readme = "README.md" -requires-python = ">=3.8" +requires-python = ">=3.9,<4.0" license = "Apache-2.0" keywords = ["Polaris", "Polaris Management Service"] dynamic = ["classifiers"] From 2cd279311de9d242a1ffdf16d8fc25740c7f5ea3 Mon Sep 17 00:00:00 2001 From: Yong Date: Tue, 4 Mar 2025 00:32:35 -0600 Subject: [PATCH 4/4] Add back flask8 for #1096 --- regtests/client/python/pyproject.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/regtests/client/python/pyproject.toml b/regtests/client/python/pyproject.toml index 00503857b6..93054249b6 100644 --- a/regtests/client/python/pyproject.toml +++ b/regtests/client/python/pyproject.toml @@ -46,6 +46,7 @@ requires-poetry = ">=2.1" packages = [{ include = "polaris" }] [tool.poetry.group.test.dependencies] +flake8 = ">=4.0.0" pytest = ">=7.2.1" [build-system]