Re: [PR] Transition of `lint` airflowctl config command [airflow]
bugraoz93 commented on PR #50556: URL: https://github.com/apache/airflow/pull/50556#issuecomment-2972537108 Thanks a lot @yunchipang for all the great work! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] Transition of `lint` airflowctl config command [airflow]
bugraoz93 merged PR #50556: URL: https://github.com/apache/airflow/pull/50556 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] Transition of `lint` airflowctl config command [airflow]
bugraoz93 commented on PR #50556: URL: https://github.com/apache/airflow/pull/50556#issuecomment-2967929069 Can you please rerun the pre commit and push? The last addition should be reflected in the image. We can merge afterwards :) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] Transition of `lint` airflowctl config command [airflow]
yunchipang commented on code in PR #50556: URL: https://github.com/apache/airflow/pull/50556#discussion_r2141758629 ## airflow-ctl/src/airflowctl/ctl/cli_config.py: ## @@ -643,6 +678,22 @@ def merge_commands( ), ) +CONFIG_COMMANDS = ( +ActionCommand( +name="lint", +help="Lint options for the configuration changes while migrating from Airflow 2.x to Airflow 3.0", +description="Lint options for the configuration changes while migrating from Airflow 2.x to Airflow 3.0", Review Comment: @uranusjr thanks for the suggestion! changes have been pushed. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] Transition of `lint` airflowctl config command [airflow]
uranusjr commented on code in PR #50556: URL: https://github.com/apache/airflow/pull/50556#discussion_r2141665636 ## airflow-ctl/src/airflowctl/ctl/cli_config.py: ## @@ -643,6 +678,22 @@ def merge_commands( ), ) +CONFIG_COMMANDS = ( +ActionCommand( +name="lint", +help="Lint options for the configuration changes while migrating from Airflow 2.x to Airflow 3.0", +description="Lint options for the configuration changes while migrating from Airflow 2.x to Airflow 3.0", Review Comment: ```suggestion help="Lint options for the configuration changes while migrating from Airflow 2 to Airflow 3", description="Lint options for the configuration changes while migrating from Airflow 2 to Airflow 3", ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] Transition of `lint` airflowctl config command [airflow]
yunchipang commented on PR #50556: URL: https://github.com/apache/airflow/pull/50556#issuecomment-2964412109 @bugraoz93 rebase done! could you kindly take a look? thanks -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] Transition of `lint` airflowctl config command [airflow]
bugraoz93 commented on PR #50556: URL: https://github.com/apache/airflow/pull/50556#issuecomment-2964368523 Can you please rebase @yunchipang? Merging makes the commit history untraceable. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] Transition of `lint` airflowctl config command [airflow]
bugraoz93 commented on code in PR #50556: URL: https://github.com/apache/airflow/pull/50556#discussion_r2138678379 ## airflow-ctl/src/airflowctl/ctl/commands/config_command.py: ## @@ -0,0 +1,825 @@ +# +# 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 + +import sys +from dataclasses import dataclass +from typing import TYPE_CHECKING, Any, NamedTuple + +import rich + +from airflowctl.api.client import NEW_API_CLIENT, ClientKind, provide_api_client + +if TYPE_CHECKING: +from airflowctl.api.datamodels.generated import Config + + +class ConfigParameter(NamedTuple): +"""Represents a configuration parameter.""" + +section: str +option: str + + +@dataclass +class ConfigChange: +""" +Class representing the configuration changes in Airflow 3.0. + +:param config: The configuration parameter being changed. +:param default_change: If the change is a default value change. +:param old_default: The old default value (valid only if default_change is True). +:param new_default: The new default value for the configuration parameter. +:param suggestion: A suggestion for replacing or handling the removed configuration. +:param renamed_to: The new section and option if the configuration is renamed. +:param was_deprecated: If the config is removed, whether the old config was deprecated. +:param was_removed: If the config is removed. +:param is_invalid_if: If the current config value is invalid in the future. +:param breaking: Mark if this change is known to be breaking and causing errors/ warnings / deprecations. +:param remove_if_equals: For removal rules, remove the option only if its current value equals this value. +""" + +config: ConfigParameter +default_change: bool = False +old_default: str | bool | int | float | None = None +new_default: str | bool | int | float | None = None +suggestion: str = "" +renamed_to: ConfigParameter | None = None +was_deprecated: bool = True +was_removed: bool = True +is_invalid_if: Any = None +breaking: bool = False +remove_if_equals: str | bool | int | float | None = None + +def message(self, api_client=NEW_API_CLIENT) -> str | None: +"""Generate a message for this configuration change.""" +if self.default_change: +value = self._get_option_value(api_client.configs.list()) +if value != self.new_default: Review Comment: Looks great! Thanks for the adjustments and PR! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] Transition of `lint` airflowctl config command [airflow]
yunchipang commented on code in PR #50556: URL: https://github.com/apache/airflow/pull/50556#discussion_r2136897463 ## airflow-ctl/src/airflowctl/ctl/commands/config_command.py: ## @@ -0,0 +1,825 @@ +# +# 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 + +import sys +from dataclasses import dataclass +from typing import TYPE_CHECKING, Any, NamedTuple + +import rich + +from airflowctl.api.client import NEW_API_CLIENT, ClientKind, provide_api_client + +if TYPE_CHECKING: +from airflowctl.api.datamodels.generated import Config + + +class ConfigParameter(NamedTuple): +"""Represents a configuration parameter.""" + +section: str +option: str + + +@dataclass +class ConfigChange: +""" +Class representing the configuration changes in Airflow 3.0. + +:param config: The configuration parameter being changed. +:param default_change: If the change is a default value change. +:param old_default: The old default value (valid only if default_change is True). +:param new_default: The new default value for the configuration parameter. +:param suggestion: A suggestion for replacing or handling the removed configuration. +:param renamed_to: The new section and option if the configuration is renamed. +:param was_deprecated: If the config is removed, whether the old config was deprecated. +:param was_removed: If the config is removed. +:param is_invalid_if: If the current config value is invalid in the future. +:param breaking: Mark if this change is known to be breaking and causing errors/ warnings / deprecations. +:param remove_if_equals: For removal rules, remove the option only if its current value equals this value. +""" + +config: ConfigParameter +default_change: bool = False +old_default: str | bool | int | float | None = None +new_default: str | bool | int | float | None = None +suggestion: str = "" +renamed_to: ConfigParameter | None = None +was_deprecated: bool = True +was_removed: bool = True +is_invalid_if: Any = None +breaking: bool = False +remove_if_equals: str | bool | int | float | None = None + +def message(self, api_client=NEW_API_CLIENT) -> str | None: +"""Generate a message for this configuration change.""" +if self.default_change: +value = self._get_option_value(api_client.configs.list()) +if value != self.new_default: Review Comment: @bugraoz93 logic in `message()` is updated accordingly. thanks for the suggestion! please take a look at `lint()` and the added `TestCliConfigLint` class. lmk any thoughts! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] Transition of `lint` airflowctl config command [airflow]
bugraoz93 commented on code in PR #50556: URL: https://github.com/apache/airflow/pull/50556#discussion_r2135901215 ## airflow-ctl/src/airflowctl/ctl/commands/config_command.py: ## @@ -0,0 +1,828 @@ +# +# 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 + +import sys +from dataclasses import dataclass +from typing import TYPE_CHECKING, Any, NamedTuple + +import rich + +from airflowctl.api.client import NEW_API_CLIENT, ClientKind, provide_api_client + +if TYPE_CHECKING: +from airflowctl.api.datamodels.generated import Config + + +class ConfigParameter(NamedTuple): +"""Represents a configuration parameter.""" + +section: str +option: str + + +@dataclass +class ConfigChange: +""" +Class representing the configuration changes in Airflow 3.0. + +:param config: The configuration parameter being changed. +:param default_change: If the change is a default value change. +:param old_default: The old default value (valid only if default_change is True). +:param new_default: The new default value for the configuration parameter. +:param suggestion: A suggestion for replacing or handling the removed configuration. +:param renamed_to: The new section and option if the configuration is renamed. +:param was_deprecated: If the config is removed, whether the old config was deprecated. +:param was_removed: If the config is removed. +:param is_invalid_if: If the current config value is invalid in the future. +:param breaking: Mark if this change is known to be breaking and causing errors/ warnings / deprecations. +:param remove_if_equals: For removal rules, remove the option only if its current value equals this value. +""" + +config: ConfigParameter +default_change: bool = False +old_default: str | bool | int | float | None = None +new_default: str | bool | int | float | None = None +suggestion: str = "" +renamed_to: ConfigParameter | None = None +was_deprecated: bool = True +was_removed: bool = True +is_invalid_if: Any = None +breaking: bool = False +remove_if_equals: str | bool | int | float | None = None + +@provide_api_client(kind=ClientKind.CLI) +def message(self, api_client=NEW_API_CLIENT) -> str | None: +"""Generate a message for this configuration change.""" +if self.default_change: +config_resp = api_client.configs.get(section=self.config.section, option=self.config.option) +value = self._get_option_value(config_resp) Review Comment: I think what would be the easiest is just listing all config once don't use get and parse those keyse locally since it is easier -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] Transition of `lint` airflowctl config command [airflow]
yunchipang commented on code in PR #50556: URL: https://github.com/apache/airflow/pull/50556#discussion_r2132943180 ## airflow-ctl/src/airflowctl/ctl/commands/config_command.py: ## @@ -0,0 +1,828 @@ +# +# 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 + +import sys +from dataclasses import dataclass +from typing import TYPE_CHECKING, Any, NamedTuple + +import rich + +from airflowctl.api.client import NEW_API_CLIENT, ClientKind, provide_api_client + +if TYPE_CHECKING: +from airflowctl.api.datamodels.generated import Config + + +class ConfigParameter(NamedTuple): +"""Represents a configuration parameter.""" + +section: str +option: str + + +@dataclass +class ConfigChange: +""" +Class representing the configuration changes in Airflow 3.0. + +:param config: The configuration parameter being changed. +:param default_change: If the change is a default value change. +:param old_default: The old default value (valid only if default_change is True). +:param new_default: The new default value for the configuration parameter. +:param suggestion: A suggestion for replacing or handling the removed configuration. +:param renamed_to: The new section and option if the configuration is renamed. +:param was_deprecated: If the config is removed, whether the old config was deprecated. +:param was_removed: If the config is removed. +:param is_invalid_if: If the current config value is invalid in the future. +:param breaking: Mark if this change is known to be breaking and causing errors/ warnings / deprecations. +:param remove_if_equals: For removal rules, remove the option only if its current value equals this value. +""" + +config: ConfigParameter +default_change: bool = False +old_default: str | bool | int | float | None = None +new_default: str | bool | int | float | None = None +suggestion: str = "" +renamed_to: ConfigParameter | None = None +was_deprecated: bool = True +was_removed: bool = True +is_invalid_if: Any = None +breaking: bool = False +remove_if_equals: str | bool | int | float | None = None + +@provide_api_client(kind=ClientKind.CLI) +def message(self, api_client=NEW_API_CLIENT) -> str | None: +"""Generate a message for this configuration change.""" +if self.default_change: +config_resp = api_client.configs.get(section=self.config.section, option=self.config.option) +value = self._get_option_value(config_resp) Review Comment: @bugraoz93 Quick question here. To cover `default_change=True`, we need both `get` and `list` endpoints mocked, but the current `api_client_maker` only stubs one. Is there any workaround here? Would it be safe to extend `api_client_maker` even though it’ll affect other tests? Thoughts appreciated 🙏🏻 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] Transition of `lint` airflowctl config command [airflow]
bugraoz93 commented on PR #50556: URL: https://github.com/apache/airflow/pull/50556#issuecomment-2950750140 > @bugraoz93 I’m still working on adding more tests, but I’d appreciate any feedback on the existing implementation. thanks! Thanks for the changes @yunchipang! I will take a look soon -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
Re: [PR] Transition of `lint` airflowctl config command [airflow]
yunchipang commented on PR #50556: URL: https://github.com/apache/airflow/pull/50556#issuecomment-2946356181 @bugraoz93 I’m still working on adding more tests, but I’d appreciate any feedback on the existing implementation. thanks! -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
