.emacs.d/elisp/init-python.el

100 lines
2.9 KiB
EmacsLisp

;;; init-python.el --- -*- lexical-binding: t -*-
;;
;; Filename: init-python.el
;; Description: Initialize Python
;; Author: Mingde (Matthew) Zeng
;; Copyright (C) 2019 Mingde (Matthew) Zeng
;; Created: Mon Jun 10 18:58:02 2019 (-0400)
;; Version: 2.0.0
;; Last-Updated: mer. janv. 15 09:40:51 2020 (+0100)
;; By: Mikaël Capelle
;; URL: https://github.com/MatthewZMD/.emacs.d
;; Keywords: lsp-python-ms
;; Compatibility: emacs-version >= 26.1
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Commentary:
;;
;; This initializes lsp-python-ms
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;; This program is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
;; the Free Software Foundation, either version 3 of the License, or (at
;; your option) any later version.
;;
;; This program is distributed in the hope that it will be useful, but
;; WITHOUT ANY WARRANTY; without even the implied warranty of
;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
;; General Public License for more details.
;;
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>.
;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;
;;; Code:
(eval-when-compile
(require 'init-flycheck)
(require 'init-const))
;; PythonConfig
;; (use-package python-mode
;; :ensure nil
;; :after flycheck
;; :mode "\\.py\\'"
;; :custom
;; (python-indent-offset 4)
;; (flycheck-python-pycompile-executable "python3")
;; (python-shell-interpreter "python3"))
;; ;; -PythonConfig
(add-hook 'python-mode-hook (lambda () (setq-local whitespace-line-column 100)))
(use-package flycheck-mypy
:after flycheck
:config
(flycheck-add-next-checker 'python-flake8 'python-mypy))
(use-package elpy
:defer t
:bind
(("M-/" . elpy-company-backend)
("C-<prior>" . elpy-nav-forward-block)
("C-<prev>" . elpy-nav-backward-block)
:map elpy-mode-map
("C-<up>" . nil)
("C-<down>" . nil))
:custom
(flycheck-python-flake8-executable "python")
(python-indent-offset 4)
(python-shell-interpreter "ipython")
(python-shell-interpreter-args "-i --simple-prompt")
:config
(setq elpy-rpc-backend "jedi")
(setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
(add-hook 'elpy-mode-hook 'flycheck-mode)
:init
(advice-add 'python-mode :before 'elpy-enable))
(use-package ein
:custom
(ein:polymode t)
(ein:use-auto-complete t)
:commands (ein:notebooklist-open))
;; LSPPythonPac
;; (use-package lsp-python-ms
;; :after lsp-mode python
;; :if (or *python3* *python*)
;; :custom
;; (lsp-python-executable-cmd "python3"))
;; ;; -LSPPythonPac
(provide 'init-python)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; init-python.el ends here