Skip to content

Fix collection loader iterator for ext modules - #84758

Merged
nitzmahone merged 5 commits into
ansible:develfrom
jborean93:collection-loader-ext
Jul 14, 2026
Merged

Fix collection loader iterator for ext modules#84758
nitzmahone merged 5 commits into
ansible:develfrom
jborean93:collection-loader-ext

Conversation

@jborean93

Copy link
Copy Markdown
Contributor
SUMMARY

Fixes the collection loader iter_modules logic to return compiled Python extension modules. This loader is used when attempting to call pkgutil.iter_modules on a package that is contained inside the ansible_collections path. Before extension modules were skipped which would break imports of 3rd party modules that used compiled extensions if it was installed in a Python environment located inside a collection.

ISSUE TYPE
  • Bugfix Pull Request

@ansibot ansibot added bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Feb 27, 2025
@ansibot

ansibot commented Feb 27, 2025

Copy link
Copy Markdown
Contributor

The test ansible-test sanity --test yamllint [explain] failed with 1 error:

changelogs/fragments/collection-loader-extensions.yml:6:1: empty-lines: too many blank lines (1 > 0)

click here for bot help

@ansibot ansibot removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Feb 27, 2025
@sivel sivel removed the needs_triage Needs a first human triage before being processed. label Mar 4, 2025
@sivel
sivel requested review from nitzmahone and sivel March 4, 2025 15:31
Comment thread test/integration/targets/collection_loader/aliases Outdated
@ansibot ansibot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Mar 5, 2025
Comment thread lib/ansible/utils/collection_loader/_collection_finder.py Outdated
@webknjaz

webknjaz commented Mar 6, 2025

Copy link
Copy Markdown
Member

Plz, rebase to absorb the F41/F40 fix from #84785.

@webknjaz webknjaz added the ci_verified Changes made in this PR are causing tests to fail. label Mar 6, 2025
@mattclay

mattclay commented Mar 6, 2025

Copy link
Copy Markdown
Member

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@mattclay

mattclay commented Mar 6, 2025

Copy link
Copy Markdown
Member

There's no need to rebase the PR to pick up the fix. Using /azp run will result in a rebase when CI runs, and the PR will be rebased when it's merged.

@ansibot ansibot removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. ci_verified Changes made in this PR are causing tests to fail. labels Mar 6, 2025
@webknjaz

webknjaz commented Mar 7, 2025

Copy link
Copy Markdown
Member

There's no need to rebase the PR to pick up the fix. Using /azp run will result in a rebase when CI runs, and the PR will be rebased when it's merged.

Is that different from just restarting the failing job? Because I did that before posting the comment and expected that it'd work the same but it didn't.

@mattclay

mattclay commented Mar 7, 2025

Copy link
Copy Markdown
Member

Is that different from just restarting the failing job? Because I did that before posting the comment and expected that it'd work the same but it didn't.

Yes, unlike /azp run, restarting failed jobs will not bring in commits added after the original job ran.

@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Mar 14, 2025
@ansibot ansibot added the needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html label Apr 15, 2025
@jborean93
jborean93 force-pushed the collection-loader-ext branch from 68d65a7 to ab9cfe9 Compare September 8, 2025 18:55
@ansibot ansibot removed needs_rebase https://docs.ansible.com/ansible/devel/dev_guide/developing_rebasing.html stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Sep 8, 2025
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Sep 22, 2025
Fixes the collection loader iter_modules logic to return compiled Python
extension modules. This loader is used when attempting to call
`pkgutil.iter_modules` on a package that is contained inside the
`ansible_collections` path. Before extension modules were skipped which
would break imports of 3rd party modules that used compiled extensions
if it was installed in a Python environment located inside a collection.
jborean93 and others added 2 commits July 13, 2026 10:05
Co-authored-by: 🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко) <wk.cvs.github@sydorenko.org.ua>
@jborean93
jborean93 force-pushed the collection-loader-ext branch from ab9cfe9 to b03695d Compare July 13, 2026 00:05
@ansibot ansibot removed the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Jul 13, 2026
@nitzmahone
nitzmahone merged commit db1e22f into ansible:devel Jul 14, 2026
85 checks passed
@jborean93
jborean93 deleted the collection-loader-ext branch July 14, 2026 19:33
@jborean93

Copy link
Copy Markdown
Contributor Author

@ansible ansible locked as resolved and limited conversation to collaborators Jul 29, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

bug This issue/PR relates to a bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants