Skip to main content
Help the Python Software Foundation raise $60,000 USD by December 31st!  Building the PSF Q4 Fundraiser

Metaclass for handling configuration class objects using environment variables

Project description

Metaclass for handling configuration class objects using environment variables.

If an environment variable is specified, the metaclass will pull the variable from the environment, the variable defined on the class will be used.

This was built to be a dropin replacement for flask-env but supporting change environment variables after the meta class is loaded.


There are 2 configuration options, that are set on the base class object.

ENV_LOAD_ALL = <True/False>

Setting this on the class will allow loading any environment variable even if it is not set on the base class.

ENV_PREFIX = <string>

Setting this will will be a prefix for variables in the environment.


This should just be pip installed

python3 -m pip install figenv


The basic usecase is below.

import os

import figenv

class Config(metaclass=figenv.MetaConfig):

   ENV_LOAD_ALL = True

   BLAH = True
   TIMEOUT = 5

assert Config.TIMEOUT == 5
assert Config.BLAH is True
except AttributeError:

    'ROCKSTEADY_BLAH': 'false',
    'ROCKSTEADY_WHAT': '2.9',

assert Config.TIMEOUT == 15
assert Config.BLAH is False
assert Config.WHAT == 2.9

Project details

Download files

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

Files for figenv, version 0.1.5
Filename, size File type Python version Upload date Hashes
Filename, size figenv-0.1.5-py3-none-any.whl (3.0 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size figenv-0.1.5.tar.gz (3.1 kB) File type Source Python version None Upload date Hashes View

Supported by

Pingdom Pingdom Monitoring Google Google Object Storage and Download Analytics Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page