GitHub user hamedrabah added a comment to the discussion: [Proposal] Separate 
DAG discovery path from DAG bundle import root

The safest current solution is to make shared code an installed Python package. 
Build `project` into the Airflow image or install it in the environment, then 
keep the bundle's `subdir` focused on DAG discovery. Imports no longer depend 
on the DAG directory being placed on `sys.path`.

A second option is to make the repository root the bundle path and use 
`.airflowignore` to exclude non-DAG directories from discovery while leaving 
them importable. That works, but an installed package gives clearer versioning 
and avoids module-name collisions between bundles.

A separate `import_root` is technically reasonable, but it expands the 
executable import boundary beyond the directory Airflow scans and versions as 
DAG content. The design would need to define serialization, bundle refresh 
behavior, duplicate package names across bundles, and whether workers receive 
the same root.

So I would use package installation as the supported deployment pattern today. 
If this becomes an API proposal, keeping `import_root = path` by default is 
compatible, but the security and distribution semantics need to be part of the 
contract rather than treating it as only a `sys.path` adjustment.

GitHub link: 
https://github.com/apache/airflow/discussions/70313#discussioncomment-18148545

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: [email protected]

Reply via email to