Skip to content

Import Scanning: Split raw import extraction from import resolution#212

Merged
seddonym merged 1 commit intopython-grimp:masterfrom
Peter554:refactor-import-scanner
May 2, 2025
Merged

Import Scanning: Split raw import extraction from import resolution#212
seddonym merged 1 commit intopython-grimp:masterfrom
Peter554:refactor-import-scanner

Conversation

@Peter554
Copy link
Collaborator

@Peter554 Peter554 commented May 1, 2025

This PR contains a pre-factor to integrating https://github.com/Peter554/pyimportparse into grimp.

This PR separates raw imported object parsing from the import resolution. This will then allow us to replace the raw imported object parsing part with pyimportparse (we can move the import resolution part over to rust in later work).

@Peter554 Peter554 marked this pull request as ready for review May 1, 2025 19:33
@codspeed-hq
Copy link

codspeed-hq bot commented May 1, 2025

CodSpeed Instrumentation Performance Report

Merging #212 will not alter performance

Comparing Peter554:refactor-import-scanner (def3ec1) with master (e6961e3)

Summary

✅ 22 untouched benchmarks

Comment on lines 51 to 58
try:
ast_tree = ast.parse(module_contents)
imported_objects = self._get_raw_imported_objects(module_contents)
except SyntaxError as e:
raise exceptions.SourceSyntaxError(
filename=module_filename,
lineno=e.lineno,
text=e.text,
)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@seddonym This is the part that https://github.com/Peter554/pyimportparse could replace.

Copy link
Collaborator

@seddonym seddonym 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 this!

@seddonym seddonym merged commit 89c661c into python-grimp:master May 2, 2025
18 checks passed
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.

2 participants