You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Extending the PATH of the original virtualenv into pre-commit's virtualenv #181
I seem to have boiled the problem down to the fact that when the hook is running in pre-commit's virtualenv it doesn't have access to the PATH of the original virtualenv so it won't know which packages are third-/first-party - My troubleshooting is documented in the original issue above :)
I've noticed similarly as well. It seems isort depends a bit too much on the running environment to determine first/third-party packages/modules.
I've started a repository here which seems to do a better job of identifying imports statically, I'm hoping to either plug it into isort or write a separate thing that does a similar thing:
Ah, that's really cool. I'll look into making it a system hook if I get the time over christmas. Let me know if there's anything I can help with re: your version, I might be able to find some time :)
Activity
asottile commentedon Dec 19, 2014
I've noticed similarly as well. It seems
isortdepends a bit too much on the running environment to determine first/third-party packages/modules.I've started a repository here which seems to do a better job of identifying imports statically, I'm hoping to either plug it into isort or write a separate thing that does a similar thing:
http://github.com/asottile/aspy.refactor_imports
I actually plan to work on this in the next coming weeks.
But yes the idea that the virtualenvs are isolated is by design, you can work around this by making a
systemtype hook.dinoshauer commentedon Dec 22, 2014
Ah, that's really cool. I'll look into making it a
systemhook if I get the time over christmas. Let me know if there's anything I can help with re: your version, I might be able to find some time :)asottile commentedon Jan 2, 2015
@dinoshauer I've started working on it here: https://github.com/asottile/reorder_python_imports
From what I can tell it works pretty well? Mind poking around with it and see if it works for you?
dinoshauer commentedon Jan 2, 2015
@asottile I'll check it out and get back to you :)
dinoshauer commentedon Jan 2, 2015
Eureka, it works! 👍