2014-09-05 17:08:40 -04:00
|
|
|
(provide 'init-python)
|
|
|
|
|
|
|
|
(use-package python
|
|
|
|
:mode ("\\.py\\'" . python-mode)
|
|
|
|
:interpreter ("python" . python-mode)
|
2014-11-29 20:21:03 -05:00
|
|
|
:init (setq python-indent-offset 4)
|
2014-09-05 17:08:40 -04:00
|
|
|
:config
|
|
|
|
(progn
|
2014-11-29 20:21:03 -05:00
|
|
|
(setq python-environment-directory *tmp-dir)
|
2014-09-20 16:54:04 -04:00
|
|
|
(setq python-shell-interpreter "ipython")
|
2014-09-05 17:08:40 -04:00
|
|
|
|
2014-09-20 16:54:04 -04:00
|
|
|
(add-hook! 'python-mode-hook
|
|
|
|
(setq my-switch-to-repl-func 'python-shell-switch-to-shell
|
|
|
|
my-send-region-to-repl-func 'python-shell-send-region
|
|
|
|
my-run-code-interpreter "python"))
|
2014-09-05 17:08:40 -04:00
|
|
|
|
2014-11-29 20:21:03 -05:00
|
|
|
;; Interferes with smartparens
|
|
|
|
(bind python-mode-map (kbd "DEL") nil)
|
|
|
|
(bind 'motion python-mode-map "gd" 'jedi:goto-definition)
|
|
|
|
|
|
|
|
(use-package jedi
|
|
|
|
:config
|
|
|
|
(progn
|
|
|
|
(unless (file-directory-p python-environment-directory)
|
|
|
|
(jedi:install-server))
|
|
|
|
(add-hook 'python-mode-hook 'jedi:ac-setup)))
|
|
|
|
|
2014-09-20 16:54:04 -04:00
|
|
|
(use-package nose
|
|
|
|
:commands (nose-mode)
|
2014-09-05 17:08:40 -04:00
|
|
|
:init
|
2014-09-20 16:54:04 -04:00
|
|
|
(progn
|
|
|
|
;; Reset nose keymap, we'll set new ones in my-keymaps.el
|
|
|
|
(defvar nose-mode-map (make-sparse-keymap))
|
2014-11-29 20:21:03 -05:00
|
|
|
(associate-minor-mode "/test_.+\\.py\\'" nose-mode))
|
|
|
|
:config
|
|
|
|
(bind 'normal nose-mode-map
|
|
|
|
",tr" 'nosetests-again
|
|
|
|
",ta" 'nosetests-all
|
|
|
|
",ts" 'nosetests-one
|
|
|
|
",tv" 'nosetests-module
|
|
|
|
",tA" 'nosetests-pdb-all
|
|
|
|
",tO" 'nosetests-pdb-one
|
|
|
|
",tV" 'nosetests-pdb-module))))
|