Skip to content

Bundle root should be added to import path #49838

@gbonazzoli

Description

@gbonazzoli

Apache Airflow version

3.0.0

If "Other Airflow 2 version" selected, which one?

No response

What happened?

If you define a DAG in a git repository and this DAG has to import an internal modules, in my case named Utility:

from Utility.VMwareUtils import vCenter

Airflow gives this error:

Image

The same code works in a normal "dags" directory.

The configuration in airflow.cfg is:

dag_bundle_config_list = [
      {
        "name": "git_repo_dags_veeam",
        "classpath": "airflow.providers.git.bundles.git.GitDagBundle",
        "kwargs": {"tracking_ref": "main", "git_conn_id": "dags_veeam", "refresh_interval": 60}
      }
    ]

What you think should happen instead?

It has to work in the same classical way. Probably it is only a matter to change the default directory from with the Python interpreter execute the code.

How to reproduce

Under a git repository:

  • create a directory named Utility
  • create a python file named Utility/pippo.py containing a class or function definition
  • create a puthon file for a new DAG and import the function defined in Utility/pippo.py

BANG !

Operating System

Ubuntu 24.04.2 LTS

Versions of Apache Airflow Providers

apache-airflow-providers-celery==3.10.6
apache-airflow-providers-common-compat==1.6.0
apache-airflow-providers-common-io==1.5.4
apache-airflow-providers-common-sql==1.26.0
apache-airflow-providers-git==0.0.2
apache-airflow-providers-postgres==6.1.3
apache-airflow-providers-redis==4.0.2
apache-airflow-providers-smtp==2.0.3
apache-airflow-providers-ssh==4.0.1
apache-airflow-providers-standard==1.0.0

Deployment

Virtualenv installation

Deployment details

Nothing special, vanilla Airflow 3.0.0 in a vanilla Ubuntu 24.04 LXD container

Anything else?

no

Are you willing to submit PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions