Search code examples
pythonenvironment-variablespython-poetry

automatically run script after poetry environment activation


I love simplicity with which python-poetry manages virtual environments in python projects. I wanted to set an environment variable specific to my virtual environment, so whenever I run 'poetry shell' command, it would set certain environment variables automatically.

Is it possible to achieve that using poetry?


Solution

  • This is not directly possible with Poetry.

    But the next minor release (1.2) will introduce a plugin system which can be used to write a plugin that do what you like.

    There is already poetry-dotenv-plugin around, which maybe can do what you are asking for.