3636
3737(defcustom  python-environment-directory 
3838 (locate-user-emacs-file  " .python-environments" 
39-  " Path to directory to store all Python virtual environments" 
39+  " Path to directory to store all Python virtual environments. A string.
40+ 
41+ If you want to change the location to, say ``~/.python-environments``, 
42+ then set it like this in your Emacs setup file:: 
43+ 
44+  (setq python-environment-directory \" ~/.python-environments\" )"  
4045 :group  'python-environment )
4146
4247(defcustom  python-environment-default-root-name  " default" 
43-  " Default Python virtual environment name.
44- This is a name of directory relative to `python-environment-directory' . 
48+  " Default Python virtual environment name. A string.
49+ 
50+ This is a name of directory relative to `python-environment-directory'  
51+ where default virtual environment locates. 
4552Thus, typically the default virtual environment path is 
4653``~/.emacs.d/.python-environments/default``."  
4754 :group  'python-environment )
4855
4956(defcustom  python-environment-virtualenv 
5057 (list  " virtualenv" " --system-site-packages" 
51-  " virtualenv command to use." 
58+  " ``virtualenv`` command to use, including command options. List of strings.
59+ 
60+ For example, if you want to use specific Python executable (to 
61+ specify Python version), append ``--python`` option like this:: 
62+ 
63+  (setq python-environment-virtualenv 
64+  (append python-environment-virtualenv 
65+  '(\" --python\"  \" PATH/TO/bin/python\" ))) 
66+ 
67+ I added ``--system-site-packages`` as default, but this is not 
68+ mandatory. If you don't like it, removing does not break 
69+ anything (well, theoretically). For reason why it is default, 
70+ see discussion here: 
71+ https://github.com/tkf/emacs-python-environment/issues/3"  
5272 :group  'python-environment )
5373
5474(defvar  python-environment--verbose  nil )
@@ -99,9 +119,25 @@ Thus, typically the default virtual environment path is
99119 (append  virtualenv (list  path)))))
100120
101121(defun  python-environment-make  (&optional  root  virtualenv )
102-  " Make virtualenv at ROOT asynchronously and return a deferred object.
122+  " Make virtual environment at ROOT asynchronously.
123+ 
124+ This function does not wait until ``virtualenv`` finishes. 
125+ Instead, it returns a deferred object [#]_. So, if you want to 
126+ do some operation after the ``virtualenv`` command finishes, do 
127+ something like this:: 
128+ 
129+  (deferred:$ 
130+  (python-environment-make) 
131+  (deferred:nextc it (lambda (output) DO-SOMETHING-HERE))) 
132+ 
133+ If ROOT is specified, it is used instead of 
134+ `python-environment-default-root-name' . ROOT can be a relative
135+ path from `python-environment-virtualenv'  or an absolute path. 
136+ 
103137If VIRTUALENV (list of string) is specified, it is used instead of 
104- `python-environment-virtualenv' ." 
138+ `python-environment-virtualenv' .
139+ 
140+ .. [#] https://github.com/kiwanami/emacs-deferred"  
105141 (python-environment--make-with-runner
106142 #'python-environment--deferred-process  
107143 root virtualenv))
@@ -115,7 +151,8 @@ For reason, see `python-environment-run-block'"
115151 root virtualenv))
116152
117153(defun  python-environment-exists-p  (&optional  root )
118-  " Return non-`nil'  if virtualenv at ROOT exists." 
154+  " Return non-`nil'  if virtualenv at ROOT exists.
155+ See `python-environment-make'  for how ROOT is interpreted."  
119156 (let  ((bin (python-environment-bin root)))
120157 (and  bin (file-exists-p  bin))))
121158
@@ -129,14 +166,16 @@ For reason, see `python-environment-run-block'"
129166
130167(defun  python-environment-bin  (path  &optional  root )
131168 " Return full path to \" ROOT/bin/PATH\"  or \" ROOT/Script/PATH\"  if exists.
132- ``Script`` is used instead of ``bin`` in typical Windows case."  
169+ ``Script`` is used instead of ``bin`` in typical Windows case. 
170+ See `python-environment-make'  for how ROOT is interpreted."  
133171 (python-environment--existing root
134172 (concat  " bin/" 
135173 (concat  " Script/" 
136174
137175(defun  python-environment-lib  (path  &optional  root )
138176 " Return full path to \" ROOT/lib/PATH\"  or \" ROOT/Lib/PATH\"  if exists.
139- ``Lib`` is used instead of ``lib`` in typical Windows case."  
177+ ``Lib`` is used instead of ``lib`` in typical Windows case. 
178+ See `python-environment-make'  for how ROOT is interpreted."  
140179 (python-environment--existing root
141180 (concat  " lib/" 
142181 (concat  " Lib/" 
@@ -159,14 +198,18 @@ For reason, see `python-environment-run-block'"
159198
160199(defun  python-environment-run  (command  &optional  root  virtualenv )
161200 " Run COMMAND installed in Python virtualenv located at ROOT
162- asynchronously and return a deferred object. 
163- If ROOT is not specified, shared virtual environment specified by 
164- `python-environment-default-root-name'  is used.
165- If VIRTUALENV (list of string) is specified, it is used instead of 
166- `python-environment-virtualenv' .
201+ asynchronously. 
202+ 
203+ Instead of waiting for COMMAND to finish, a deferred object [#]_ 
204+ is returned so that you can chain operations. 
205+ 
206+ See `python-environment-make'  for how ROOT and VIRTUALENV are 
207+ interpreted and how to work with deferred object. 
167208
168209Use `python-environment-run-block'  if you want to wait until 
169- the command exit."  
210+ the command exit (NOT recommended in interactive command). 
211+ 
212+ .. [#] https://github.com/kiwanami/emacs-deferred"  
170213 (if  (python-environment-exists-p root)
171214 (python-environment--run-1 command root)
172215 (deferred:$
0 commit comments