Message 333591 - Python tracker (original) (raw)

I really hate .pth files because the slow down Python startup time for all applications whereas .pth files are usually specific to a very few applications using one or two specific modules.

They can also modify the behavior of Python for all applications, with no way to opt-out.

I would prefer to have an opt-in option, disabled by default.

I'm in favor of deprecating the feature in Python 3.8 and remove it from Python 3.9.

Python 3 already support namespaces which covers the most common use case of .pth files, no?

Another use case is to run code if a specific command line option is used or if an environment variable is set. For example, my faulthandler backport uses a .pth file to enable faulthandler if PYTHONFAULTHANDLER environment variable is set. I dislike this .pth file (I didn't write it ;-)). I'm fine with dropping this feature as a whole.

We can add a pending deprecation warning in Python 3.7 right now.