PEP 582 - Python local packages directory

I’m not sure how.

Consider a directory myproject containing two subdirectories, __pypackages__ and src. The user has black installed in __pypackages__, but not in the system Python.

If the user is in myproject, python -m black will run black. If the user is in myproject/src, python -m black will give an error. This is what I mean when I say the same command will work differently depending on where you are.

Conversely, running python .../myproject/__main__.py will work from wherever it’s run (because the __pypackages__ in the script’s directory is put on sys.path. This is why @steve.dower’s idea of having a black.py in myproject will always run black. The problem with it is that I don’t think we want to encourage projects to scatter tool driver scripts in the project top-level directory.

If Python were to scan up the directory hierarchy looking for __pypackages__, then things would work more smoothly in these examples - but I think there are likely to be enough issues with doing so, that the PEP is right not to suggest that.