Skip to content

Commit

Permalink
Stop allowing session.install wthout a venv
Browse files Browse the repository at this point in the history
We already gave a "deprecation phase" for this in theacodes#537, and now it's time to disable this.

This commit will break tests, though.
  • Loading branch information
DiddiLeija committed Jan 23, 2022
1 parent 17a6a15 commit 07797f0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions nox/sessions.py
Expand Up @@ -508,6 +508,12 @@ def install(self, *args: str, **kwargs: Any) -> None:
session.install('-e', '.')
Additional keyword args are the same as for :meth:`run`.
.. warning::
Running ``session.install`` without a virtual environment
is no longer supported. If you still want to do that, please
use ``session.run("pip", "install", ...)`` instead.
.. _pip: https://pip.readthedocs.org
"""
Expand All @@ -520,13 +526,11 @@ def install(self, *args: str, **kwargs: Any) -> None:
"A session without a virtualenv can not install dependencies."
)
if isinstance(venv, PassthroughEnv):
warnings.warn(
self.error(
f"Session {self.name} does not have a virtual environment, "
"so use of session.install() is deprecated since it would modify "
"so use of session.install() is not allowed since it would modify "
"the global Python environment. If you're really sure that is "
'what you want to do, use session.run("pip", "install", ...) instead.',
category=FutureWarning,
stacklevel=2,
)
if not args:
raise ValueError("At least one argument required to install().")
Expand Down

0 comments on commit 07797f0

Please sign in to comment.