2

I have set up Emacs (on Mac Catalina) with Elpy to handle Python. I also managed to get Jupyter notebooks (.ipynb files) working with Elpy via Ein. Both .py and .ipynb compile and use Flycheck correctly.

I have problems with .ipynb notebooks:

I find that Flycheck does not work properly because of the In [ ]:

I found flake8_nb (and not 'flake8`) works fine with them from the command line:

flake8_nb name.ipynb

My question now is: How can I set up Emacs/elpy to use flake8 with py files and flake8_nb with .ipynb?

From what I have understood, Elpy calls flake8 through python-flake8 but I cannot find an option to make it use flake8_nb with .ipynb files.

Can you please help me?

This is my .emacs Python part:

    (use-package elpy
      :ensure t
      :init
      (elpy-enable))

    (when(require 'ein)
    (setq ein:use-auto-complete-superpack t))

    (when (require 'flycheck nil t)
      (setq elpy-modules (delq 'elpy-module-flymake elpy-modules))
      (add-hook 'elpy-mode-hook 'flycheck-mode))

    (add-hook 'after-init-hook #'global-flycheck-mode)

    (require 'py-autopep8)
    (add-hook 'elpy-mode-hook 'py-autopep8-enable-on-save)
1
  • I'm curious if you ever got this working with something like flycheck-define-checker to call out to flake8_nb?
    – gleitz
    Commented Nov 4, 2023 at 1:33

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.