I have the following project structure:
prog
__init__.py
tests
subpak
__init__.py
__init__.py
run1.py
run2.py
run1.py:
from setuptools import find_packages
for i in sorted(find_packages(exclude=['tests'])):
print(i)
run2.py:
import pip
from setuptools import find_packages
for i in sorted(find_packages(exclude=['tests'])):
print(i)
The remaining files are empty. Environment - Debian testing. python 3.5.
run1.py output:
$ python3 run1.py
prog
run2.py output:
$ python3 run2.py
prog
tests.subpak
That is, when find_packagesimported after pip, it no longer excludes subpackages of the excluded package. Why is this happening and what mechanisms are involved in this peculiar behavior?
edit: It seems that pip or some of its dependencies modify syspath, and the modules are setuptoolsdifferent. Run1:
<module 'setuptools' from '/usr/lib/python3/dist-packages/setuptools/__init__.py'>
RUN2:
<module 'setuptools' from '/usr/share/python-wheels/setuptools-20.10.1-py2.py3-none-any.whl/setuptools/__init__.py'>
source
share