Python Library: Everett 3.0.0 reconciles namespaces and components

Share your love

Everett, a configuration library for Python applications has been released in version 3.0.0. The library is designed to enable developers to flexibly configure their applications from different environments. The new main version that has now been presented fixes a problem that previously existed in the interaction between namespaces and the Everett Components.

In previous releases of the 2019 version 1.0 Python library, there was no way to apply a namespace to a configuration that had previously been bound to an Everett Component. With Release 3.0, developers now also have the option of a subsequent namespace assignment, as the following listing shows as an example:

class MyComponent:
    class Config:
        http_host = Option(default="localhost")
        http_port = Option(default="8000", parser=int)

        db_host = Option(default="localhost")
        db_port = Option(default="5432", parser=int)

config = ConfigManager.basic_config()

# Bind the configuration to a specific component so you can only use
# options defined in that component
component_config = config.with_options(MyComponent)

# Apply a namespace which acts as a prefix for options defined in
# the component
http_config = component_config.with_namespace("http")

db_config = component_config.with_namespace("db")

Another important innovation is intended to make the documentation of configurations easier and more convenient. The Everett developers have revised the Sphinx extension for this purpose. It now not only allows options and components to be documented, but can even be used to automatically record the options defined in Python classes and modules. In addition, all options and components have now been indexed and given clear links, making them easier to find in the documentation.

With the release of what is now the third main version, Everett has now been adapted to Python 3.10, but says goodbye to support for Python 3.6 or older versions of the programming language.

Read Also   Java Virtual Machine: GraalVM 21.3 builds on Java 17 and links loops

A complete overview of all changes in version 3.0.0 provides a blog post. The project stands under MPL 2.0 license on GitHub.


Article Source

Share your love