named-env

Class-based environment variables typed specification


License
MIT
Install
pip install named-env==2.3.2

Documentation

named-env

Class-based environment variables typed specification.

Installation

pip install named-env

Usage example

from named_env import EnvironmentNamespace, RequiredInteger
import os


class WebApplicationEnvironmentNamespace(EnvironmentNamespace):
    WEB_SERVER_PORT = RequiredInteger()


env = WebApplicationEnvironmentNamespace()

if __name__ == "__main__":
    os.environ["WEB_SERVER_PORT"] = "80"
    print(env.WEB_SERVER_PORT)  # 80
    print(type(env.WEB_SERVER_PORT))  # int