Using GitHub's .gitignore, I was able to filter out some files and directories. However, there's a few things that left me a little bit confused:
home = /usr/bin
, which, while perhaps probably correct on a lot of Linux distributions, won't necessarily apply to all systems.Are there any other files/directories I missed? Are there any stricter guidelines for how to structure a project and what to include?
The virtual environment manages files which aren't yours. It doesn't care how you manage your own files. Put them wherever makes sense to you, just not anywhere inside the venv directory tree. Common solutions include directly in myproject , or in myproject/src .
New in version 3.3. Source code: Lib/venv/ The venv module supports creating lightweight “virtual environments”, each with their own independent set of Python packages installed in their site directories.
The short answer is, “yes”. You should use your . gitignore file to ignore the . env file.
Although venv is a very useful tool, you should not assume (unless you have good reason to do so) that everyone who looks at your repository uses it. Avoid committing any files used only by venv; these are not strictly necessary to be able to run your code and they are confusing to people who don't use venv.
The only configuration file you need to include in your repository is the requirements.txt
file generated by pip freeze > requirements.txt
which lists package dependencies. You can then add a note in your readme instructing users to install these dependencies with the command pip install -r requirements.txt
. It would also be a good idea to specify the required version of Python in your readme.
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