From 1e24a3cf96c2b14b69532c604bdedb8f9ea720de Mon Sep 17 00:00:00 2001 From: Jarek Potiuk Date: Wed, 15 Nov 2023 11:04:47 +0100 Subject: [PATCH] Update package configuration for Breeze to pyproject.toml (#35652) This configuration allows breeze to be used in Python 3.12 which misses disutils and moves to PEP-517 compliant way of installing Python packages --- .pre-commit-config.yaml | 2 +- dev/breeze/README.md | 2 +- dev/breeze/pyproject.toml | 78 +++++++++++++ dev/breeze/setup.cfg | 105 ------------------ dev/breeze/setup.py | 27 ----- .../pre_commit_update_breeze_config_hash.py | 4 +- 6 files changed, 81 insertions(+), 137 deletions(-) delete mode 100644 dev/breeze/setup.cfg delete mode 100644 dev/breeze/setup.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 19e85aef8bd72..a61a00b99c0af 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -744,7 +744,7 @@ repos: name: Update Breeze README.md with config files hash language: python entry: ./scripts/ci/pre_commit/pre_commit_update_breeze_config_hash.py - files: ^dev/breeze/pyproject\.toml$|^dev/breeze/setup\.cfg$|^dev/breeze/setup\.py$|^dev/breeze/README\.md$ + files: ^dev/breeze/pyproject\.toml$|^dev/breeze/README\.md$ pass_filenames: false require_serial: true - id: check-breeze-top-dependencies-limited diff --git a/dev/breeze/README.md b/dev/breeze/README.md index 1421958fa9aee..d2c172ea44ad3 100644 --- a/dev/breeze/README.md +++ b/dev/breeze/README.md @@ -66,6 +66,6 @@ PLEASE DO NOT MODIFY THE HASH BELOW! IT IS AUTOMATICALLY UPDATED BY PRE-COMMIT. --------------------------------------------------------------------------------------------------------- -Package config hash: 7b512fa3a81a967c22fc4ccccf052a4c4dbcafd5c014adea775d45f0034d03e1c63d7d1e3df723e93724924ed3cfa92a5848c994c247dfd326c0a6300e282f88 +Package config hash: 51d9c2ec8af90c2941d58cf28397e9972d31718bc5d74538eb0614ed9418310e7b1d14bb3ee11f4df6e8403390869838217dc641cdb1416a223b7cf69adf1b20 --------------------------------------------------------------------------------------------------------- diff --git a/dev/breeze/pyproject.toml b/dev/breeze/pyproject.toml index b18b68f8033c7..47d7c04dc1734 100644 --- a/dev/breeze/pyproject.toml +++ b/dev/breeze/pyproject.toml @@ -14,6 +14,68 @@ # KIND, either express or implied. See the License for the # specific language governing permissions and limitations # under the License. +[build-system] +requires = ["flit_core >=3.2,<4"] +build-backend = "flit_core.buildapi" + +[project] +name = "apache-airflow-breeze" +version = "0.0.1" +description = "Apache Airflow Breeze development environment" +readme = "README.md" +authors = [ + {name="Apache Software Foundation", email="dev@airflow.apache.org"}, +] +maintainers = [ + {name="Apache Software Foundation", email="dev@airflow.apache.org"}, +] +keywords = [ "airflow", "development", "ci" ] +classifiers = [ + "Development Status :: 5 - Production/Stable", + "Environment :: Console", + "Intended Audience :: Developers", + "Framework :: Apache Airflow", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", +] +requires-python = "~=3.8" + +dependencies = [ + "black>=23.11.0", + "click>=8.1.7", + "filelock>=3.13.0", + "inputimeout>=1.0.4", + "jinja2>=3.1.0", + "packaging>=23.2", + "pendulum>=2.1.2,<3", + "pre-commit>=3.5.0", + "psutil>=5.9.6", + "pytest>=7.4.0", + "pytest-xdist>=3.3.1", + "pyyaml>=6.0.1", + "PyGithub>=2.1.1", + "requests>=2.30.0", + "rich>=13.6.0", + "rich-click>=1.7.1", + "gitpython>=3.1.40", + "semver>=3.0.2", + "tabulate>=0.9.0", + "twine>=4.0.2", + "wheel>=0.41.3", + "setuptools>=68.2.2", + "jsonschema>=4.19.1", +] + +[project.scripts] +breeze = "airflow_breeze.breeze:main" + +[tool.flit.module] +name = "airflow_breeze" + [tool.black] line-length = 110 target-version = ['py37', 'py38', 'py39', 'py310'] @@ -37,3 +99,19 @@ testpaths = [ [tool.ruff] extend = "../../pyproject.toml" src = ["src"] + + +[tool.mypy] +ignore_missing_imports = true +no_implicit_optional = true +warn_redundant_casts = true +warn_unused_ignores = false +pretty = true + +[tool.isort] +line_length = 110 +combine_as_imports = true +default_section = "THIRDPARTY" +known_first_party = "airflow,airflow_breeze,tests" +skip= "build,.tox,venv" +profile = "black" diff --git a/dev/breeze/setup.cfg b/dev/breeze/setup.cfg deleted file mode 100644 index db53c94ebb23a..0000000000000 --- a/dev/breeze/setup.cfg +++ /dev/null @@ -1,105 +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. - -[metadata] -version = 0.0.1 -name = apache-airflow-breeze -summary = Apache Airflow Breeze development environment -author = Apache Software Foundation -author_email = dev@airflow.apache.org -url = https://airflow.apache.org/ -long_description = file: README.md -long_description_content_type = text/markdown -license = Apache License 2.0 -license_files = - LICENSE - NOTICE -classifiers = - Development Status :: 5 - Production/Stable - Environment :: Console - Intended Audience :: Developers - License :: OSI Approved :: Apache Software License - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 -project_urls = - Documentation=https://github.com/apache/airflow/BREEZE.rst - Bug Tracker=https://github.com/apache/airflow/issues - Source Code=https://github.com/apache/airflow - Slack Chat=https://s.apache.org/airflow-slack - Twitter=https://twitter.com/ApacheAirflow - YouTube=https://www.youtube.com/channel/UCSXwxpWZQ7XZ1WL3wqevChA/ - -[options] -zip_safe = False -include_package_data = True -# Mainly because of distutils deprecation and some packages not being compatible with it, we should -# Limit airflow to < 3.12 until those dependencies are ready and until we can support Python 3.12 -python_requires = ~=3.8,<3.12 -package_dir= - =src -packages = find: -install_requires = - black>=23.11.0 - click>=8.1.7 - filelock>=3.13.0 - inputimeout>=1.0.4 - jinja2>=3.1.0 - packaging>=23.2 - pendulum>=2.1.2,<3 - pre-commit>=3.5.0 - psutil>=5.9.6 - pytest>=7.4.0 - pytest-xdist>=3.3.1 - pyyaml>=6.0.1 - PyGithub>=2.1.1 - requests>=2.30.0 - rich>=13.6.0 - rich-click>=1.7.1 - gitpython>=3.1.40 - semver>=3.0.2 - tabulate>=0.9.0 - twine>=4.0.2 - wheel>=0.41.3 - setuptools>=68.2.2 - jsonschema>=4.19.1 - -[options.packages.find] -where=src - -[options.entry_points] -console_scripts= - breeze=airflow_breeze.breeze:main - -[bdist_wheel] -python-tag=py3 - -[mypy] -ignore_missing_imports = True -no_implicit_optional = True -warn_redundant_casts = True -warn_unused_ignores = False -pretty = True - -[isort] -line_length=110 -combine_as_imports = true -default_section = THIRDPARTY -known_first_party=airflow,airflow_breeze,tests -skip=build,.tox,venv -profile = black diff --git a/dev/breeze/setup.py b/dev/breeze/setup.py deleted file mode 100644 index c3e556f847ab6..0000000000000 --- a/dev/breeze/setup.py +++ /dev/null @@ -1,27 +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. -from __future__ import annotations - -from setuptools import setup - - -def do_setup(): - setup() - - -if __name__ == "__main__": - do_setup() diff --git a/scripts/ci/pre_commit/pre_commit_update_breeze_config_hash.py b/scripts/ci/pre_commit/pre_commit_update_breeze_config_hash.py index ffa368477c563..4184761739604 100755 --- a/scripts/ci/pre_commit/pre_commit_update_breeze_config_hash.py +++ b/scripts/ci/pre_commit/pre_commit_update_breeze_config_hash.py @@ -32,7 +32,7 @@ def get_package_setup_metadata_hash() -> str: """ - Retrieves hash of setup.py and setup.cfg files. + Retrieves hash of pyproject.toml file. This is used in order to determine if we need to upgrade Breeze, because some setup files changed. Blake2b algorithm will not be flagged by security checkers @@ -41,8 +41,6 @@ def get_package_setup_metadata_hash() -> str: """ try: the_hash = hashlib.new("blake2b") - the_hash.update((BREEZE_SOURCES_ROOT / "setup.py").read_bytes()) - the_hash.update((BREEZE_SOURCES_ROOT / "setup.cfg").read_bytes()) the_hash.update((BREEZE_SOURCES_ROOT / "pyproject.toml").read_bytes()) return the_hash.hexdigest() except FileNotFoundError as e: