Skip to content

feat(imports): ignore files using inline script metadata#1546

Draft
mkniewallner wants to merge 1 commit intomainfrom
feat/ignore-inline-script-metadata-files
Draft

feat(imports): ignore files using inline script metadata#1546
mkniewallner wants to merge 1 commit intomainfrom
feat/ignore-inline-script-metadata-files

Conversation

@mkniewallner
Copy link
Copy Markdown
Member

@mkniewallner mkniewallner commented Apr 4, 2026

Closes #1080.

PR Checklist

  • A description of the changes is added to the description of this PR.
  • If there is a related issue, make sure it is linked to this PR.
  • If you've fixed a bug or added code that should be tested, add tests!
  • If you've added or modified a feature, documentation in docs is updated

TODO:

  • Update documentation to mention that files using inline script metadata are ignored
  • Add unit tests for regex parsing

Description of changes

Currently, deptry reads imports from Python files that use inline script metadata (also known as PEP 723). Since those files are self-contained, imports in there should not be considered as being part of the project, so they should be ignored.

Note that an issue exists for deptry to actually support inline script metadata (#1043), but even if this was to be implemented at some point, we would likely skip the imports for the main project the same way.

@mkniewallner mkniewallner force-pushed the feat/ignore-inline-script-metadata-files branch from 5869af7 to 53ea26e Compare April 4, 2026 23:03
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@mkniewallner mkniewallner force-pushed the feat/ignore-inline-script-metadata-files branch 2 times, most recently from 6ce6fdf to 33a321b Compare April 6, 2026 08:35
@mkniewallner mkniewallner force-pushed the feat/ignore-inline-script-metadata-files branch from 33a321b to 7252d60 Compare April 6, 2026 08:45
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.

Ignore files using PEP 723 syntax

1 participant