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

Use imp.find_module to get module info #184

Closed
asottile opened this issue Sep 25, 2014 · 1 comment
Closed

Use imp.find_module to get module info #184

asottile opened this issue Sep 25, 2014 · 1 comment

Comments

@asottile
Copy link
Member

I've noticed you've written a thing that iterates prefix entries. imp.find_module is potentially a better / more-accurate source of truth (especially when .pth shenanigans are involved). I've also noticed that your module seems to prefer "application" classification when running in an isolated virtualenv, not sure if that's related or not.

Similar code from my implementation before finding yours (ugh google why do you fail me):

https://github.com/asottile/aspy.refactor_imports/blob/master/aspy/refactor_imports/classify.py#L29-L62

@timothycrosley
Copy link
Member

Hi @asottile,

Thanks so much for providing your input. I like that implementation, but unfortunately cannot use it as it goes against one of isort's current design goals (portability), currently a lot of users install isort as a binary tool once running on Python2 or 3 and then run it against code using both versions, if imp.find_module is used it will fail in several cases because isort is running against Python 2 code but itself running on Python 3 or vice versa.

Thanks!

~Timothy Crosley

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

No branches or pull requests

2 participants