diff --git a/docs/plugins.md b/docs/plugins.md index 68a028acfe2..9cd5d7bd7c4 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -269,6 +269,10 @@ If the plugin is not installed in Poetry's own environment when running `poetry it will be installed only for the current project under `.poetry/plugins` in the project's directory. +This path can be changed by setting the `POETRY_PROJECT_PLUGIN_CACHE` environment variable +to a path similar to the default value, e.g. `.poetry_314/plugins`, +when running Poetry itself using different versions of Python, such as in CI. + The syntax to specify `plugins` is the same as for [dependencies]({{< relref "managing-dependencies" >}}). {{% warning %}} diff --git a/src/poetry/plugins/plugin_manager.py b/src/poetry/plugins/plugin_manager.py index 17131a39b07..152b16e7898 100644 --- a/src/poetry/plugins/plugin_manager.py +++ b/src/poetry/plugins/plugin_manager.py @@ -3,6 +3,7 @@ import hashlib import json import logging +import os import shutil import sys @@ -103,7 +104,7 @@ def _load_plugin_entry_point(self, ep: metadata.EntryPoint) -> None: class ProjectPluginCache: - PATH = Path(".poetry") / "plugins" + PATH = os.environ.get("POETRY_PROJECT_PLUGIN_CACHE", Path(".poetry") / "plugins") def __init__(self, poetry: Poetry, io: IO) -> None: self._poetry = poetry