Utility functions for writing pythonic emacs package.
You can install this package form Melpa:
M-x package-install RET pythonic RET
This library provide function for convenient running python on
different platforms on local and remote hosts including Docker
containers. To use pythonic
with Docker you need to install
docker-tramp Emacs package.
You can use remote interpreter
(setq python-shell-interpreter "/ssh:user@host:/usr/bin/python")
;; or
(setq python-shell-interpreter "/docker:root@container:/usr/bin/python")
You can use remote virtual environment
(setq python-shell-virtualenv-root "/ssh:user@host:env")
;; or
(setq python-shell-virtualenv-root "/docker:root@container:/src/app/env")
python-shell-exec-path
and python-shell-process-environment
will be translated to remote host too.
Pythonic wrapper around call-process
.
FILE is the input file. BUFFER is the output destination. DISPLAY
specifies to redisplay BUFFER on new output. ARGS is the list of
arguments passed to call-process
. CWD will be working directory
for running process.
(call-pythonic :buffer "*Pythonic*"
:args '("-V")
:cwd "~")
Pythonic wrapper around start-process
.
PROCESS is a name of the created process. BUFFER is a output
destination. ARGS are the list of args passed to start-process
.
CWD will be working directory for running process. FILTER must be a
symbol of process filter function if necessary. SENTINEL must be a
symbol of process sentinel function if necessary. QUERY-ON-EXIT will
be corresponding process flag.
(start-pythonic :process "pythonic"
:buffer "*Pythonic*"
:args '("-c" "print('PING')")
:cwd "~"
:filter (lambda (process output) (message output))
:sentinel (lambda (process event) (message "Done."))
:query-on-exit nil)
Determine if python environment has been changed since PROCESS was started.
(pythonic-proper-environment-p
(start-pythonic
:process "pythonic"
:args '("-V")))
Determine remote or local virtual environment.
(pythonic-remote-p)
Determine docker remote virtual environment.
(pythonic-remote-docker-p)
Determine vagrant remote virtual environment.
(pythonic-remote-vagrant-p)
Get user of the connection to the remote python interpreter.
(pythonic-remote-user)
Get host of the connection to the remote python interpreter.
(pythonic-remote-host)
Get port of the connection to the remote python interpreter.
(pythonic-remote-port)
Activate python virtual environment. Tramp paths are supported.
Deactivate python virtual environment.