A Simple env file parser
Project description
Environment Controller
EnvironmentController is a Python class 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.
Features
-
Easy Parsing: The
parse_env_filemethod 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
.envfile that don't follow the expectedKEY=VALUEformat.
Remember to always keep your .env file out of version control to avoid exposing sensitive information.
Installation
You can install the package using pip:
pip install py_env_parser_light
Usage
from py_env_parser_light import EnvironmentController
Create an instance of the controller
controller = EnvironmentController()
Parse the .env file
env_vars = controller.parse_env_file('.env')
Now you can access your environment variables
print(env_vars['MY_VARIABLE'])
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file py_env_parser_light-0.1.tar.gz.
File metadata
- Download URL: py_env_parser_light-0.1.tar.gz
- Upload date:
- Size: 2.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
047ee57337309e8583b4c4e52b381974a123f958fcb10dafb0b8526c0154be7b
|
|
| MD5 |
58e28d935950869a1b3e549bda69d87f
|
|
| BLAKE2b-256 |
86d9c457705677fae9bd7cd1845a0657f9557e02535dc6697d67e20f17fc501f
|
File details
Details for the file py_env_parser_light-0.1-py3-none-any.whl.
File metadata
- Download URL: py_env_parser_light-0.1-py3-none-any.whl
- Upload date:
- Size: 2.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.1
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
561f1c05cdb5b3e9bb3bfe0695d34b9f45260a00827326291376e79864a6e25b
|
|
| MD5 |
74cf746314c0bc6709dcffe8e407e8ea
|
|
| BLAKE2b-256 |
7762c7c10b42700526378c07fe892fb494cc61949df2d46bcbbe22fa8a0fadbd
|