{"library":"python-envcfg","title":"Python EnvCFG","description":"Python EnvCFG (python-envcfg) provides a 'magic module' for accessing environment variables as attributes, automatically converting them to common Python types (str, int, float, bool). It also supports loading configuration from YAML files. The current version is 0.2.0, released in 2017, and the project appears to be no longer actively maintained.","language":"python","status":"abandoned","last_verified":"Fri Apr 17","install":{"commands":["pip install python-envcfg"],"cli":null},"imports":["from envcfg import env","from envcfg import from_yaml"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import os\nfrom envcfg import env\n\n# Simulate setting environment variables for demonstration\nos.environ['DATABASE_URL'] = 'postgres://user:password@host:port/database'\nos.environ['DEBUG'] = 'true'\nos.environ['PORT'] = '8000'\n\nprint(f\"Database URL: {env.DATABASE_URL} (type: {type(env.DATABASE_URL)})\")\nprint(f\"Debug Mode: {env.DEBUG} (type: {type(env.DEBUG)})\") # Auto-converts 'true' to True\nprint(f\"Port Number: {env.PORT} (type: {type(env.PORT)})\") # Auto-converts '8000' to 8000\n\n# Accessing an undefined variable with a default\napp_env = env.APP_ENV('development')\nprint(f\"App Environment: {app_env} (type: {type(app_env)})\")\n\n# Example of retrieving an explicitly string value:\nstring_port = env.PORT('default_string_port') # Ensures string type\nprint(f\"Port as String: {string_port} (type: {type(string_port)})\")","lang":"python","description":"This quickstart demonstrates how to access environment variables using the `env` magic module, including automatic type conversion and providing default values for unset variables. Note that environment variables must be set in `os.environ` before `envcfg` processes them.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":null}