autoread_dotenv.utils

autoread_dotenv.utils.

We assume following directory-structure: The virtualenv of your project must be created as a .venv-subfolder inside your project-directory.

This corresponds to poetry-config “in-project = true”. The .env-file must reside in the root of your project-directory.

<project-root>
    .env
    .venv/
        bin/
            python
        lib/
        lib64/
        pyvenv.cfg

We also support toplevel-symlinks to the corresponding .venv-files:
bin/       -> .venv/bin/
lib/       -> .venv/lib/
lib64/     -> .venv/lib64/
pyvenv.cfg -> .venv/pyvenv.cfg

Functions

get_expected_dotenv_path()

Return the expected location of the .env for in-project virtualenvs.

get_dotenv_path()

Return the location of the .env for in-project virtualenvs.

str_to_bool(value)

Convert a string value to a boolean.

Module Contents

autoread_dotenv.utils.get_expected_dotenv_path()

Return the expected location of the .env for in-project virtualenvs.

sys.prefix is <project-root>/.venv or <project-root> when using toplevel symlinks to .venv

Return type:

pathlib.Path

autoread_dotenv.utils.get_dotenv_path()

Return the location of the .env for in-project virtualenvs.

Return None if the .env-file does not exist.

Return type:

pathlib.Path | None

autoread_dotenv.utils.str_to_bool(value)

Convert a string value to a boolean.

Parameters:

value (str)

Return type:

bool