[Core] Add deprecation module with decorator and custom warnings #36952
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Rationale
This is a step number 2 of the process described in #36876, please refer to it for the rationale and in depth description. Possibly, it can also replace part of the mechanism described in #31830.
TLDR
See the tests i wrote, for the demo of how it works (look at the end of the file).
I want to add a decorator (for now only for classes, functions, methods etc.) that we can use for deprecations in the entire codebase (core and providers). By defining a custom function, we can have the most common information (now included in deprecation message) as separate arguments, so it's easier to parse it and use in CI, docs etc.
To do in next PRs
airflow.exceptions.py
) and only keep them inairflow.deprecation.py
, but this requires some time to migrate etc. so I am not sure how do properly do it.Questions
This is my first PR that touches the core airflow, so let me know if anything needs to be changed 😄 I also have some questions to the functionality itself:
get_callable_full_path
orvalidate_release_string
. We can just make them private.provider_deprecated
decorator that will have a default category set to AirflowProviderDeprecationWarning ?^ Add meaningful description above
Read the Pull Request Guidelines for more information.
In case of fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
In case of a new dependency, check compliance with the ASF 3rd Party License Policy.
In case of backwards incompatible changes please leave a note in a newsfragment file, named
{pr_number}.significant.rst
or{issue_number}.significant.rst
, in newsfragments.