I did some digging for the reasoning behind the __pycache__ directory.
As the main ones, these are given:
- Bytecode is not compatible across Python versions. If the same module was being imported by different versions of Python, each would overwrite the .pyc file with its own flavor of bytecode on import. This would invalidate the cache for all other versions.
- The .pyc cache could be used even without a corresponding .py file, which allowed some space saving (by distributing only the compiled file). However, if one deleted a .py file but forgot to also remove the .pyc, Python would act as if the module was still present. This was quite confusing, especially for beginners.
Both are in my opinion not valid for our specific use case.
We will never have Python variations as Python itself and all it's modules are produced in the same bitbake run, and we're not having issues with beginners, we deal with end-users who don't care about any of this.