This is an emacs & magit version of the following question, with an added twist.
The self-answer there (by Mehdi) also works for me: just start emacs as a subprocess of poetry (with
poetry run emacs -nw or similar) and poetry will set up the PATH which emacs inherits, and everything works fine.
The twist is that I also want to work with remote repos, via tramp. Understandably, poetry knows nothing about emacs and tramp, so although magit itself magitally works over tramp, my pre-commit hooks which are managed by poetry do not work.