Skip to content

Keep same-prefix packages in external dependency output - #290

Merged
thebjorn merged 1 commit into
thebjorn:masterfrom
charan-rathore:fix/external-same-prefix
Oct 1, 2026
Merged

thebjorn merged 1 commit into
thebjorn:masterfrom
charan-rathore:fix/external-same-prefix

Conversation

@charan-rathore

Copy link
Copy Markdown
Contributor

Closes #146.

pydeps --externals foo drops foobar because the external dependency scan treats every name starting with foo as internal. The same check also lets sources from foobar contribute their imports as if they belonged to foo.

Match the target package itself or its dotted submodules in both checks. This keeps foobar external while leaving foo.internal internal, and keeps the result limited to direct imports from the target.

Tests use actual temporary packages and module discovery:

  • A foo package importing foobar.b now lists foobar.
  • When foobar.b imports baz, output still contains only foobar; an internal foo.internal import stays excluded.

Validation on Python 3.12.14/Linux:

  • New owning tests fail on the unmodified base: 2 failed, 2 passed.
  • Patched owning suite: 4 passed.
  • Full suite: 87 passed, 2 skipped.
  • Changed production file passes Flake8 with the CI line-length setting.
  • Sphinx HTML and nitpicky man builds pass with warnings treated as errors.

@thebjorn
thebjorn merged commit 9a2180f into thebjorn:master Oct 1, 2026
12 checks passed
@thebjorn

thebjorn commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Thanks!

@thebjorn

thebjorn commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Included in v3.0.9 out soon.

@charan-rathore
charan-rathore deleted the fix/external-same-prefix branch October 1, 2026 16:15
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.

externals are excluding dependencies withth same prefix as the source module

2 participants