Poetry Support

Poetry is an excellent tool for managing dependencies. Secrets.env is designed to function as a Poetry plugin, seamlessly loading secrets into the environment for you.

Enabling

Note

Please be aware that poetry are usually installed in a standalone environment, and the plugin must be installed in that environment.

This means even if you’ve installed secrets.env via pip/pipx, you might still need to execute the following command to activate it in Poetry.

The installation command depends on how you installed Poetry:

When your Poetry installation is managed by pipx, you can enable the plugin with the following command:

pipx inject poetry secrets.env

When Poetry is installed via other methods, you can utilize the self add command to enable the plugin:

poetry self add secrets.env

If you need optional dependencies, such as YAML support, you can install them with extras:

pipx inject poetry 'secrets.env[yaml]'
poetry self add secrets.env --extras yaml

Read Introduction for more details on optional dependencies.

Usage

After enabling the plugin, secrets.env is automatically invoked when you run poetry run or poetry shell.

It scans for a valid configuration file following the same strategy outlined in Configurations. If one is located, it injects values into the environment during the environment creation process.