Description
In airflow_shared/module_loading/__init__.py, the import_string(dotted_path) utility currently contains a TODO noting that it only supports top-level classes:
# TODO: Add support for nested classes. Currently, it only works for top-level classes.
Airflow frequently relies on dotted path strings to dynamically load classes (e.g., operators, callbacks, secrets backends, etc.). Supporting nested classes allows developers to better encapsulate their code or utilize existing third-party libraries that rely on nested class structures.
The current limitation requires users to expose all classes at the top-level module scope if they are to be dynamically imported by Airflow. Addressing this known TODO will provide greater flexibility and make the module loading utility more robust.
Use case/motivation
Airflow frequently relies on dotted path strings to dynamically load classes (e.g., operators, callbacks, secrets backends, etc.). Supporting nested classes allows developers to better encapsulate their code or utilize existing third-party libraries that rely on nested class structures.
The current limitation requires users to expose all classes at the top-level module scope if they are to be dynamically imported by Airflow. Addressing this known TODO will provide greater flexibility and make the module loading utility more robust.
Related issues
None (resolves an existing TODO in airflow_shared/module_loading/__init__.py).
Are you willing to submit a PR?
Code of Conduct
Description
In
airflow_shared/module_loading/__init__.py, theimport_string(dotted_path)utility currently contains aTODOnoting that it only supports top-level classes:# TODO: Add support for nested classes. Currently, it only works for top-level classes.Airflow frequently relies on dotted path strings to dynamically load classes (e.g., operators, callbacks, secrets backends, etc.). Supporting nested classes allows developers to better encapsulate their code or utilize existing third-party libraries that rely on nested class structures.
The current limitation requires users to expose all classes at the top-level module scope if they are to be dynamically imported by Airflow. Addressing this known
TODOwill provide greater flexibility and make the module loading utility more robust.Use case/motivation
Airflow frequently relies on dotted path strings to dynamically load classes (e.g., operators, callbacks, secrets backends, etc.). Supporting nested classes allows developers to better encapsulate their code or utilize existing third-party libraries that rely on nested class structures.
The current limitation requires users to expose all classes at the top-level module scope if they are to be dynamically imported by Airflow. Addressing this known
TODOwill provide greater flexibility and make the module loading utility more robust.Related issues
None (resolves an existing
TODOinairflow_shared/module_loading/__init__.py).Are you willing to submit a PR?
Code of Conduct