Skip to content

Commit

Permalink
* layers/+lang/python/*: New flag python-enable-importmagic
Browse files Browse the repository at this point in the history
  • Loading branch information
sunlin7 authored and smile13241324 committed Dec 31, 2024
1 parent 6c00eb8 commit 844b510
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
19 changes: 18 additions & 1 deletion layers/+lang/python/README.org
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,24 @@ config section:
or as a directory-local variable (for per-project settings).

** Importmagic
Install importmagic and epc for importmagic functionality.
Install importmagic and epc for importmagic functionality, it will start a epc
instance on background to serve the requests.

The importmagic is a heavy feature, will take time to prepare the background
server, especially slow with =ipython= or =ipython3=, set the
=importmagic-python-interpreter= to =python= or =python3= (if it is the
interpreter of ipython) will have performance benefit. Fox example:
#+BEGIN_SRC elisp
(setq-default dotspacemacs-configuration-layers
'((python :variables importmagic-python-interpreter "python3")))
#+END_SRC

To disable the importmagic, set the =python-enable-importmagic= in the python
layer config section:
#+BEGIN_SRC elisp
(setq-default dotspacemacs-configuration-layers
'((python :variables python-enable-importmagic nil)))
#+END_SRC

#+BEGIN_SRC sh
pip install importmagic epc
Expand Down
3 changes: 3 additions & 0 deletions layers/+lang/python/config.el
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,9 @@ Possible values are `on-visit', `on-project-switch' or `nil'.")
(defvar python-sort-imports-on-save nil
"If non-nil, automatically sort imports on save.")

(defvar python-enable-importmagic t
"If non-nil, enable the importmagic feature.")

(defvar spacemacs--python-pyenv-modes nil
"List of major modes where to add pyenv support.")

Expand Down
2 changes: 1 addition & 1 deletion layers/+lang/python/packages.el
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
ggtags
helm-cscope
(helm-pydoc :requires helm)
importmagic
(importmagic :toggle python-enable-importmagic)
live-py-mode
(nose :location (recipe :fetcher github :repo "syl20bnr/nose.el")
:toggle (memq 'nose (flatten-list (list python-test-runner))))
Expand Down

0 comments on commit 844b510

Please sign in to comment.