Ref. your configuration: the variable python-indent is declared obsolete and not used anymore,
so you need to replace it with python-indent-offset.
Some people also complain about using lambda in hooks - in your case a simpler setting would be
(setq python-indent-offset 4).
It would be useful to use M-m to move on the first non-empty character in indented ...
I received help from the devs at github.
Basically, at its default, dtrt-indent-mode does nothing if SMIE also is active. Even if dtrt-indent-mode is active. Activating it (even buffer-locally) always defers to SMIE if active, which it is in many programming language modes.
This deferring can be overridden with dtrt-indent-run-after-smie.
Here is the ...
dtrt-indent is a minor mode that will guess the indentation offset of a file and adjusts those local settings accordingly. It hooks in to several major modes, and works reasonably well.
@Gauthier is wondering why dtrt-indent is inserting a TAB character to perform indentation after guessing, with 100% confidence, that the indentation offset is 4 SPACE ...