Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support imports using importlib.import_module #782

Merged
merged 21 commits into from
Jul 29, 2024
Merged

Conversation

lmmx
Copy link
Contributor

@lmmx lmmx commented Jul 27, 2024

Commits:

  • test: add coverage for dynamic import with importlib
  • feat(WIP): attempt to get importlib imports
  • test: add test coverage for both importlib formats
  • feat: also handle case where importlib.import_module is aliased
  • refactor: consolidate proof of concept test into existing test
  • refactor(clippy): collapse nested if let statements in Stmt::Expr match arm
  • docs: note which sort of importlib import are supported

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

Description of changes

@lmmx lmmx changed the title main Support imports using importlib.import_module Jul 27, 2024
@lmmx
Copy link
Contributor Author

lmmx commented Jul 27, 2024

Added extra tests and made sure it works with all possible ways of aliasing the importlib.import_module import

Ready for review @mkniewallner 😃

docs/usage.md Outdated Show resolved Hide resolved
src/visitor.rs Outdated Show resolved Hide resolved
Copy link

codecov bot commented Jul 27, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.0%. Comparing base (355292c) to head (cb79798).

Additional details and impacted files
@@          Coverage Diff          @@
##            main    #782   +/-   ##
=====================================
  Coverage   93.0%   93.0%           
=====================================
  Files         37      37           
  Lines        961     961           
  Branches     173     173           
=====================================
  Hits         894     894           
  Misses        51      51           
  Partials      16      16           

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

docs/usage.md Outdated Show resolved Hide resolved
docs/usage.md Outdated Show resolved Hide resolved
docs/usage.md Outdated Show resolved Hide resolved
docs/usage.md Outdated Show resolved Hide resolved
@lmmx
Copy link
Contributor Author

lmmx commented Jul 27, 2024

Thanks for the review @mkniewallner and @fpgmaas, refactors and nits addressed. I hope these new docstrings are sufficiently clear, but any further feedback welcome 😄

@fpgmaas fpgmaas self-requested a review July 29, 2024 08:13
Copy link
Collaborator

@mkniewallner mkniewallner left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!

@mkniewallner mkniewallner merged commit 722313a into fpgmaas:main Jul 29, 2024
22 checks passed
@mkniewallner mkniewallner linked an issue Jul 30, 2024 that may be closed by this pull request
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.

Dependencies with importlib.import_module are not detected
3 participants