Skip to main content

Quickly and efficiently load environment variables into a class

Project description

lenv

Welcome to the lenv package page! This package allows you to quickly, efficiently and conveniently load environment variables into a class!

Features

  • Loading variables into a class by variable name
  • Loading variables into a class by variable value
  • Configurability

Installation

To install/update the lenv package, you need to use pip

python3 -m pip install -U python-lenv

Usage/Examples

First, we'll look at the structure of your project, which should look like this

my-awesome-project
├── .env
└── main.py

Let's go to the file where the variables will be loaded into your class. We will name it .env and put the following content inside

/* .env */
KEY=value

Let's move on to the most important thing, namely our python script where environment variables will be loaded from the .env file we created earlier

# main.py
from lenv import Meta


class Config(metaclass=Meta):
    KEY: str


print(Config.KEY) # value

License

lenv is distributed under the terms of the MIT license.

Project details


Download files

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

Source Distribution

python_lenv-0.1.0.tar.gz (2.6 kB view hashes)

Uploaded Source

Built Distribution

python_lenv-0.1.0-py3-none-any.whl (2.8 kB view hashes)

Uploaded Python 3

Supported by

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