I'm confused about how pip knows what dependancies to install for a package.
First, I created a new virtual environment
% python3 -m venv env
Activate it
% source env/bin/activate
Listed installed packages. And I just see the default installed.
% pip list
Package Version
---------- -------
pip 19.2.3
setuptools 41.2.0
Then, I installed another package (requests)
% pip install requests
And when I list packages installed again, I see a lot more has been installed than I asked. I get that it's installing these because pip knows that I need them for the package, but how?
Package Version
---------- ---------
certifi 2020.6.20
chardet 3.0.4
idna 2.10
pip 19.2.3
requests 2.24.0
setuptools 41.2.0
urllib3 1.25.10
I was thinking there must be a requirements.txt in the root of the package, but I don't see it.
% cd env/lib/python3.8/site-packages/requests
% ls | grep requests.txt | wc -l
0
So how does pip know? Does it look at every file and install all packages that are imported or is there some other magic going on here?