A Python package designed to manage environment variables for your application. It provides a simple and efficient way to parse and handle environment variables from a .env
file.
-
Easy Parsing: The
parse_env_file
method reads an environment file and returns a dictionary of the environment variables. It handles comments and empty lines gracefully, and warns about lines that don't follow the expected format. -
Flexible: It's designed to be used in any Python application that needs to manage environment variables.
-
Error Handling: It provides clear error messages for lines in the
.env
file that don't follow the expectedKEY=VALUE
format.
Remember to always keep your .env
file out of version control to avoid exposing sensitive information.
You can install the package using pip:
pip install py_env_parser_light
from py_env_parser_light import EnvironmentController
controller = EnvironmentController()
env_vars = controller.parse_env_file('.env')['MY_VARIABLE']