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
Add home directory expansion to IPYTHON_DIR environment variables. #464
Conversation
IPYTHONDIR, check for a leading '~' (e.g. '~/myspecialipythondir/') and expand appropriately.
I don't think the |
Good point. I was thinking an unnecessary expanduser call might be worth avoiding, but it's negligible. I'll update. |
In fact, looking at the code, the first thing expanduser does is a Also, can you add a test for this case? Have a look at the tests already in IPython/utils/tests/test_path.py: it should be easy to copy and tweak one. |
…g path.get_home_dir, and test_get_ipython_dir_5 depended on test_get_ipython_dir_4 having run just before it without restoring path.get_home_dir
Ok, that should do it. I cleaned things up a bit and found a bug in test_path.py. It didn't seem like those were big enough to file a separate pull request, but let me know if I went too far. |
That's fine - thanks for finding it. I might have done the cleanup in a separate pull request, because it makes it hard to see what code is actually changed, but it's there now, so we'll go with it. A couple of minor things:
|
You're right, |
OK, then that all looks good to me. I'll test it later, unless someone else beats me to it. |
@wilsaj thanks for the fix, but in the future please don't ever include 'cleanup' of whitespace or enforcing pep8's ludicrous line-length limit as part of a pull request that actually does something. |
…leanup" This reverts commit ea440c9.
Sorry about that. I didn't mean to offend. |
@wilsaj - no offense taken, I just get unnecessarily peeved with pep8 sometimes. The only real reason is that the diff gets harder to read when it's full of changes that have no effect, and whitespace fixes reduce the effectiveness of tools like |
For me, pep8 makes it slightly easier to visually parse code that I'm not familiar with. So I thought there was some value in nudging things in that direction while I had these files open. I didn't realize that it would trash the history in some ways. Does a git revert fix those problems? If you merge --squash the branch, the whitespace/pep8 changes go away and git blame is clean again. But maybe you don't want to do that. I can make another branch/pull request if you'd prefer. |
No, it's not a big enough deal to make any changes here, just for future reference. If this were really interesting, delicate code I might ask for rolling back the commit, but that's not the case with the path files. I think this is fine for merge, if @takluver says it works. |
Test passes, code looks sensible. Go for it. |
Just a heads up: I already committed a revert of the whitespace and pep8 stuff, so if you pull and merge each individual change (without rebase or squash), you get the trashed git blame and none of the cleanup. |
Rebased, squashed, and merged. Thanks again. |
If you set IPYTHON_DIR to '
/something/' then run ipython, a '/something/' directory is created in whatever path you've called ipython from, which is probably not the expected behavior for most people.