Apologies for the lack of better title..
I wanted to know if the following is possible?
So currently I am using vs-code for python work. In vs-code I install some packages related to vs-code extensions, for example I use black
for formatting. The package black
is installed in my base python installation. But when I switch to a new virtual environment, I have to reinstall the package. I don't mind reinstalling the package, but when I do pip freeze > requirements.txt
, it includes these packages also as dependencies, which I don't want.
My first question is, how can I limit the output of pip freeze > requirements.txt
to just include the packages which are actually used in project (by actually I mean, which I am importing). I am open to using other methods for creating requirements.txt
.
My second question (sort of on a side) is, when I reinstall the package in new virtual environment, is it creating a new copy of files (given that the same package is installed in base environment). I am using conda for virtual environment and my guess is it is using some sort of caching mechanism to avoid multiple installation.
Thanks for your help and time...