From 07797f0fd74cab5cd10c5c60c91e3b594109ff4e Mon Sep 17 00:00:00 2001 From: Diego Ramirez Date: Sat, 22 Jan 2022 18:43:58 -0600 Subject: [PATCH] Stop allowing `session.install` wthout a venv 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. --- nox/sessions.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/nox/sessions.py b/nox/sessions.py index a1693966..754a2e74 100644 --- a/nox/sessions.py +++ b/nox/sessions.py @@ -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 """ @@ -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().")