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
Support python -m invoke
#444
Comments
Starting to suspect @pekkaklarck and @lancelote are co-workers or something 😉 This just requires a Will commit and push in a moment. Thanks! |
Thanks for adding this so fast! I don't even know @lancelote so this must be just a case of great minds thinking a like. =) Notice that on Python 2.6 you ought to be able to use |
Yea, I don't want to do extra work for 2.6 if possible, so no worries there. I just wasn't cognizant of the behavior you mention. Anyway - this change isn't on PyPI yet but will be probably by Monday, FYI. |
The current implementation of
This isn't a big deal when using invoke normally, but in some special cases being able to execute invoke directory directly can be useful. One such case is during invoke development itself when you want to test how latest code actually works. Fixing the problem ought to thus be worth the effort, especially when it only requires changing |
Only downside with that is it would break the feature for anybody who has vendored Invoke, or who is attempting to execute it before it's installed to sys.path (which, ironically, is IIRC one of the main use cases for Former case seems like not a big deal because I can't see someone using |
It's true that try:
from .main import program
except ValueError:
from invoke.main import program It's also true that generally running It would also be possible to make |
Gotcha. Also, on review, I think I was missing something when I last thought about this; the "nice, modern" EXCEPT...I just made the change, and I think we're actually still kind of screwed, unless I'm continuing to be dumb:
So...we could still make this import absolute, but I'd almost rather keep it relative so the behavior is consistently broken 🙃 either way I don't think it's going to work out terrifically well. thoughts? (tho I think I've now passed the point of diminishing returns for such an off-spec use case!) |
This sounds strange. I thought you'd only get that |
Notice also that PEP-366 linked from the aforementioned SO answer explains how it's possible to explicitly set |
Hm that is odd then. (Also, not worried about If you can put together concrete details about your setup (how you've got your checkout installed, which exact HEAD commit you're on, what's in your Here's a raw gist of my session: https://gist.githubusercontent.com/bitprophet/72237c456a9622d7aa511b80a6b0fc98/raw/fa1a54ff17d68dbddb149665bdbb4986e58451a7/gistfile1.txt |
This would make it a lot easier to use Invoke with different Python versions like
python2.7 -m invoke
orpy -3 -m invoke
. Same approach works with many other tools likepip
andpytest
.The text was updated successfully, but these errors were encountered: