gitignore icon indicating copy to clipboard operation
gitignore copied to clipboard

Update VirtualEnv.gitignore

Open lpalgarvio opened this issue 4 months ago • 2 comments

Reasons for making this change

Add extra rules

Links to documentation supporting these rule changes

  • .venv -> .venv/ to denote its a directory
  • venv/ is also typical, when users prefer to keep the directory visible
  • .python-version is a file that defines which python version (or environment in case of using pyenv), ie https://pydevtools.com/handbook/explanation/what-is-a-python-version-file/

Comments

I think these entries should not be here:

  • .Python: looks more of distribution/packaging and present on https://github.com/github/gitignore/blob/main/Global/VirtualEnv.gitignore and i dont think it has anything to do with virtual envs
  • [Bb]in, [Ii]nclude, [Ll]ib, [Ll]ib64, [Ll]ocal, [Ss]cripts: this does not seem to have anything to do with python's virtualenv spec. some of these entries might actually conflict with code in projects, ie, bin and scripts
  • pip-selfcheck.json: not specific to python virtualenv, but rather python dependencies using pip

Perhaps some of them should be moved to https://github.com/github/gitignore/blob/main/Python.gitignore and some entirely removed

lpalgarvio avatar Aug 21 '25 01:08 lpalgarvio

Just as a note, the docs explicitly say that you should commit .python-version to the repository:

Consider these guidelines when using .python-version files:

  • Pin specific versions for reproducible development environments
  • Commit to version control to ensure team consistency
  • Align with project requirements - ensure the pinned version satisfies requires-python
  • Update thoughtfully when upgrading Python versions across the project

sebastianw avatar Aug 23 '25 08:08 sebastianw

This PR is stale because there have been no updates in 90 days. It will close after 180 days of inactivity. Leave a comment if you want to keep it open :smile:

github-actions[bot] avatar Nov 22 '25 16:11 github-actions[bot]