Optionally skip creation of .gitignore in virtualenv directory#2004
Optionally skip creation of .gitignore in virtualenv directory#2004gaborbernat merged 4 commits intopypa:mainfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## main #2004 +/- ##
==========================================
+ Coverage 94.27% 94.29% +0.02%
==========================================
Files 86 86
Lines 4277 4280 +3
==========================================
+ Hits 4032 4036 +4
+ Misses 245 244 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
if ever in the future it becomes possible to implement similar directives at the subdirectory level for Mercurial, Bazaar, SVN
bbb2dae to
2af40cb
Compare
2af40cb to
1a28968
Compare
src/virtualenv/create/creator.py
Outdated
| dest="vcs_ignore", | ||
| action="store_false", | ||
| help="don't create VCS ignore directive in the destination directory", | ||
| default=True, |
There was a problem hiding this comment.
Does this break convention and more importantly the CLI option-environment variable interop, by renaming the argument? I wasn't aware of the config-file/env-var pathway to set these, and now it's not clear to me if those will expect a value at no_vcs_ignore/VIRTUALENV_NO_VCS_IGNORE or vcs_ignore/VIRTUALENV_VCS_IGNORE or some combo.
There was a problem hiding this comment.
So if you put:
[virtualenv]
no_vcs_ignore = false
in your users virtualenv.ini file you enabled this flag always on your machine.
| default=False, | ||
| ) | ||
| parser.add_argument( | ||
| "--no-vcs-ignore", |
There was a problem hiding this comment.
VIRTUALENV_NO_VCS_IGNORE and no_vcs_ignore will be the names as documented under https://virtualenv.pypa.io/en/latest/cli_interface.html#environment-variables. The destination variable doesn't matter only the CLI flag.
src/virtualenv/create/creator.py
Outdated
| dest="vcs_ignore", | ||
| action="store_false", | ||
| help="don't create VCS ignore directive in the destination directory", | ||
| default=True, |
There was a problem hiding this comment.
So if you put:
[virtualenv]
no_vcs_ignore = false
in your users virtualenv.ini file you enabled this flag always on your machine.
src/virtualenv/create/creator.py
Outdated
| ) | ||
| parser.add_argument( | ||
| "--no-vcs-ignore", | ||
| dest="vcs_ignore", |
There was a problem hiding this comment.
I don't like how you negated the flag name, but kept the destination positive. Please keep them in sync. This flag should be --no-vcs-ignore, destination no_vcs_ignore and should store_true with default False.
There was a problem hiding this comment.
Done. Wasn't really any reason for old way, other than the double negative on line 172, and "because I can". But bringing into sync also will make the default value in auto-docs less confusing (actually correct).
|
I usually find is really awkward to have double-negatives for configuration of tooling (pip is HORRIBLE on this front). Here's my 2 cents: if we're doing this, let's add |
Supporting |

Addresses #2003. Creation of
.gitignorewith non-overridable * directive in the environment directory interferes with possibly more specific ignore directives in higher directories. When the environment directory is a subdirectory of a repo and we need tracking of a subset of its files, allow to skip creation of this.gitignorewith a command line option tovirtualenv.Thanks for contributing, make sure you address all the checklists (for details on how see development documentation)!
tox -e fix_lint)docs/changelogfolder