Skip to content

Stop docs builds from importing example Dags to highlight them - #73604

Merged
amoghrajesh merged 1 commit into
apache:mainfrom
astronomer:fix-example-include
Sep 24, 2026
Merged

amoghrajesh merged 1 commit into
apache:mainfrom
astronomer:fix-example-include

Conversation

@amoghrajesh

Copy link
Copy Markdown
Contributor

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Sphinx's ModuleAnalyzer.for_module() locates a module's source by importing it. The examples rendered by the exampleinclude directive live in providertests/system trees that are not / should not be importable during a docs build.

Noticed this error earlier today on #70960

Module "system.ibm.mq.example_dag_message_queue_trigger" could not be loaded.
Full source will not be available.
...
  File "/opt/airflow/devel-common/src/sphinx_exts/exampleinclude.py", line 150, in register_source
    analyzer = ModuleAnalyzer.for_module(modname)
...
ModuleNotFoundError: No module named 'system.ibm'

The import buys nothing here: doctree_read already knows the file on disk, and Sphinx offers for_file() to tokenize it directly.

Ref: https://github.com/sphinx-doc/sphinx/blob/b04a2101295ac3fb725b16111eda0284b6da4cca/sphinx/pycode/__init__.py#L89-L103

Tested it works fine after doc build:

image
  • Read the Pull Request Guidelines for more information. Note: commit author/co-author name and email in commits become permanently public when merged.
  • For fundamental code changes, an Airflow Improvement Proposal (AIP) is needed.
  • When adding dependency, check compliance with the ASF 3rd Party License Policy.
  • For significant user-facing changes create newsfragment: {pr_number}.significant.rst, in airflow-core/newsfragments. You can add this file in a follow-up commit after the PR is created so you know the PR number.

@amoghrajesh
amoghrajesh requested a review from ashb September 23, 2026 09:57
@amoghrajesh amoghrajesh self-assigned this Sep 23, 2026
@amoghrajesh
amoghrajesh requested a review from potiuk September 23, 2026 09:57

@ashb ashb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Sounds sensible if it works. Thanks!

@amoghrajesh

Copy link
Copy Markdown
Contributor Author

Alright rebased, lets see how it goes.

@ashb
ashb force-pushed the fix-example-include branch from eeeac49 to 0184af0 Compare September 23, 2026 16:34

@potiuk potiuk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yeah... if works. :)

@amoghrajesh

Copy link
Copy Markdown
Contributor Author

Guess it does. Merging

@amoghrajesh
amoghrajesh merged commit 74d1a3b into apache:main Sep 24, 2026
155 checks passed
@amoghrajesh
amoghrajesh deleted the fix-example-include branch September 24, 2026 01:03
@github-actions github-actions Bot added this to the Airflow 3.3.3 milestone Sep 24, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hi maintainer, this PR was merged without a milestone set.
We've automatically set the milestone to Airflow 3.3.3 based on: backport label targeting v3-3-test
If this milestone is not correct, please update it to the appropriate milestone.

This comment was generated by Milestone Tag Assistant.

@github-actions

Copy link
Copy Markdown
Contributor

Backport successfully created: v3-3-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
✅ v3-3-test PR Link

github-actions Bot pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Sep 24, 2026
… them (apache#73604)

(cherry picked from commit 74d1a3b)

Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
aws-airflow-bot pushed a commit to aws-mwaa/upstream-to-airflow that referenced this pull request Sep 24, 2026
… them (apache#73604)

(cherry picked from commit 74d1a3b)

Co-authored-by: Amogh Desai <amoghrajesh1999@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-to-v3-3-test Backport to v3-3-test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants