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'])
Metadata
Release files for py-env-parser-light 0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| py_env_parser_light-0.1.tar.gz | 2.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| py_env_parser_light-0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.7 kB
Release files / py_env_parser_light-0.1.tar.gz
| Download URL | py_env_parser_light-0.1.tar.gz |
|---|---|
| Size | 2.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
047ee57337309e8583b4c4e52b381974a123f958fcb10dafb0b8526c0154be7b
|
|
BLAKE2b-256 checksum How to use checksums |
86d9c457705677fae9bd7cd1845a0657f9557e02535dc6697d67e20f17fc501f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.1
|
Release files / py_env_parser_light-0.1-py3-none-any.whl
| Download URL | py_env_parser_light-0.1-py3-none-any.whl |
|---|---|
| Size | 2.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
561f1c05cdb5b3e9bb3bfe0695d34b9f45260a00827326291376e79864a6e25b
|
|
BLAKE2b-256 checksum How to use checksums |
7762c7c10b42700526378c07fe892fb494cc61949df2d46bcbbe22fa8a0fadbd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.0.0 CPython/3.11.1
|