Envier is a Python library for extracting configuration from environment variables in a declarative and 12-factor-app-compliant way. It focuses on type-hinting and clear definition of environment variable mappings to Python objects. The library is currently at version 0.6.1 and is actively maintained with regular releases.
pip install envierVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to define a configuration class using `envier.Env`, specify environment variable mappings with `Env.var`, and handle prefixes for nested configurations. It sets temporary environment variables to ensure the example is runnable.
Review the usage of `HelpInfo` and adapt to its new `namedtuple` structure. Consult the latest documentation for correct access.
Migrate to a different documentation generation approach or manually maintain environment variable documentation.
Upgrade to the latest version to benefit from bug fixes. Carefully review and test configurations involving nested structures and prefixes.
Ensure you are using `envier` version 0.5.2 or newer when defining configuration variables with `Optional[Type]`.
Install the 'envier' library using pip: `pip install envier`
Set the environment variable `YOUR_VARIABLE_NAME` in your shell or `.env` file before running the application, or provide a default value in your `envier` configuration class, e.g., `YOUR_VARIABLE_NAME: str = 'default_value'` or `YOUR_VARIABLE_NAME: str = field(default='default_value')`.
Ensure the environment variable `YOUR_NUMBER_VARIABLE` contains a value that can be successfully converted to the declared type. For example, if it's an `int`, provide a string like '123' instead of 'abc'.
Verify that the attribute `missing_attribute` is correctly defined in your `envier` dataclass (e.g., `class Settings(Env): missing_attribute: str`) and that you are using the correct casing and spelling when accessing it.