How to differentiate .pyi and .py files?

Currently, pyi and py files seem to have the same filetype.

Linters and formatters that I use uses this filetype to know what to run, and do the same for pyi and py. It causes me issues as pyi should not be formatted like py files.

I do not really know how I should solve this issue :

  • change the type for pyi files in neovim ? It may break other users worflow
  • modify my plugins or open issues to format/lint based on file extension ? It could work but seems a bit hacky and isn’t very generic (the day I use a new extension, I may have the same issue. Haven’t seen an extension that take it into account yet). This is probably what I will end up doing, though.

Do you see another way ?