Skip to content

Commit

Permalink
fix(console.commands.command.Command): restore the set_poetry instanc…
Browse files Browse the repository at this point in the history
…e method, removed in Poetry v2
  • Loading branch information
DavidVujic committed Jan 7, 2025
1 parent 229ae23 commit d01015f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/basic-usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ For example, these commands should output the same python path:
conda activate your_env_name
which python
poetry run which python
poetry shell
poetry env activate
which python
```

Expand Down
8 changes: 8 additions & 0 deletions src/poetry/console/commands/command.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ def poetry(self) -> Poetry:

return self._poetry

def set_poetry(self, poetry: Poetry) -> None:
"""Explicitly set the current Poetry.
Useful for Plugins that extends the features of a Poetry CLI Command.
"""

self._poetry = poetry

def get_application(self) -> Application:
from poetry.console.application import Application

Expand Down

0 comments on commit d01015f

Please sign in to comment.