mik-laj opened a new pull request #19298:
URL: https://github.com/apache/airflow/pull/19298
I suggest introducing a few improvements to this command, as this command
does not always do the job:
- The flask blueprints field contains information about the name and the
imported name to distinguish between different objects.
- Full import paths for classes are shown to easily identify the class. In
particular, I want the executor field to show the full name so that it can be
easily set in the configuration file.
- The method output is deterministic, so it's easier to use. Users don't
care about object memory addresses.
Before:
```
$ AIRFLOW__CORE__PLUGINS_FOLDER=$PWD/tests/plugins airflow plugins
--output=json | jq .
[
{
"name": "test_plugin",
"appbuilder_views": [
{
"name": "Test View",
"category": "Test Plugin",
"view": "<test_plugin.PluginTestAppBuilderBaseView object at
0x7fe21ed57860>"
}
],
"flask_blueprints": [
"<flask.blueprints.Blueprint object at 0x7fe21ed57898>"
],
"appbuilder_menu_items": [
{
"name": "Google",
"href": "https://www.google.com",
"category": "Search"
},
{
"name": "apache",
"href": "https://www.apache.org/",
"label": "The Apache Software Foundation"
}
],
"executors": [
"PluginExecutor"
],
"hooks": [
"PluginHook"
],
"macros": [
"<function plugin_macro at 0x7fe248a88400>"
],
"operator_extra_links": [
"GoogleLink()",
"AirflowLink2()",
"CustomOpLink()",
"CustomBaseIndexOpLink(index=1)"
],
"source": "$PLUGINS_FOLDER/test_plugin.py",
"global_operator_extra_links": [
"AirflowLink()",
"GithubLink()"
]
},
{
"name": "plugin-a",
"appbuilder_views": [],
"flask_blueprints": [],
"appbuilder_menu_items": [],
"executors": [],
"hooks": [],
"macros": [],
"operator_extra_links": [],
"source": "$PLUGINS_FOLDER/test_plugin.py",
"global_operator_extra_links": []
},
{
"name": "plugin-b",
"appbuilder_views": [],
"flask_blueprints": [],
"appbuilder_menu_items": [],
"executors": [],
"hooks": [],
"macros": [],
"operator_extra_links": [],
"source": "$PLUGINS_FOLDER/test_plugin.py",
"global_operator_extra_links": []
},
{
"name": "plugin-c",
"appbuilder_views": [],
"flask_blueprints": [],
"appbuilder_menu_items": [],
"executors": [],
"hooks": [],
"macros": [],
"operator_extra_links": [],
"source": "$PLUGINS_FOLDER/test_plugin.py",
"global_operator_extra_links": []
},
{
"name": "postload",
"appbuilder_views": [],
"flask_blueprints": [],
"appbuilder_menu_items": [],
"executors": [],
"hooks": [],
"macros": [],
"operator_extra_links": [],
"source": "$PLUGINS_FOLDER/test_plugin.py",
"global_operator_extra_links": []
}
]
```
After:
```
$ AIRFLOW__CORE__PLUGINS_FOLDER=$PWD/tests/plugins airflow plugins
--output=json | jq .
[
{
"name": "test_plugin",
"source": "$PLUGINS_FOLDER/test_plugin.py",
"flask_blueprints": [
"<flask.blueprints.Blueprint: name='test_plugin'
import_name='test_plugin'>"
],
"appbuilder_menu_items": [
{
"name": "Google",
"href": "https://www.google.com",
"category": "Search"
},
{
"name": "apache",
"href": "https://www.apache.org/",
"label": "The Apache Software Foundation"
}
],
"operator_extra_links": [
"<tests.test_utils.mock_operators.GoogleLink>",
"<tests.test_utils.mock_operators.AirflowLink2>",
"<tests.test_utils.mock_operators.CustomOpLink>",
"<tests.test_utils.mock_operators.CustomBaseIndexOpLink>"
],
"macros": [
"test_plugin.plugin_macro"
],
"hooks": [
"test_plugin.PluginHook"
],
"global_operator_extra_links": [
"<tests.test_utils.mock_operators.AirflowLink>",
"<tests.test_utils.mock_operators.GithubLink>"
],
"appbuilder_views": [
{
"name": "Test View",
"category": "Test Plugin",
"view": "test_plugin.PluginTestAppBuilderBaseView"
}
],
"executors": [
"test_plugin.PluginExecutor"
],
"timetables": [
"test_plugin.CustomCronDataIntervalTimetable"
]
},
{
"name": "plugin-a",
"source": "$PLUGINS_FOLDER/test_plugin.py",
"flask_blueprints": [],
"appbuilder_menu_items": [],
"operator_extra_links": [],
"macros": [],
"hooks": [],
"global_operator_extra_links": [],
"appbuilder_views": [],
"executors": [],
"timetables": []
},
{
"name": "plugin-b",
"source": "$PLUGINS_FOLDER/test_plugin.py",
"flask_blueprints": [],
"appbuilder_menu_items": [],
"operator_extra_links": [],
"macros": [],
"hooks": [],
"global_operator_extra_links": [],
"appbuilder_views": [],
"executors": [],
"timetables": []
},
{
"name": "plugin-c",
"source": "$PLUGINS_FOLDER/test_plugin.py",
"flask_blueprints": [],
"appbuilder_menu_items": [],
"operator_extra_links": [],
"macros": [],
"hooks": [],
"global_operator_extra_links": [],
"appbuilder_views": [],
"executors": [],
"timetables": []
},
{
"name": "postload",
"source": "$PLUGINS_FOLDER/test_plugin.py",
"flask_blueprints": [],
"appbuilder_menu_items": [],
"operator_extra_links": [],
"macros": [],
"hooks": [],
"global_operator_extra_links": [],
"appbuilder_views": [],
"executors": [],
"timetables": []
}
]
```
<!--
Thank you for contributing! Please make sure that your code changes
are covered with tests. And in case of new features or big changes
remember to adjust the documentation.
Feel free to ping committers for the review!
In case of existing issue, reference it using one of the following:
closes: #ISSUE
related: #ISSUE
How to write a good git commit message:
http://chris.beams.io/posts/git-commit/
-->
---
**^ Add meaningful description above**
Read the **[Pull Request
Guidelines](https://github.com/apache/airflow/blob/main/CONTRIBUTING.rst#pull-request-guidelines)**
for more information.
In case of fundamental code change, Airflow Improvement Proposal
([AIP](https://cwiki.apache.org/confluence/display/AIRFLOW/Airflow+Improvements+Proposals))
is needed.
In case of a new dependency, check compliance with the [ASF 3rd Party
License Policy](https://www.apache.org/legal/resolved.html#category-x).
In case of backwards incompatible changes please leave a note in
[UPDATING.md](https://github.com/apache/airflow/blob/main/UPDATING.md).
--
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]