I’m looking for a way to inhibit creation of .pyc files for modules installed in a particular location, while not inhibiting the creation of .pyc files for modules installed anywhere else. Is there a way to accomplish this?
Rationale/Details:
- I’m in a networked environment with 1000s of users.
- Network has multiple platforms, and requires support a “standard” set of python versions. So I have a set of python virtual environments supporting each combination of python version and platform.
- We have a collection of Python-only modules that are intended to be used in all of these virtual environments
- There are multiple maintainers for the module source, and deployment needs to be as simple as pushing the updated source files to a common network location. All virtual environments have a .pth file that extends sys.path to find these modules in this common network location.
- Because of multiple maintainers, first person (user “A”) to do “import ecommlib” will trigger creation of .pyc files in the common network location, and will own the .pyc files as a result. Next person that pushes changes to ecommlib source will cause a problem for everyone except that first user, because new .pyc files will be needed, but only user “A” can overwrite those .pyc files.
So, I want to avoid creation .pyc files files these common/shared python-only modules, but I don’t want to use the “-B” sledgehammer, and inhibit .pyc creation globally, as that is not necessary, and I don’t want to impact anyone else’s performance with their own code.
Is there any way to accomplish this?