Skip to content

Comments

fix: add --no-dags-base-dir flag for Airflow 3 DAG bundle compatibility#2001

Merged
jeremybeard merged 3 commits intoastronomer:mainfrom
tayloramurphy:tayloramurphy/clarify-cli-vs-app-issue
Feb 6, 2026
Merged

fix: add --no-dags-base-dir flag for Airflow 3 DAG bundle compatibility#2001
jeremybeard merged 3 commits intoastronomer:mainfrom
tayloramurphy:tayloramurphy/clarify-cli-vs-app-issue

Conversation

@tayloramurphy
Copy link
Contributor

@tayloramurphy tayloramurphy commented Jan 27, 2026

Summary

  • Adds --no-dags-base-dir flag to astro deploy --dags for Airflow 3.x compatibility
  • By default, DAG bundles include the dags/ directory prefix (existing behavior)
  • With --no-dags-base-dir, DAG files are placed at the bundle root

Usage

# Default (backward compatible)
astro deploy --dags

# For Airflow 3.x deployments
astro deploy --dags --no-dags-base-dir

Context

Airflow 3 changed the DAG processor to add the bundle root to sys.path instead of the dags/ folder. This caused imports from shared modules in the dags/ directory to fail for DAG-only deploys.

This flag gives users explicit control over the bundle layout without changing default behavior.

Fixes #1985

Adds opt-in flag to exclude the dags/ directory prefix from DAG bundles.
This is needed for Airflow 3.x where sys.path includes the bundle root,
causing imports from shared modules in dags/ to fail.

Usage: astro deploy --dags --no-dags-base-dir

Fixes astronomer#1985
@tayloramurphy tayloramurphy force-pushed the tayloramurphy/clarify-cli-vs-app-issue branch from 8cec072 to 06d95af Compare February 6, 2026 20:41
@tayloramurphy tayloramurphy requested a review from a team as a code owner February 6, 2026 20:41
@tayloramurphy tayloramurphy changed the title fix: adjust DAG bundle structure for Airflow 3 sys.path change fix: add --no-dags-base-dir flag for Airflow 3 DAG bundle compatibility Feb 6, 2026
})
}

func TestDeployDagsBundleLayout(t *testing.T) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really just testing that the negation operator still works but I guess you can never be too careful

@jeremybeard jeremybeard merged commit 6c20272 into astronomer:main Feb 6, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DAG folder not on python path in airflow 3.1

2 participants