You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by GitBox <gi...@apache.org> on 2020/12/06 15:30:55 UTC

[GitHub] [airflow] potiuk commented on a change in pull request #12853: Add conditional version retrieval from setup.

potiuk commented on a change in pull request #12853:
URL: https://github.com/apache/airflow/pull/12853#discussion_r537061636



##########
File path: airflow/version.py
##########
@@ -24,6 +24,13 @@
 except ImportError:
     import importlib_metadata as metadata
 
-version = metadata.version('apache-airflow')
+try:
+    version = metadata.version('apache-airflow')
+except metadata.PackageNotFoundError:
+    import logging
+
+    log = logging.getLogger(__name__)
+    log.warning("Package metadata could not be found. Overriding it with version found in setup.py")
+    from setup import version

Review comment:
       This is actually a protection against the case when you think you have airflow installed from the package (i.e. in production) but you actually don't (for example you have it installed with `pip -e .`. I think all production installations should be installed from packages (this is what I am working on in #12685. So the warning is deliberate here to be warned if that's the case. 
   




----------------------------------------------------------------
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:
users@infra.apache.org