Split python layer into !lang/python and !frameworks/django layers
This commit is contained in:
parent
dca6eca3c0
commit
600046f667
|
@ -0,0 +1,87 @@
|
|||
#+TITLE: Python contribution layer for Spacemacs
|
||||
[[file:img/django.png]]
|
||||
|
||||
* Table of Contents :TOC@4:
|
||||
- [[#description][Description]]
|
||||
- [[#install][Install]]
|
||||
- [[#key-bindings][Key Bindings]]
|
||||
- [[#fabric][Fabric]]
|
||||
- [[#files][Files]]
|
||||
- [[#interactive][Interactive]]
|
||||
- [[#server][Server]]
|
||||
- [[#southsyncdb][South/Syncdb]]
|
||||
- [[#test][Test]]
|
||||
|
||||
* Description
|
||||
|
||||
This layer adds support for the Python [[https://www.djangoproject.com/][Django]] framework via [[https://github.com/davidmiller/pony-mode][pony-mode]].
|
||||
|
||||
* Install
|
||||
|
||||
To use this contribution add it to your =~/.spacemacs=
|
||||
|
||||
#+BEGIN_SRC emacs-lisp
|
||||
(setq-default dotspacemacs-configuration-layers '(django))
|
||||
#+END_SRC
|
||||
|
||||
* Key Bindings
|
||||
|
||||
Django related key bindings uses [[https://github.com/davidmiller/pony-mode][pony-mode]] and are behind the prefix ~SPC m j~.
|
||||
|
||||
Configuration options for pony-mode are documented at
|
||||
[[http://www.deadpansincerity.com/docs/pony/configuration.html][deadpansincerity.com]]
|
||||
|
||||
Manage Django with ~SPC m j m~.
|
||||
|
||||
** Fabric
|
||||
|
||||
| Key Binding | Description |
|
||||
|---------------+----------------------------------|
|
||||
| ~SPC m j a f~ | Run a fabric command |
|
||||
| ~SPC m j a d~ | Deploy project with =fab deploy= |
|
||||
|
||||
** Files
|
||||
|
||||
| Key Binding | Description |
|
||||
|---------------+---------------------------------------------------------------|
|
||||
| ~SPC m j f s~ | Open the =settings.py= for this project |
|
||||
| ~SPC m j f c~ | Interactively display a setting value in the minibuffer |
|
||||
| ~SPC m j f t~ | Jump to template at point |
|
||||
| ~SPC m j f r~ | Jump to the view file that the URL resolves to (experimental) |
|
||||
|
||||
** Interactive
|
||||
|
||||
| Key Binding | Description |
|
||||
|---------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| ~SPC m j i d~ | Run interpreter for this project's default database as an inferior process |
|
||||
| ~SPC m j i s~ | Open a Python shell with the current pony project's context loaded. If the project has the django_extras package installed, then use the excellent =shell_plus= command. Otherwise, fall back to =manage.py shell= |
|
||||
|
||||
** Server
|
||||
|
||||
| Key Binding | Description |
|
||||
|---------------+-------------------------------------------------------------------|
|
||||
| ~SPC m j r d~ | Stop the dev server |
|
||||
| ~SPC m j r o~ | Open a tab at the dev server |
|
||||
| ~SPC m j r r~ | Restart the dev server (works better with django_extras/werkzeug) |
|
||||
| ~SPC m j r u~ | Start or open the dev server |
|
||||
| ~SPC m j r t~ | Open a second server with a "throwaway" host/port |
|
||||
|
||||
** South/Syncdb
|
||||
|
||||
| Key Binding | Description |
|
||||
|---------------+--------------------------------------------|
|
||||
| ~SPC m j s c~ | Convert an existing app to south |
|
||||
| ~SPC m j s h~ | Create migration for modification |
|
||||
| ~SPC m j s i~ | Run the initial south migration for an app |
|
||||
| ~SPC m j s m~ | Migrate an app |
|
||||
| ~SPC m j s s~ | Run syncdb on the current project |
|
||||
|
||||
** Test
|
||||
|
||||
| Key Binding | Description |
|
||||
|---------------+------------------------------------------------------------------|
|
||||
| ~SPC m j t d~ | Move down the traceback one level |
|
||||
| ~SPC m j t e~ | Go to the file and line of the last stack trace in a test buffer |
|
||||
| ~SPC m j t o~ | Open the file in a traceback at the line specified |
|
||||
| ~SPC m j t t~ | Run the test(s) given by =command= |
|
||||
| ~SPC m j t u~ | Move up the traceback one level |
|
Binary file not shown.
After Width: | Height: | Size: 39 KiB |
|
@ -0,0 +1,56 @@
|
|||
;;; packages.el --- Django Layer packages File for Spacemacs
|
||||
;;
|
||||
;; Copyright (c) 2012-2014 Sylvain Benner
|
||||
;; Copyright (c) 2014-2015 Sylvain Benner & Contributors
|
||||
;;
|
||||
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
||||
;; URL: https://github.com/syl20bnr/spacemacs
|
||||
;;
|
||||
;; This file is not part of GNU Emacs.
|
||||
;;
|
||||
;;; License: GPLv3
|
||||
|
||||
(setq python-packages
|
||||
'(
|
||||
pony-mode
|
||||
))
|
||||
|
||||
(defun python/init-pony-mode ()
|
||||
(use-package pony-mode
|
||||
:defer t
|
||||
:init (progn
|
||||
(evil-leader/set-key-for-mode 'python-mode
|
||||
; d*j*ango f*a*bric
|
||||
"mjaf" 'pony-fabric
|
||||
"mjad" 'pony-fabric-deploy
|
||||
; d*j*ango *f*iles
|
||||
"mjfs" 'pony-goto-settings
|
||||
"mjfc" 'pony-setting
|
||||
"mjft" 'pony-goto-template
|
||||
"mjfr" 'pony-resolve
|
||||
; d*j*ango *i*nteractive
|
||||
"mjid" 'pony-db-shell
|
||||
"mjis" 'pony-shell
|
||||
; d*j*ango *m*anage
|
||||
; not including one-off management commands like "flush" and
|
||||
; "startapp" even though they're implemented in pony-mode,
|
||||
; because this is much handier
|
||||
"mjm" 'pony-manage
|
||||
; d*j*ango *r*unserver
|
||||
"mjrd" 'pony-stopserver
|
||||
"mjro" 'pony-browser
|
||||
"mjrr" 'pony-restart-server
|
||||
"mjru" 'pony-runserver
|
||||
"mjrt" 'pony-temp-server
|
||||
; d*j*ango *s*outh/*s*yncdb
|
||||
"mjsc" 'pony-south-convert
|
||||
"mjsh" 'pony-south-schemamigration
|
||||
"mjsi" 'pony-south-initial
|
||||
"mjsm" 'pony-south-migrate
|
||||
"mjss" 'pony-syncdb
|
||||
; d*j*ango *t*est
|
||||
"mjtd" 'pony-test-down
|
||||
"mjte" 'pony-test-goto-err
|
||||
"mjto" 'pony-test-open
|
||||
"mjtt" 'pony-test
|
||||
"mjtu" 'pony-test-up))))
|
|
@ -1,6 +1,6 @@
|
|||
#+TITLE: Python contribution layer for Spacemacs
|
||||
|
||||
[[file:img/python.png]] [[file:img/django.png]]
|
||||
[[file:img/python.png]]
|
||||
|
||||
* Table of Contents :TOC@4:
|
||||
- [[#description][Description]]
|
||||
|
@ -17,13 +17,6 @@
|
|||
- [[#testing][Testing]]
|
||||
- [[#refactoring][Refactoring]]
|
||||
- [[#other-python-commands][Other Python commands]]
|
||||
- [[#django][Django]]
|
||||
- [[#fabric][Fabric]]
|
||||
- [[#files][Files]]
|
||||
- [[#interactive][Interactive]]
|
||||
- [[#server][Server]]
|
||||
- [[#southsyncdb][South/Syncdb]]
|
||||
- [[#test][Test]]
|
||||
|
||||
* Description
|
||||
|
||||
|
@ -36,7 +29,6 @@ This layer adds support for the Python language.
|
|||
- Test Runners using [[https://github.com/syl20bnr/nose.el][nose.el]] or [[https://github.com/ionrock/pytest-el][pytest]]
|
||||
- Virtual Environment using [[https://github.com/jorgenschaefer/pyvenv][pyvenv]] and [[https://github.com/yyuu/pyenv][pyenv]]
|
||||
- semantic mode is enabled
|
||||
- Django support via [[https://github.com/davidmiller/pony-mode][pony-mode]]
|
||||
- PEP8 compliant formatting via [[https://github.com/google/yapf][YAPF]]
|
||||
- Suppression of unused import with [[https://github.com/myint/autoflake][autoflake]]
|
||||
|
||||
|
@ -173,64 +165,3 @@ Test commands (start with ~m t~ or ~m T~):
|
|||
| ~SPC m h H~ | open documentation in =firefox= using [pylookup][pylookup] |
|
||||
| ~SPC m v~ | activate a virtual environment with [[https://github.com/yyuu/pyenv][pyenv]] |
|
||||
| ~SPC m V~ | activate a virtual environment with [[https://github.com/jorgenschaefer/pyvenv][pyvenv]] |
|
||||
|
||||
** Django
|
||||
Django related key bindings uses [[https://github.com/davidmiller/pony-mode][pony-mode]] and are behind the prefix ~SPC m j~.
|
||||
|
||||
Configuration options for pony-mode are documented at
|
||||
[[http://www.deadpansincerity.com/docs/pony/configuration.html][deadpansincerity.com]]
|
||||
|
||||
Manage Django with ~SPC m j m~.
|
||||
|
||||
*** Fabric
|
||||
|
||||
| Key Binding | Description |
|
||||
|---------------+----------------------------------|
|
||||
| ~SPC m j a f~ | Run a fabric command |
|
||||
| ~SPC m j a d~ | Deploy project with =fab deploy= |
|
||||
|
||||
*** Files
|
||||
|
||||
| Key Binding | Description |
|
||||
|---------------+---------------------------------------------------------------|
|
||||
| ~SPC m j f s~ | Open the =settings.py= for this project |
|
||||
| ~SPC m j f c~ | Interactively display a setting value in the minibuffer |
|
||||
| ~SPC m j f t~ | Jump to template at point |
|
||||
| ~SPC m j f r~ | Jump to the view file that the URL resolves to (experimental) |
|
||||
|
||||
*** Interactive
|
||||
|
||||
| Key Binding | Description |
|
||||
|---------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||
| ~SPC m j i d~ | Run interpreter for this project's default database as an inferior process |
|
||||
| ~SPC m j i s~ | Open a Python shell with the current pony project's context loaded. If the project has the django_extras package installed, then use the excellent =shell_plus= command. Otherwise, fall back to =manage.py shell= |
|
||||
|
||||
*** Server
|
||||
|
||||
| Key Binding | Description |
|
||||
|---------------+-------------------------------------------------------------------|
|
||||
| ~SPC m j r d~ | Stop the dev server |
|
||||
| ~SPC m j r o~ | Open a tab at the dev server |
|
||||
| ~SPC m j r r~ | Restart the dev server (works better with django_extras/werkzeug) |
|
||||
| ~SPC m j r u~ | Start or open the dev server |
|
||||
| ~SPC m j r t~ | Open a second server with a "throwaway" host/port |
|
||||
|
||||
*** South/Syncdb
|
||||
|
||||
| Key Binding | Description |
|
||||
|---------------+--------------------------------------------|
|
||||
| ~SPC m j s c~ | Convert an existing app to south |
|
||||
| ~SPC m j s h~ | Create migration for modification |
|
||||
| ~SPC m j s i~ | Run the initial south migration for an app |
|
||||
| ~SPC m j s m~ | Migrate an app |
|
||||
| ~SPC m j s s~ | Run syncdb on the current project |
|
||||
|
||||
*** Test
|
||||
|
||||
| Key Binding | Description |
|
||||
|---------------+------------------------------------------------------------------|
|
||||
| ~SPC m j t d~ | Move down the traceback one level |
|
||||
| ~SPC m j t e~ | Go to the file and line of the last stack trace in a test buffer |
|
||||
| ~SPC m j t o~ | Open the file in a traceback at the line specified |
|
||||
| ~SPC m j t t~ | Run the test(s) given by =command= |
|
||||
| ~SPC m j t u~ | Move up the traceback one level |
|
||||
|
|
|
@ -21,20 +21,3 @@
|
|||
|
||||
(defvar python-test-runner 'nose
|
||||
"Test runner to use. Possible values are `nose' or `pytest'.")
|
||||
|
||||
;; Command prefixes
|
||||
|
||||
;; not supported for now
|
||||
;; (setq python/key-binding-prefixes
|
||||
;; '(; django/pony-mode
|
||||
;; ("mj" . "django")
|
||||
;; ("mjr" . "django-runserver")
|
||||
;; ("mji" . "django-shells")
|
||||
;; ("mjs" . "django-south/syncdb")
|
||||
;; ("mjt" . "django-test")
|
||||
;; ("mjf" . "django-files")
|
||||
;; ("mja" . "django-fabric")
|
||||
;; ; pyenv/pyenv-mode
|
||||
;; ("mp" . "pyenv")))
|
||||
;; (mapc (lambda (x) (spacemacs/declare-prefix (car x) (cdr x)))
|
||||
;; python/key-binding-prefixes)
|
||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 14 KiB |
Binary file not shown.
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 28 KiB |
|
@ -22,7 +22,6 @@
|
|||
helm-pydoc
|
||||
hy-mode
|
||||
pip-requirements
|
||||
pony-mode
|
||||
pyenv-mode
|
||||
pytest
|
||||
python
|
||||
|
@ -69,46 +68,6 @@
|
|||
(push 'company-capf company-backends-pip-requirements-mode)
|
||||
(spacemacs|add-company-hook pip-requirements-mode))))
|
||||
|
||||
(defun python/init-pony-mode ()
|
||||
(use-package pony-mode
|
||||
:defer t
|
||||
:init (progn
|
||||
(evil-leader/set-key-for-mode 'python-mode
|
||||
; d*j*ango f*a*bric
|
||||
"mjaf" 'pony-fabric
|
||||
"mjad" 'pony-fabric-deploy
|
||||
; d*j*ango *f*iles
|
||||
"mjfs" 'pony-goto-settings
|
||||
"mjfc" 'pony-setting
|
||||
"mjft" 'pony-goto-template
|
||||
"mjfr" 'pony-resolve
|
||||
; d*j*ango *i*nteractive
|
||||
"mjid" 'pony-db-shell
|
||||
"mjis" 'pony-shell
|
||||
; d*j*ango *m*anage
|
||||
; not including one-off management commands like "flush" and
|
||||
; "startapp" even though they're implemented in pony-mode,
|
||||
; because this is much handier
|
||||
"mjm" 'pony-manage
|
||||
; d*j*ango *r*unserver
|
||||
"mjrd" 'pony-stopserver
|
||||
"mjro" 'pony-browser
|
||||
"mjrr" 'pony-restart-server
|
||||
"mjru" 'pony-runserver
|
||||
"mjrt" 'pony-temp-server
|
||||
; d*j*ango *s*outh/*s*yncdb
|
||||
"mjsc" 'pony-south-convert
|
||||
"mjsh" 'pony-south-schemamigration
|
||||
"mjsi" 'pony-south-initial
|
||||
"mjsm" 'pony-south-migrate
|
||||
"mjss" 'pony-syncdb
|
||||
; d*j*ango *t*est
|
||||
"mjtd" 'pony-test-down
|
||||
"mjte" 'pony-test-goto-err
|
||||
"mjto" 'pony-test-open
|
||||
"mjtt" 'pony-test
|
||||
"mjtu" 'pony-test-up))))
|
||||
|
||||
(defun python/init-pyenv-mode ()
|
||||
(use-package pyenv-mode
|
||||
:defer t
|
||||
|
|
Loading…
Reference in New Issue