Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Auto-discovery of configurations for easy inline use

Project Description

[![Build Status](](
[![PyPI version](](


Provide an auto-discovery process of configurations for simple code use. Given a path and a list of pattern,
the result config will be a shortcut to any config.

## Usage


config = probe(

Use it:

print config.mynamespace.key

## Parameters

- **path**

Initial path to probe. Patterns will be tested against the file structure underneath the path
and it will be ignored in determining the namespacing.

- **patterns**

A list of file paths containing (or not) placeholders "(\*)" o find where the configuration files are located.
The patterns definition order defines which keys has the priority, the last one being the most relevant.

Each placeholder in the path will result in a namespace in the resulting config. So let's say you have a pattern


If this pattern finds the file : "dir1/**ns1**/dir2/**file**.yaml" that contains "key: 'value'", the resulting
config will be

config.ns1.file.key == "value"

now if the pattern was


for the same file, the resulting config would simply be

config.key == "value"

so you can use placeholders "(\*)" to namespace the resulting config and use "\*" without the parenthesis
to have a variable path without the namespacing

config.ns1.key == "value"

## Mocking the probing

Your unit test can have your code use fake_probe instead to which to give a dict and it will appear as if it
was just probed. Example:

config = fake_probe({
"ns1": {
"file": {
"key": "value"
# then
config.ns1.file.key == "value"


Feel free to raise issues and send some pull request, we'll be happy to look at them!

Release History

This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download Files

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

File Name & Hash SHA256 Hash Help Version File Type Upload Date
(11.3 kB) Copy SHA256 Hash SHA256
Source Dec 9, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS 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