-
Notifications
You must be signed in to change notification settings - Fork 165
Setting up Emacs
So far the best emacs setup I've found is iPython notebook, combined with the ein emacs package (emacs iPython notebook).
Installing iPython is covered on its homepage.
You can run M-x package-install ein in emacs to install ein (if you have the right repositories set up - check out Melpa)
Then in a shell somewhere, you can start up iPython notebook process. This is the python process that will intepret all the code you will be sending it.
$ source ~/my-virtual-env/bin/activate
$ cd ~/my-project
$ ipython notebookThen in emacs, run M-x ein:notebooklist-open. It will prompt you for a port (default 8888). This will bring up the EIN environment, where you can evaluate python snippets (and edit them and evaluate them again). You can also save the notebook to use your snippets again later. The outputs are also saved.
I wrote a little bit of elisp to start a iPython notebook process for you from within emacs. It's a little rough but easier than having to type shell commands every time. It requires the magit package, which I highly recommend (it is a git client for emacs).
(autoload 'magit-get-top-dir "magit" nil t)
(defun magit-project-dir ()
(magit-get-top-dir (file-name-directory (or (buffer-file-name) default-directory))))
(defun start-ipython-current-project (virtualenv-dir)
(interactive "DVirtualenv dir: ")
(save-excursion
(let ((buf (get-buffer-create
(generate-new-buffer-name (file-name-nondirectory
(directory-file-name (file-name-directory (magit-project-dir))))))))
(shell buf)
(process-send-string buf (format ". %s/bin/activate\n" virtualenv-dir))
(process-send-string buf (format "cd %s;ipython notebook\n" (magit-project-dir))))))To use the above snippet,
- Go to any buffer that's visiting any file in your project (or any buffer whose
pwdis in your project) M-x start-ipython-current-project- At the prompt, input the directory where your virtualenv lives
It will start ipython in emacs' shell buffer.
Note, this may get out of date quickly
import cfme.fixtures.pytest_selenium as s
import cfme.fixtures.configuration as conf
conf.init()
s.selenium().next()
import cfme.login as login
login.login_admin()- how to do completion
- how to inspect values