I had similar issue from Visual Studio Code does not print to terminal with correct indentation
solved by reverting to python 3.12, no indentation issues after that