Skip to content

fix(_internal/cli/cmdoptions): Add --require-virutalenv to docs #8251

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

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions docs/html/user_guide.rst
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,16 @@ set like this:
ignore-installed = true
no-dependencies = yes

Similarly ``pip`` also provides an option ``require-virtualenv``, which can be
set to true if an operation should be performed within a virtual environement.
It would abort the operation if no active virtual environment is detected. You
can set the option just as above:

.. code-block:: ini

[install]
require-virtualenv = true

To enable the boolean options ``--no-compile``, ``--no-warn-script-location``
and ``--no-cache-dir``, falsy values have to be used:

Expand Down
1 change: 1 addition & 0 deletions news/7688.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Document ``--require-virtualenv`` option, and how to use it.
5 changes: 4 additions & 1 deletion src/pip/_internal/cli/cmdoptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,10 @@ class PipOption(Option):
dest='require_venv',
action='store_true',
default=False,
help=SUPPRESS_HELP
help=(
"Require a virtualenv to be active. Aborts when no active virtualenv "
"is detected."
),
) # type: Callable[..., Option]

verbose = partial(
Expand Down