Perhaps this is more an opinion-based question, but I was wondering whether the contents of a virtualenv
should be included in a GitHub repository. Why should it or should it not be included?
virtualenv is used to manage Python packages for different projects. Using virtualenv allows you to avoid installing Python packages globally which could break system tools or other projects. You can install virtualenv using pip.
Once you create a virtualenv, you will see source created in the directory. You must cd to that particular source and do source activate to start working on that particular virtualenv. Each virtualenv has its own source. You can also use virtualenv wrapper to make things easier.
You should add it to gitignore file. Then, you should create requirements. txt file and populate it with the packages you have installed. Then, on your production server, create the virtual environment and run pip install -r requirements.
No, anything that can be generated should not be included.
Dependencies should be managed with something like pip, and the requirements.txt file can be included.
The only files under source control should be files you absolutely need to get you development environment going. So it can included boot strapping of some sort, ie, you can script the creation of the virtual environment, and that would be the first thing you run once you have cloned.
Also consider that your virtual environment contain binary files. You absolutely do not want those in your repository.
As pointed out by @JeremyBank below, your virtual environment can also differ from system to system meaning that your virtual environment will not be portable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With