Skip to content

Use Jupyter shell command from given directory #341

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions jupyter-env.el
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,24 @@ directory is where kernel connection files are written to.
This variable should not be used. To obtain the runtime directory
call the function `jupyter-runtime-directory'.")

(defvar jupyter-command-directory nil
"The directory of the Jupyter command.
If nil then use Jupyter command from the path environment variable.

Used to run the `jupyter-command'.")

(defun jupyter-command (&rest args)
"Run a Jupyter shell command synchronously, return its output.
The shell command run is
The shell command run is (in `jupyter-command-directory')

jupyter ARGS...

If the command fails or the jupyter shell command doesn't exist,
return nil."
(with-temp-buffer
(when (zerop (apply #'process-file "jupyter" nil t nil args))
(when (zerop (apply #'process-file
(concat jupyter-command-directory "jupyter")
nil t nil args))
(string-trim-right (buffer-string)))))

(defun jupyter-runtime-directory ()
Expand Down