potiuk commented on a change in pull request #12512:
URL: https://github.com/apache/airflow/pull/12512#discussion_r528762100
##########
File path: dev/provider_packages/get_provider_info_TEMPLATE.py.jinja2
##########
@@ -0,0 +1,13 @@
+import yaml
+
+try:
+ import importlib.resources as importlib_resources
+except ImportError:
+ # Try backported to PY<37 `importlib_resources`.
+ import importlib_resources
+
+
+def get_provider_info():
+ return yaml.safe_load("""
+{{ PROVIDER_INFO }}
+""")
Review comment:
> I agree. We can serialize this object to Python. Here is a helpful
function, it is tested and works with all primitive types.
>
https://gist.github.com/mik-laj/3ae253d5394b34447dcbd426fd19b389#file-convert-py-L31
That was my worry about generating python dict out of the metadata (we need
to generate valid python code). I am not sure if it is worth the hassle.
This code is generated on the flight, nobody will really see it, it's a very
small speed improvement (if at all).
We are basically trading parsing of python code with parsing of yaml code.
WDYT @mik-laj @ashb -> do you really see a benefit of doing it (knowing that
we need to add new code to handle it ?)
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]