Skip to main content

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_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 expected KEY=VALUE format.

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

This version

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_env_parser_light-0.1.tar.gz (2.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_env_parser_light-0.1-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

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

Hashes for py_env_parser_light-0.1.tar.gz
Algorithm Hash digest
SHA256 047ee57337309e8583b4c4e52b381974a123f958fcb10dafb0b8526c0154be7b
MD5 58e28d935950869a1b3e549bda69d87f
BLAKE2b-256 86d9c457705677fae9bd7cd1845a0657f9557e02535dc6697d67e20f17fc501f

See more details on using hashes here.

File details

Details for the file py_env_parser_light-0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for py_env_parser_light-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 561f1c05cdb5b3e9bb3bfe0695d34b9f45260a00827326291376e79864a6e25b
MD5 74cf746314c0bc6709dcffe8e407e8ea
BLAKE2b-256 7762c7c10b42700526378c07fe892fb494cc61949df2d46bcbbe22fa8a0fadbd

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page