-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Optionally skip creation of .gitignore in virtualenv directory #2004
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if you put:
[virtualenv]
no_vcs_ignore = false
in your users virtualenv.ini
file you enabled this flag always on your machine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perfect
@@ -90,6 +92,13 @@ def add_parser_arguments(cls, parser, interpreter, meta, app_data): | |||
help="remove the destination directory if exist before starting (will overwrite files otherwise)", | |||
default=False, | |||
) | |||
parser.add_argument( | |||
"--no-vcs-ignore", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
@@ -90,6 +92,13 @@ def add_parser_arguments(cls, parser, interpreter, meta, app_data): | |||
help="remove the destination directory if exist before starting (will overwrite files otherwise)", | |||
default=False, | |||
) | |||
parser.add_argument( | |||
"--no-vcs-ignore", | |||
dest="vcs_ignore", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addresses #2003. Creation of
.gitignore
with 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.gitignore
with 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/changelog
folder