In Python, is there a mean to enforce the use of spaces or tabs indentation with a per file basis ?
Well, perhaps \"enforce\" is too strong, more like a \"recommend
As explicited in PEP 8, never mix tabs and space. However, a file with both may just run... As it says there:
The most popular way of indenting Python is with spaces only. The second-most popular way is with tabs only. Code indented with a mixture of tabs and spaces should be converted to using spaces exclusively. When invoking the Python command line interpreter with the -t option, it issues warnings about code that illegally mixes tabs and spaces. When using -tt these warnings become errors. These options are highly recommended!
the solution is therefore to use as a default:
python -t my_mixed_code.py
To answer at the editor level, this depends on the editor, please specify!