2018-07-17 20:57:32 +02:00
|
|
|
;;; lang/python/autoload/python.el -*- lexical-binding: t; -*-
|
2017-03-04 18:46:38 -05:00
|
|
|
|
|
|
|
;;;###autoload
|
2019-02-18 01:56:38 -05:00
|
|
|
(defun +python/open-repl ()
|
2017-03-04 18:46:38 -05:00
|
|
|
"Open the Python REPL."
|
2017-03-19 22:50:52 -04:00
|
|
|
(interactive)
|
2018-10-02 23:52:29 -04:00
|
|
|
(unless python-shell-interpreter
|
|
|
|
(user-error "`python-shell-interpreter' isn't set"))
|
2018-09-26 20:37:35 -04:00
|
|
|
(pop-to-buffer
|
|
|
|
(process-buffer
|
2018-10-02 23:52:29 -04:00
|
|
|
(if-let* ((pipenv (executable-find "pipenv"))
|
|
|
|
(pipenv-project (pipenv-project-p)))
|
|
|
|
(let ((default-directory pipenv-project)
|
|
|
|
(python-shell-interpreter-args
|
|
|
|
(format "run %s %s"
|
|
|
|
python-shell-interpreter
|
|
|
|
python-shell-interpreter-args))
|
|
|
|
(python-shell-interpreter pipenv))
|
|
|
|
(run-python nil t t))
|
|
|
|
(run-python nil t t)))))
|
2018-07-31 14:02:34 +02:00
|
|
|
|
2018-10-06 00:24:44 -04:00
|
|
|
;;;###autoload
|
|
|
|
(defun +python/open-ipython-repl ()
|
|
|
|
"Open an IPython REPL."
|
|
|
|
(interactive)
|
|
|
|
(let ((python-shell-interpreter "ipython")
|
2019-02-28 04:10:35 -05:00
|
|
|
(python-shell-interpreter-args (string-join +python-ipython-repl-args " ")))
|
2019-02-18 01:56:38 -05:00
|
|
|
(+python/open-repl)))
|
2018-10-06 00:24:44 -04:00
|
|
|
|
|
|
|
;;;###autoload
|
|
|
|
(defun +python/open-jupyter-repl ()
|
|
|
|
"Open a Jupyter console."
|
|
|
|
(interactive)
|
|
|
|
(add-to-list 'python-shell-completion-native-disabled-interpreters "jupyter")
|
|
|
|
(let ((python-shell-interpreter "jupyter")
|
2019-02-28 04:10:35 -05:00
|
|
|
(python-shell-interpreter-args (format "console %s" (string-join +python-jupyter-repl-args " "))))
|
2019-02-18 01:56:38 -05:00
|
|
|
(+python/open-repl)))
|