This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description
=======
Everett
=======

Everett is a configuration library.

:Code: https://github.com/willkg/everett
:Issues: https://github.com/willkg/everett/issues
:License: MPL v2
:Documentation: https://everett.readthedocs.io/


Goals
=====

This library tries to do configuration with minimal "fanciness":

Configuration with Everett:

* is composeable and flexible
* can pull configuration from a variety of specified sources (environment, ini
files, dict, write-your-own)
* supports parsing values (bool, int, lists, ..., write-your-own)
* supports key namespaces
* facilitates writing tests that change configuration values
* supports component architectures with auto-documentation of configuration with
a Sphinx ``autoconfig`` directive

Everett is inspired by `python-decouple
<https: github.com="" henriquebastos="" python-decouple="">`_ and `configman
<https: configman.readthedocs.io="" en="" latest=""/>`_.


Why not other libs?
===================

Most other libraries I looked at had one or more of the following issues:

* were tied to a specific web app framework
* didn't allow you to specify configuration sources
* had a global configuration object
* made it really hard to override specific configuration when writing tests
* had no facilities for auto-documenting configuration for components


Quick start
===========

You're writing a web app using some framework that doesn't provide
infrastructure for configuration.

You want to pull configuration from an INI file stored in a place specified by
``FOO_INI`` in the environment. You want to pull infrastructure values from the
environment. Values from the environment should override values from the INI
file.

First, you set up your ``ConfigManager`` in your webapp::

from everett.manager import ConfigManager, ConfigOSEnv, ConfigIniEnv


class MyWSGIApp(SomeFrameworkApp):
def __init__(self):
self.config = ConfigManager([
ConfigOSEnv(),
ConfigIniEnv([
os.environ.get('FOO_INI'),
'~/.foo.ini',
'/etc/foo.ini'
]),
])

# Set ``is_debug`` based on configuration
self.is_debug = self.config('debug', parser=bool)


def get_app():
return MyWSGIApp()


Let's write some tests that verify behavior based on the ``debug`` configuration
value::

from everett.manager import config_override

@config_override(DEBUG='true')
def test_debug_true():
app = get_app()
...

@config_override(DEBUG='false')
def test_debug_false():
app = get_app()
...


(``config_override`` works as a class decorator and a context manager, too.)

That probably covers most configuration requirements.


However, say your app needs to connect to RabbitMQ. One way to implement that
functionality is to wrap it up in a self-contained component::

from everett.component import RequiredConfigMixin, ConfigOptions

class RabbitMQComponent(RequiredConfigMixin):
required_config = ConfigOptions()
required_config.add_option(
'host',
doc='RabbitMQ host to connect to'
)
required_config.add_option(
'port',
default='5672',
doc='Port to use',
parser=int
)
required_config.add_option(
'queue_name',
doc='Queue to insert things into'
)

def __init__(self, config):
# Bind the configuration to just the configuration this
# component requires such that this component is
# self-contained.
self.config = config.with_options(self)

self.host = self.config('host')
self.port = self.config('port')
self.queue_name = self.config('queue_name')


Then in your app, you instantiate a ``RabbitMQComponent``, but with configuration
in the ``rmq`` namespace::

queue = RabbitMQComponent(config.with_namespace('rmq'))


In your environment, you would provide ``RMQ_HOST``, etc for this component.

Say your app actually needs to connect to two separate queues--one for regular
processing and one for priority processing::

regular_queue = RabbitMQComponent(
config.with_namespace('regular').with_namespace('rmq')
)
priority_queue = RabbitMQComponent(
config.with_namespace('priority').with_namespace('rmq')
)


In your environment, you provide the regular queue configuration with
``RMQ_REGULAR_HOST``, etc and the priority queue configuration with
``RMQ_PRIORITY_HOST``, etc.

Same component code--two different instances.


Install
=======

>From PyPI
---------

Run::

$ pip install everett


For hacking
-----------

Run::

# Clone the repository
$ git clone https://github.com/willkg/everett

# Create a virtualenvironment
...

# Install Everett and dev requirements
$ pip install -r requirements-dev.txt


History
=======

0.6 (November 28th, 2016)
-------------------------

Feature: Change ``:show-docstring:`` to take an optional value which is the
attribute to pull docstring content from. This means you don't have to mix
programming documentation with user documentation--they can be in different
attributes.

Feature: Add ``RequiredConfigMixin.get_runtime_config()`` which returns the
runtime configuration for a component or tree of components. This lets you print
runtime configuration at startup, generate INI files, etc.

Feature: Add ``ConfigObjEnv`` which lets you use an object for configuration.
This works with argparse's Namespace amongst other things.

Feature: Improve configuration-related exceptions. With Python 3, configuration
errors all derive from ``ConfigurationError`` and have helpful error messages
that should make it clear what's wrong with the configuration value. With Python
2, you can get other kinds of Exceptions thrown depending on the parser used,
but configuration error messages should still be helpful.

Documentation fixes and updates.


0.5 (November 8th, 2016)
------------------------

Feature: Add ``:show-docstring:`` flag to ``autoconfig`` directive.

Feature: Add ``:hide-classname:`` flag to ``autoconfig`` directive.

Feature: Rewrite ``ConfigIniEnv`` to use configobj which allows for nested
sections in INI files. This also allows you to specify multiple INI files
and have later ones override earlier ones.

Bug: Fix ``autoconfig`` Sphinx directive and add tests--it was all kinds of
broken.


0.4 (October 27th, 2016)
------------------------

Feature: Add ``raw_value`` argument to config calls. This makes it easier to
write code that prints configuration.

Bug: Fix ``listify(None)`` to return ``[]``.

Documentation fixes and updates.


0.3.1 (October 12th, 2016)
--------------------------

Bug: Fix ``alternate_keys`` with components. Previously it worked for everything
but components. Now it works with components, too.


0.3 (October 6th, 2016)
-----------------------

Feature: Add ``ConfigManager.from_dict()`` shorthand for building configuration
instances.

Feature: Add ``.get_namespace()`` to ``ConfigManager`` and friends for getting
the complete namespace for a given config instance as a list of strings.

Feature: Make ``ConfigDictEnv`` case-insensitive to keys and namespaces.

Feature: Add ``alternate_keys`` to config call. This lets you specify a list
of keys in order to try if the primary key doesn't find a value. This is
helpful for deprecating keys that you used to use in a backwards-compatible
way.

Feature: Add ``root:`` prefix to keys allowing you to look outside of the
current namespace and at the configuration root for configuration values.


0.2 (August 16th, 2016)
-----------------------

Feature: Add ``ConfigEnvFileEnv`` for supporting ``.env`` files. Thank you,
Paul!

Feature: Change ``ConfigIniEnv`` to take a single path or list of paths. Thank
you, Paul!

Feature: Add "on" and "off" as valid boolean values. This makes it easier to use
config for feature flippers. Thank you, Paul!

Feature: Make ``NO_VALUE`` falsy.

Bug: Fix ``__call__`` returning None--it should return ``NO_VALUE``.

Lots of docs updates: finished the section about making your own parsers, added
a section on using dj-database-url, added a section on django-cache-url and
expanded on existing examples.


0.1 (August 1st, 2016)
----------------------

Initial writing.


Release History

Release History

0.6

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.3.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
everett-0.6-py2.py3-none-any.whl (21.0 kB) Copy SHA256 Checksum SHA256 py2.py3 Wheel Nov 28, 2016
everett-0.6.tar.gz (41.4 kB) Copy SHA256 Checksum SHA256 Source Nov 28, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting