Skip to content

feat: Add exclusion of modules during import time#242

Open
Czaki wants to merge 3 commits intothebjorn:masterfrom
Czaki:exclude_imports
Open

feat: Add exclusion of modules during import time#242
Czaki wants to merge 3 commits intothebjorn:masterfrom
Czaki:exclude_imports

Conversation

@Czaki
Copy link
Contributor

@Czaki Czaki commented Jan 21, 2026

Based on my analysis of the project, the import of the module that is excluded is obsolete. And breaking import on such a module speeds up the run of the program and allows avoiding RecursionError.


Note

Introduces pattern-based module exclusion in dependency discovery.

  • Adds Excluder using glob patterns (compiled to regex) with caching to determine excluded module names
  • MyModuleFinder now initializes an Excluder from excludes and aborts loads in load_module by raising ImportError for excluded modules
  • Wires existing exclude list through py2dep to MyModuleFinder; minor formatting/whitespace tweaks in py2depgraph.py

Written by Cursor Bugbot for commit 020bd6c. This will update automatically on new commits. Configure here.

@codecov-commenter
Copy link

codecov-commenter commented Jan 21, 2026

Codecov Report

❌ Patch coverage is 88.88889% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.86%. Comparing base (3234a8b) to head (020bd6c).

Files with missing lines Patch % Lines
pydeps/py2depgraph.py 88.88% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #242      +/-   ##
==========================================
+ Coverage   73.72%   73.86%   +0.14%     
==========================================
  Files          19       19              
  Lines        1926     1944      +18     
  Branches      359      363       +4     
==========================================
+ Hits         1420     1436      +16     
- Misses        399      400       +1     
- Partials      107      108       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

This PR is being reviewed by Cursor Bugbot

Details

Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.

To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.

@thebjorn
Copy link
Owner

Can you write a testcase that hits the excluded cache (https://app.codecov.io/gh/thebjorn/pydeps/pull/242?src=pr&el=tree#9bb30ac481a77ac543d7347a8122083e-R91)?

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.

3 participants