What I want to achieve
When I want to leave a blank line, there will be a red white space, I tried to disable whitespace-mode and add (setq show-trailing-whitespace nil) , the whitespace is still there. But after save the file, the whitespace will be gone.

Further more, following a class, if I add a new class below, when type : the weired indent will show up. Not only the class , def are the same.

All above behavior are using python-mode. Any info would be grateful, many thanks.
System information
elisp
env bootstrapper: envvar-file
elc count: 0
uname -a: Darwin 18.6.0 Darwin Kernel Version 18.6.0: Thu Apr 25 23:16:27 PDT 2019; root:xnu-4903.261.4~2/RELEASE_X86_64 x86_64
modules: (:completion company ivy :ui doom doom-dashboard doom-quit hl-todo modeline nav-flash ophints (popup +all +defaults) treemacs vc-gutter vi-tilde-fringe window-select workspaces :editor evil file-templates fold multiple-cursors rotate-text snippets :emacs dired electric vc :tools eval flycheck (lookup +docsets) magit :lang data emacs-lisp markdown (org +dragndrop +ipython +pandoc +present) python sh :config default)
packages: (company-tabnine ox-gfm youdao-dictionary fcitx winum)
exec-path: (~/git/bluelog/.venv/bin ~/.fzf/bin ~/.rbenv/shims ~/.cask/bin ~/bin ~/.local/bin /usr/local/sbin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /Applications/VMware Fusion.app/Contents/Public /usr/local/aria2/bin /Applications/Wireshark.app/Contents/MacOS ~/go/bin ~/.antigen/bundles/robbyrussell/oh-my-zsh/lib ~/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/common-aliases ~/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/git ~/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/colored-man-pages ~/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/extract ~/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/sudo ~/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/z ~/.antigen/bundles/djui/alias-tips ~/.antigen/bundles/andrewferrier/fzf-z ~/.antigen/bundles/robbyrussell/oh-my-zsh/plugins/osx ~/.antigen/bundles/zsh-users/zsh-autosuggestions ~/.antigen/bundles/zdharma/fast-syntax-highlighting ~/.antigen/bundles/zsh-users/zsh-history-substring-search ~/.antigen/bundles/hlissner/zsh-autopair /usr/local/opt/fzf/bin ~/.emacs.d/bin ~/.emacs.d/bin /Applications/Emacs.app/Contents/MacOS/libexec/)
Yes, I have experienced this problem too. It's so frustrating. I have just given up. I tried to isolate this issue but am unable to find out what exactly is causing it. I have tried disabling whitespace-mode and set show-trailing-whitespace to nil as well, but no luck.
For the trailing whitespace being red, I find that you have to edit whitespace-style so that it doesn't include trailing. You can do SPC h v and look it up to see what value it's set to, as well as what values you can set and what they're for.
As for the python issue with indenting, I don't believe that has anything to do with whitespace-mode. It would be related to the major/minor modes specific to python, and how they handle indenting.
So it's probably an issue with python-mode.
Using SPC h T for the profiler and inserting your example in python-mode and stopping the profiler with SPC h T reveals this to be electric-indent-mode, you'll probably want to disable that. As do I.
This is a module, remove electric from your init.el.
The reindentation is caused by the :emacs electric module.
The whitespace highlights was caused by these lines in core/core-ui.el.
As of 1e7df80 and ff5be98 on the straight branch, electric indentation (for python) and highlighted trailing whitespace is disabled. Let me know if that isn't the case and I'll reopen this issue.
Most helpful comment
Using
SPC h Tfor the profiler and inserting your example inpython-modeand stopping the profiler withSPC h Treveals this to beelectric-indent-mode, you'll probably want to disable that. As do I.This is a module, remove
electricfrom your init.el.