I ended up in this question trying to disable flymake inside the python-mode / elpy which was called by default. It ain't perfect, but it worked, so I'm just posting it in case it's of help to someone else who ends up here with the same problem.
Assuming you use "use-package" in your config, and you want to replace flymake with flycheck, to enable flycheck you just need to add the following to your config:
(use-package flycheck
:ensure t
:init
(global-flycheck-mode t))
Then to add elpy and python mode, the code would be:
(use-package python
:mode ("\\.py" . python-mode)
:ensure t
:config
(flymake-mode) ;; <- This line makes the trick of disabling flymake in python mode!
(use-package elpy
:ensure t
:init
(add-to-list 'auto-mode-alist '("\\.py$" . python-mode))
:config
(remove-hook 'elpy-modules 'elpy-module-flymake) ;; <- This removes flymake from elpy
(setq elpy-rpc-backend "jedi")
:bind (:map elpy-mode-map
("M-." . elpy-goto-definition)
("M-," . pop-tag-mark))
)
(elpy-enable)
)
The above code would enable elpy mode every time you are in the python-mode / editing python files. The problem was that python mode was automatically enabling flymake when it was being loaded, and then elpy was loading flycheck. So you'd have both checkers running.
The solution I came up was calling flymake-mode
one more time after loading the python mode, thus disabling it. This should probably work on other modes / cases too.
I know that a "proper" solution would be to find a way to not load flymake at all when loading the python-mode, but until I manage to do that, this should suffice.