uranusjr edited a comment on issue #21259:
URL: https://github.com/apache/airflow/issues/21259#issuecomment-1027620661


   The asterisk is optional in this case. It means `run_after` can only be 
called as a keyword argument, while the example code allows the caller to use 
it as _either_ positional or keyword. But since the function is always only 
called with keyword arguments in Airflow, both syntax will work. The example 
code is not wrong.
   
   As for the absolute import issue, unfortunately this is a (somewhat obsecure 
and annoying) problem in Python. If you add a directory in `sys.path` via 
multiple paths, names imported from different `sys.path` items have different 
identities.
   
   ```console
   $ tree
   .
   |-- plugins
       |-- __init__.py
       `-- mod.py
   $ cat plugins/mod.py
   class A:
       pass
   $ PYTHONPATH=plugins python -q  # Simulate how Airflow loads the plugin 
directory.
   >>> from plugins.mod import A as AFromAbsolute
   >>> from mod import A as AFromPlugin
   >>> AFromAbsolute == AFromPlugin
   False
   ```
   
   And since timetable is loaded from plugin, you must import relative to the 
plugin directory, or somewhere that’s not related to the plugin directory 
hierarchy, such as `site-packages`. There are _probably_ hacks we can use to 
work around this, but this kind of “working above” the Python language rules is 
not a good idea to me.


-- 
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]


Reply via email to