|
| 1 | +# Pythonic [](http://www.melpa.org/#/pythonic) [](https://stable.melpa.org/#/pythonic) |
| 2 | + |
| 3 | +Utility functions for writing pythonic emacs package. |
| 4 | + |
| 5 | +## Installation |
| 6 | + |
| 7 | +You can install this package form [Melpa](http://melpa.org) |
| 8 | + |
| 9 | + M-x package-install RET pythonic RET |
| 10 | + |
| 11 | +## Usage |
| 12 | + |
| 13 | +This library provide function for convenient running python on |
| 14 | +different platforms on local and remote hosts including Docker |
| 15 | +containers and Vagrant virtual machines. To use `pythonic` with |
| 16 | +Docker you need to install |
| 17 | +[docker-tramp](https://github.com/emacs-pe/docker-tramp.el) Emacs |
| 18 | +package. |
| 19 | + |
| 20 | +You can use remote interpreter from the tramp buffer. |
| 21 | + |
| 22 | +```lisp |
| 23 | +(cd "/ssh:user@host:/home/user/") |
| 24 | +;; or |
| 25 | +(cd "/docker:root@container:/root/") |
| 26 | +``` |
| 27 | + |
| 28 | +## Functions |
| 29 | + |
| 30 | +### pythonic-call-process |
| 31 | + |
| 32 | +Pythonic wrapper around `call-process`. |
| 33 | + |
| 34 | +FILE is the input file. BUFFER is the output destination. DISPLAY |
| 35 | +specifies to redisplay BUFFER on new output. ARGS is the list of |
| 36 | +arguments passed to `call-process`. CWD will be working directory for |
| 37 | +running process. |
| 38 | + |
| 39 | +```lisp |
| 40 | +(pythonic-call-process :buffer "*Pythonic*" |
| 41 | + :args '("-V") |
| 42 | + :cwd "~") |
| 43 | +``` |
| 44 | + |
| 45 | +### pythonic-start-process |
| 46 | + |
| 47 | +Pythonic wrapper around `start-process`. |
| 48 | + |
| 49 | +PROCESS is a name of the created process. BUFFER is a output |
| 50 | +destination. ARGS are the list of args passed to `start-process`. CWD |
| 51 | +will be working directory for running process. FILTER must be a |
| 52 | +symbol of process filter function if necessary. SENTINEL must be a |
| 53 | +symbol of process sentinel function if necessary. QUERY-ON-EXIT will |
| 54 | +be corresponding process flag. |
| 55 | + |
| 56 | +```lisp |
| 57 | +(pythonic-start-process :process "pythonic" |
| 58 | + :buffer "*Pythonic*" |
| 59 | + :args '("-c" "print('PING')") |
| 60 | + :cwd "~" |
| 61 | + :filter (lambda (process output) (message output)) |
| 62 | + :sentinel (lambda (process event) (message "Done.")) |
| 63 | + :query-on-exit nil) |
| 64 | +``` |
| 65 | + |
| 66 | +### pythonic-remote-p |
| 67 | + |
| 68 | +Determine remote or local virtual environment. |
| 69 | + |
| 70 | +```lisp |
| 71 | +(pythonic-remote-p) |
| 72 | +``` |
| 73 | + |
| 74 | +### pythonic-remote-docker-p |
| 75 | + |
| 76 | +Determine docker remote virtual environment. |
| 77 | + |
| 78 | +```lisp |
| 79 | +(pythonic-remote-docker-p) |
| 80 | +``` |
| 81 | + |
| 82 | +### pythonic-remote-vagrant-p |
| 83 | + |
| 84 | +Determine vagrant remote virtual environment. |
| 85 | + |
| 86 | +```lisp |
| 87 | +(pythonic-remote-vagrant-p) |
| 88 | +``` |
| 89 | + |
| 90 | +### pythonic-remote-user |
| 91 | + |
| 92 | +Get user of the connection to the remote python interpreter. |
| 93 | + |
| 94 | +```lisp |
| 95 | +(pythonic-remote-user) |
| 96 | +``` |
| 97 | + |
| 98 | +### pythonic-remote-host |
| 99 | + |
| 100 | +Get host of the connection to the remote python interpreter. |
| 101 | + |
| 102 | +```lisp |
| 103 | +(pythonic-remote-host) |
| 104 | +``` |
| 105 | + |
| 106 | +### pythonic-remote-port |
| 107 | + |
| 108 | +Get port of the connection to the remote python interpreter. |
| 109 | + |
| 110 | +```lisp |
| 111 | +(pythonic-remote-port) |
| 112 | +``` |
| 113 | + |
| 114 | +## Commands |
| 115 | + |
| 116 | +### pythonic-activate |
| 117 | + |
| 118 | +Activate python virtual environment. Tramp paths are supported. |
| 119 | + |
| 120 | +### pythonic-deactivate |
| 121 | + |
| 122 | +Deactivate python virtual environment. |
0 commit comments