direnv

https://direnv.net/:

sudo apt install direnv

If you are using fish, add the following to ~/.config/fish/config.fish:

direnv hook fish | source

Create a new terminal.

Create a .envrc file in your development folder (where you have the .env file) and add the following:

dotenv_if_exists
dotenv_if_exists .private

When you cd into a folder containing a .envrc file, you will get a warning:

.envrc is blocked. Run `direnv allow` to approve its content

# if you trust the file, run...
direnv allow

From uv: Making Local Python Workflows FAST and BORING in 2025