Skip to content
Utility functions for writing pythonic emacs package.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
README.markdown
pythonic.el

README.markdown

Pythonic MELPA MELPA Stable

Utility functions for writing pythonic emacs package.

Installation

You can install this package form Melpa

M-x package-install RET pythonic RET

Usage

This library provide function for convenient running python on different platforms on local and remote hosts including Docker containers and Vagrant virtual machines. To use pythonic with Docker you need to install docker-tramp Emacs package.

You can use remote interpreter from the tramp buffer.

(cd "/ssh:user@host:/home/user/")
;; or
(cd "/docker:root@container:/root/")

Functions

pythonic-call-process

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.

(pythonic-call-process :buffer "*Pythonic*"
                       :args '("-V")
                       :cwd "~")

pythonic-start-process

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.

(pythonic-start-process :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)

pythonic-remote-p

Determine remote or local virtual environment.

(pythonic-remote-p)

pythonic-remote-docker-p

Determine docker remote virtual environment.

(pythonic-remote-docker-p)

pythonic-remote-vagrant-p

Determine vagrant remote virtual environment.

(pythonic-remote-vagrant-p)

pythonic-remote-user

Get user of the connection to the remote python interpreter.

(pythonic-remote-user)

pythonic-remote-host

Get host of the connection to the remote python interpreter.

(pythonic-remote-host)

pythonic-remote-port

Get port of the connection to the remote python interpreter.

(pythonic-remote-port)

Commands

pythonic-activate

Activate python virtual environment. Tramp paths are supported.

pythonic-deactivate

Deactivate python virtual environment.

Project settings

You can change the default docker-compose file name and set a default service name to run the pythonic commands.

Add these lines to the .dir-locals.el file in the project root directory.

((python . ((pythonic-docker-compose-filename . "local.yml")
            (pythonic-docker-compose-service-name . "web"))))
You can’t perform that action at this time.