python: document pippel and set key binding to SPC m P
This commit is contained in:
parent
0a4f257da0
commit
eee2b4b89c
|
@ -16,6 +16,9 @@
|
||||||
- [[#autoflake][autoflake]]
|
- [[#autoflake][autoflake]]
|
||||||
- [[#pylookup][pylookup]]
|
- [[#pylookup][pylookup]]
|
||||||
- [[#hy-mode][Hy-mode]]
|
- [[#hy-mode][Hy-mode]]
|
||||||
|
- [[#configuration][Configuration]]
|
||||||
|
- [[#fill-column][Fill column]]
|
||||||
|
- [[#sort-imports][Sort imports]]
|
||||||
- [[#management-of-python-versions-and-virtual-environments][Management of Python versions and virtual environments]]
|
- [[#management-of-python-versions-and-virtual-environments][Management of Python versions and virtual environments]]
|
||||||
- [[#manage-virtual-environments-with-pyvenv][Manage virtual environments with pyvenv]]
|
- [[#manage-virtual-environments-with-pyvenv][Manage virtual environments with pyvenv]]
|
||||||
- [[#manage-multiple-python-versions-with-pyenv][Manage multiple Python versions with pyenv]]
|
- [[#manage-multiple-python-versions-with-pyenv][Manage multiple Python versions with pyenv]]
|
||||||
|
@ -25,12 +28,10 @@
|
||||||
- [[#running-python-script-in-shell][Running Python Script in shell]]
|
- [[#running-python-script-in-shell][Running Python Script in shell]]
|
||||||
- [[#testing][Testing]]
|
- [[#testing][Testing]]
|
||||||
- [[#refactoring][Refactoring]]
|
- [[#refactoring][Refactoring]]
|
||||||
|
- [[#pip-package-management][Pip package management]]
|
||||||
- [[#live-coding][Live coding]]
|
- [[#live-coding][Live coding]]
|
||||||
- [[#hy-repl-process][Hy REPL process]]
|
- [[#hy-repl-process][Hy REPL process]]
|
||||||
- [[#other-python-commands][Other Python commands]]
|
- [[#other-python-commands][Other Python commands]]
|
||||||
- [[#configuration][Configuration]]
|
|
||||||
- [[#fill-column][Fill column]]
|
|
||||||
- [[#sort-imports][Sort imports]]
|
|
||||||
|
|
||||||
* Description
|
* Description
|
||||||
This layer adds support for the Python language.
|
This layer adds support for the Python language.
|
||||||
|
@ -48,6 +49,7 @@ This layer adds support for the Python language.
|
||||||
- Use the ~%~ key to jump between blocks with [[https://github.com/redguardtoo/evil-matchit][evil-matchit]]
|
- Use the ~%~ key to jump between blocks with [[https://github.com/redguardtoo/evil-matchit][evil-matchit]]
|
||||||
- Sort imports with [[https://pypi.python.org/pypi/isort][isort]]
|
- Sort imports with [[https://pypi.python.org/pypi/isort][isort]]
|
||||||
- Fix a missing import statement with [[https://github.com/anachronic/importmagic.el][importmagic]]
|
- Fix a missing import statement with [[https://github.com/anachronic/importmagic.el][importmagic]]
|
||||||
|
- Pip package manager with [[https://github.com/brotzeit/pippel][pippel]]
|
||||||
|
|
||||||
* Install
|
* Install
|
||||||
** Layer
|
** Layer
|
||||||
|
@ -150,6 +152,28 @@ that hy is installed.
|
||||||
pip install hy
|
pip install hy
|
||||||
#+END_SRC
|
#+END_SRC
|
||||||
|
|
||||||
|
* Configuration
|
||||||
|
** Fill column
|
||||||
|
If you want to customize the fill column value, use something like this inside
|
||||||
|
the =user-init= function in your =.spacemacs=:
|
||||||
|
|
||||||
|
#+BEGIN_SRC elisp
|
||||||
|
(setq-default dotspacemacs-configuration-layers '(
|
||||||
|
(python :variables python-fill-column 99)))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
** Sort imports
|
||||||
|
If you want imports to be automatically sorted when you save a file (using
|
||||||
|
[[https://pypi.python.org/pypi/isort][isort]]), set the =python-sort-imports-on-save= variable in the python layer
|
||||||
|
config section:
|
||||||
|
|
||||||
|
#+BEGIN_SRC elisp
|
||||||
|
(setq-default dotspacemacs-configuration-layers
|
||||||
|
'((python :variables python-sort-imports-on-save t)))
|
||||||
|
#+END_SRC
|
||||||
|
|
||||||
|
or as a directory-local variable (for per-project settings).
|
||||||
|
|
||||||
* Management of Python versions and virtual environments
|
* Management of Python versions and virtual environments
|
||||||
** Manage virtual environments with pyvenv
|
** Manage virtual environments with pyvenv
|
||||||
A virtual environment provides isolation of your Python package versions. For a
|
A virtual environment provides isolation of your Python package versions. For a
|
||||||
|
@ -262,6 +286,26 @@ function with a prefix argument, for example ~SPC u SPC m t a~.
|
||||||
| ~SPC m r i~ | remove unused imports with [[https://github.com/myint/autoflake][autoflake]] |
|
| ~SPC m r i~ | remove unused imports with [[https://github.com/myint/autoflake][autoflake]] |
|
||||||
| ~SPC m r I~ | sort imports with [[https://pypi.python.org/pypi/isort][isort]] |
|
| ~SPC m r I~ | sort imports with [[https://pypi.python.org/pypi/isort][isort]] |
|
||||||
|
|
||||||
|
** Pip package management
|
||||||
|
In python buffer type ~SPC m P~ to open buffer listing all installed =pip=
|
||||||
|
packages in the currently activated virtual environment.
|
||||||
|
|
||||||
|
*Note:* To open this menu from outside a python buffer type
|
||||||
|
~SPC SPC pippel-list-packages RET~ .
|
||||||
|
|
||||||
|
In the package list buffer:
|
||||||
|
|
||||||
|
| Key Binding | Description |
|
||||||
|
|-------------+-------------------------------------------------------------|
|
||||||
|
| ~RET~ | follow link (=pippel-menu-visit-homepage=) |
|
||||||
|
| ~d~ | mark for deletion (=pippel-menu-mark-delete=) |
|
||||||
|
| ~i~ | prompt user for packages (=pippel-install-package=) |
|
||||||
|
| ~m~ | remove mark (=pippel-menu-mark-unmark=) |
|
||||||
|
| ~r~ | refresh package list (=pippel-list-packages=) |
|
||||||
|
| ~U~ | mark all upgradable (=pippel-menu-mark-all-upgrades=) |
|
||||||
|
| ~u~ | mark for upgrade (=pippel-menu-mark-upgrade=) |
|
||||||
|
| ~x~ | perform marked package menu actions (=pippel-menu-execute=) |
|
||||||
|
|
||||||
** Live coding
|
** Live coding
|
||||||
Live coding is provided by the [[https://github.com/donkirkby/live-py-plugin][live-py-plugin.]]
|
Live coding is provided by the [[https://github.com/donkirkby/live-py-plugin][live-py-plugin.]]
|
||||||
|
|
||||||
|
@ -307,24 +351,3 @@ Send code to hy REPL commands:
|
||||||
| ~SPC m V a~ | activate a virtual environment in any directory |
|
| ~SPC m V a~ | activate a virtual environment in any directory |
|
||||||
| ~SPC m V d~ | deactivate active virtual environment |
|
| ~SPC m V d~ | deactivate active virtual environment |
|
||||||
|
|
||||||
* Configuration
|
|
||||||
** Fill column
|
|
||||||
If you want to customize the fill column value, use something like this inside
|
|
||||||
the =user-init= function in your =.spacemacs=:
|
|
||||||
|
|
||||||
#+BEGIN_SRC elisp
|
|
||||||
(setq-default dotspacemacs-configuration-layers '(
|
|
||||||
(python :variables python-fill-column 99)))
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
** Sort imports
|
|
||||||
If you want imports to be automatically sorted when you save a file (using
|
|
||||||
[[https://pypi.python.org/pypi/isort][isort]]), set the =python-sort-imports-on-save= variable in the python layer
|
|
||||||
config section:
|
|
||||||
|
|
||||||
#+BEGIN_SRC elisp
|
|
||||||
(setq-default dotspacemacs-configuration-layers
|
|
||||||
'((python :variables python-sort-imports-on-save t)))
|
|
||||||
#+END_SRC
|
|
||||||
|
|
||||||
or as a directory-local variable (for per-project settings).
|
|
||||||
|
|
|
@ -191,8 +191,8 @@
|
||||||
(defun python/init-pippel ()
|
(defun python/init-pippel ()
|
||||||
(use-package pippel
|
(use-package pippel
|
||||||
:defer t
|
:defer t
|
||||||
:init
|
:init (spacemacs/set-leader-keys-for-major-mode 'python-mode
|
||||||
(spacemacs/set-leader-keys "al" 'pippel-list-packages)
|
"P" 'pippel-list-packages)
|
||||||
:config
|
:config
|
||||||
(evilified-state-evilify-map pippel-package-menu-mode-map
|
(evilified-state-evilify-map pippel-package-menu-mode-map
|
||||||
:mode pippel-package-menu-mode)))
|
:mode pippel-package-menu-mode)))
|
||||||
|
|
Loading…
Reference in New Issue