You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the nice piece of software. Looking around hy-shell.el, I could not find a way to pass PYTHONPATH to the inferior process --- without a global setenv I guess, which I'd like to avoid since I have other REPLs running. Can you confirm if that's the case? I may simply be missing the correct configuration or required workflow.
If so, here's how I got it to work (this is on top of df81486 and hy 0.25.0):
diff --git a/hy-shell.el b/hy-shell.el
index 22927f2..104d643 100644
--- a/hy-shell.el+++ b/hy-shell.el@@ -51,6 +51,9 @@
(defvar hy-shell--redirect-timeout 0.5
"Seconds (float) to allow redirection commands to complete before quitting.")
+(defvar hy-shell-extra-pythonpaths nil+ "Extra pythonpaths, a la `python-shell-extra-pythonpaths'.")+
;;;; Managed
(defconst hy-shell--name "Hy"
@@ -136,7 +139,12 @@
(split-string-and-unquote (hy-shell--format-startup-command)))
(name
(if (hy-shell--internal?) hy-shell--name-internal hy-shell--name)))
- (apply #'make-comint-in-buffer name nil program nil switches)++ (let ((process-environment (cl-copy-list process-environment)))+ (when hy-shell-extra-pythonpaths+ (setenv "PYTHONPATH" (let ((python-shell-extra-pythonpaths hy-shell-extra-pythonpaths))+ (python-shell-calculate-pythonpath))))+ (apply #'make-comint-in-buffer name nil program nil switches))
(unless (derived-mode-p 'inferior-hy-mode)
(inferior-hy-mode))
Basically I abuse python-shell-calculate-pythonpath and override process-environment before starting the process. That way I can have a list of paths in hy-shell-extra-pythonpaths, set by dir-locals for example.
Thoughts?
The text was updated successfully, but these errors were encountered:
Hy all :)
Thanks for the nice piece of software. Looking around hy-shell.el, I could not find a way to pass PYTHONPATH to the inferior process --- without a global
setenv
I guess, which I'd like to avoid since I have other REPLs running. Can you confirm if that's the case? I may simply be missing the correct configuration or required workflow.If so, here's how I got it to work (this is on top of df81486 and hy 0.25.0):
Basically I abuse
python-shell-calculate-pythonpath
and overrideprocess-environment
before starting the process. That way I can have a list of paths inhy-shell-extra-pythonpaths
, set by dir-locals for example.Thoughts?
The text was updated successfully, but these errors were encountered: