wyuenho / emacs-pet

Tracks down the correct Python tooling executables from your virtualenvs so you can glue the binaries to Emacs and delete code in init.el
GNU General Public License v3.0
105 stars 13 forks source link

Virtualenv is not detected when it is directly in the root directory #30

Closed reinout closed 3 months ago

reinout commented 9 months ago

Description

I normally create my virtualenvs with python3 -m venv ., this places the bin/ and lib/ directly inside the project root. Handy, as you now have bin/pip and don't have to do venv/bin/pip.

PET doesn't detect this. It looks for venv/ or .venv/ in the project root. Granted, those directories are recommended in the python documentation, but I think I see the .-method quite a lot. At least in the projects inside my company :-)

Reproduction steps

Expected behavior I expected python-shell-interpreter to be the bin/python inside the project dir. After reading the PET lisp code, I discovered that PET looks for venv/env/.env. Creating the virtualenv with python3 -m venv venv made everything work like a charm.

Versions PET 20230906.46, emacs 29.1 on osx (but those details won't matter I guess)

Possible solutions

I think it is perfectly OK to require the virtualenv to be in venv/env/.venv. The detection mechanism might be hard to get right otherwise, I fear. If that is indeed the case, an short addition to the README (noting that the virtualenv has to be in venv/env/.venv) might be handy.

wyuenho commented 4 months ago

Does adding "." to this defcustom solve your problem?

wyuenho commented 3 months ago

I'm closing this as solved as there's a defcustom for many months.