virtualfish icon indicating copy to clipboard operation
virtualfish copied to clipboard

Make it possible to activate venvs outside VIRTUALFISH_HOME

Open urxvtcd opened this issue 2 years ago • 3 comments

#223 I took a stab at it. Let me know what you think. Hopefully this doesn't break anything :smile:

urxvtcd avatar Feb 02 '23 17:02 urxvtcd

No worries, my branch has served my needs well, and I underdstand you're doing this basically for free, no need to apologize :)

Your suggestions seem pretty neat. If you're not in a hurry I'll try to take a stab at them in few days, as lately I've been more busy than usual.

urxvtcd avatar Oct 22 '23 21:10 urxvtcd

Sorry for the delay. I incorporated your suggestions. The logic is encapsulated in the new function. Now it's possible to activate virtualenvs inside $VIRTUALFISH_HOME, and in directiories pointed by absolute and relative paths, including those directly in $PWD (no slashes required). To sum up, the following work, and do what one would expect:

vf activate ./venv
vf activate /home/projects/foo/.venv
vf activate .
vf activate ../venv/

One thing I'm slightly concerned about is activating a virtualenv in $PWD as a security issue, but since $VIRTUALFISH_HOME is checked before the $PWD, I don't think this is a real problem.

If you have any further comments, I'll be happy to address them, with smaller latency this time I hope, haha.

urxvtcd avatar Nov 23 '23 12:11 urxvtcd

I noticed that the feature doesn't play well with paths containing spaces. From what I understand, fixing that would require making some changes to the vf function. I might look into that.

urxvtcd avatar Nov 23 '23 13:11 urxvtcd