Skip to content

Include is_lazy in import details - #313

Draft
seddonym wants to merge 2 commits into
mainfrom
lazy-in-details
Draft

Include is_lazy in import details#313
seddonym wants to merge 2 commits into
mainfrom
lazy-in-details

Conversation

@seddonym

@seddonym seddonym commented Aug 7, 2026

Copy link
Copy Markdown
Collaborator

Prior to this, explicit lazy imports were no different from normal imports. This PR:

  • Adds an is_lazy key to the DetailedImport dict returned by get_import_details.
  • Adds an optional is_lazy argument to add_import.

Still to do

Caching

Figure out how this should work with caching.

Backward compatibility for add_import

Tweak the behaviour for add_import so it's backward-compatible.

  • It should be possible to call add_import in the old style, both with and without the old optional arguments (line_number / line_contents). If called with the optional arguments, is_lazy should be False.
  • It should be possible to call with is_lazy. It probably makes sense in that case also to require line_number / line_contents. Might be worth taking the opportunity to raise a better exception if this isn't followed.

@seddonym seddonym changed the title Lazy in details Include is_lazy in import details Aug 7, 2026
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.

1 participant