Skip to content

Make --ignore-missing-imports less strict - #5228

Merged
ilevkivskyi merged 4 commits into
python:masterfrom
ilevkivskyi:fix-missing-imports
Jun 21, 2018
Merged

ilevkivskyi merged 4 commits into
python:masterfrom
ilevkivskyi:fix-missing-imports

Conversation

@ilevkivskyi

@ilevkivskyi ilevkivskyi commented Jun 17, 2018 •

Copy link
Copy Markdown
Member

Fixes #5226

Currently, import existing_package.non_existing_mod (with --ignore-missing-imports) allows subsequent

from existing_package import non_existing_mod
x = non_existing_mod.f()

but doesn't allow a direct call

x = existing_package.non_existing_mod.f()

With this change both are allowed. This doesn't solve the problem of partial packages, but makes --ignore-missing-imports more consistent with the flag name IMO.

@JukkaL JukkaL left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Looks good to me. This makes import semantics across different forms of imports more consistent and predictable.

Have you verified that doesn't break anything in internal Dropbox codebases?

@ilevkivskyi

Copy link
Copy Markdown
Member Author

Have you verified that doesn't break anything in internal Dropbox codebases?

Not yet, I will check this in next few hours, I will merge if testpr passes.

@gvanrossum

gvanrossum commented Jun 18, 2018 via email

Copy link
Copy Markdown
Member

@ilevkivskyi ilevkivskyi changed the title Fix missing imports Make --ignore-missing-imports less strict Jun 18, 2018

@emmatyping emmatyping left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@msullivan

Copy link
Copy Markdown
Collaborator

Is there any documentation that should be updated along with this?

@ilevkivskyi

Copy link
Copy Markdown
Member Author

Is there any documentation that should be updated along with this?

This is a good idea, I will add some docs.

@ilevkivskyi

Copy link
Copy Markdown
Member Author

I was finally able to check, this passes testpr.

@ilevkivskyi
ilevkivskyi merged commit 4026cb8 into python:master Jun 21, 2018
@ilevkivskyi
ilevkivskyi deleted the fix-missing-imports branch June 21, 2018 23:47
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.

5 participants